-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for shared ontologies (#987)
* feature (webapi): add support for shared ontologies * fix (webapi): typo * feature (StringFormatter): Handle shared ontology and entity IRIs. * feature (OntologyResponderV2): Support knora-base:isShared when loading, creating, and updating ontology metadata. * feature (OntologyResponderV2): Enforce restrictions on references to non-shared ontologies. - Add example of a shared ontology. - Add tests. * feature (OntologyResponderV2): Allow shared ontologies to be changed (for development). - Remove tests that are no longer relevant. * feature (OntologyResponderV2): Check inter-ontology references on startup. - Add more tests. * test (OntologyResponderV2): Add tests of shared ontologies. * docs (admin): Fix shared ontologies project shortcode. * test (admin): Fix shared ontologies project shortcode. * feature (webapi): Don't create a resource whose class is from a non-shared ontology in another project. - Add tests. * feature (webapi): Rework shared ontology IRIs to potentially support multiple shared ontology projects. - Fix tests. - Add more tests. - Add docs. - Update release notes. * docs (knora-ontologies): Mention shared ontologies in knora-base doc.
- Loading branch information
Showing
62 changed files
with
4,518 additions
and
2,322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
@prefix xml: <http://www.w3.org/XML/1998/namespace> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix foaf: <http://xmlns.com/foaf/0.1/> . | ||
@prefix knora-base: <http://www.knora.org/ontology/knora-base#> . | ||
@prefix salsah-gui: <http://www.knora.org/ontology/salsah-gui#> . | ||
|
||
@base <http://www.knora.org/ontology/shared/example-box> . | ||
|
||
# An example of a shared ontology. | ||
|
||
@prefix : <http://www.knora.org/ontology/shared/example-box#> . | ||
|
||
<http://www.knora.org/ontology/shared/example-box> rdf:type owl:Ontology ; | ||
rdfs:label "An example of a shared ontology" ; | ||
knora-base:attachedToProject <http://www.knora.org/ontology/knora-base#DefaultSharedOntologiesProject> ; | ||
knora-base:lastModificationDate "2018-09-10T14:53:00.000Z"^^xsd:dateTimeStamp . | ||
|
||
:Box rdf:type owl:Class ; | ||
|
||
rdfs:subClassOf knora-base:Resource , | ||
[ | ||
rdf:type owl:Restriction ; | ||
owl:onProperty :hasName ; | ||
owl:maxCardinality "1"^^xsd:nonNegativeInteger ; | ||
salsah-gui:guiOrder "0"^^xsd:nonNegativeInteger | ||
] ; | ||
|
||
knora-base:resourceIcon "thing.png" ; | ||
|
||
rdfs:label "shared thing"@en ; | ||
|
||
rdfs:comment """A shared thing."""@en . | ||
|
||
|
||
:hasName rdf:type owl:ObjectProperty ; | ||
|
||
rdfs:label "has name"@en ; | ||
|
||
rdfs:comment """Has name."""@en ; | ||
|
||
rdfs:subPropertyOf knora-base:hasValue ; | ||
|
||
knora-base:objectClassConstraint knora-base:TextValue ; | ||
|
||
salsah-gui:guiElement salsah-gui:SimpleText ; | ||
|
||
salsah-gui:guiAttribute "size=80" , | ||
"maxlength=255" . |
41 changes: 41 additions & 0 deletions
41
webapi/_test_data/other.v1.DrawingsGodsV1Spec/parole-religieuse-dummy-onto.ttl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@prefix xml: <http://www.w3.org/XML/1998/namespace> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix foaf: <http://xmlns.com/foaf/0.1/> . | ||
@prefix knora-base: <http://www.knora.org/ontology/knora-base#> . | ||
@prefix salsah-gui: <http://www.knora.org/ontology/salsah-gui#> . | ||
@base <http://www.knora.org/ontology/0106/parole-religieuse> . | ||
|
||
@prefix : <http://www.knora.org/ontology/0106/parole-religieuse#> . | ||
<http://www.knora.org/ontology/0106/parole-religieuse> rdf:type owl:Ontology ; | ||
rdfs:label "A dummy ontology for DrawingsGodsV1E2ESpec" ; | ||
knora-base:attachedToProject <http://rdfh.ch/projects/0106> . | ||
|
||
:hasInteger rdf:type owl:ObjectProperty ; | ||
rdfs:subPropertyOf knora-base:hasValue ; | ||
rdfs:label "Ganzzahl"@de , | ||
"Nombre entier"@fr , | ||
"Intero"@it , | ||
"Integer"@en ; | ||
knora-base:subjectClassConstraint :Thing ; | ||
knora-base:objectClassConstraint knora-base:IntValue ; | ||
salsah-gui:guiElement salsah-gui:Spinbox ; | ||
salsah-gui:guiAttribute "min=0" , | ||
"max=-1" . | ||
|
||
:Thing rdf:type owl:Class ; | ||
rdfs:subClassOf knora-base:Resource , | ||
[ | ||
rdf:type owl:Restriction ; | ||
owl:onProperty :hasInteger ; | ||
owl:minCardinality "0"^^xsd:nonNegativeInteger ; | ||
salsah-gui:guiOrder "4"^^xsd:nonNegativeInteger | ||
] ; | ||
knora-base:resourceIcon "thing.png" ; | ||
rdfs:label "Ding"@de , | ||
"Chose"@fr , | ||
"Cosa"@it , | ||
"Thing"@en ; | ||
rdfs:comment """Just for testing"""@en . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
webapi/_test_data/responders.v2.OntologyResponderV2Spec/class-with-non-shared-base-class.ttl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@prefix xml: <http://www.w3.org/XML/1998/namespace> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix knora-base: <http://www.knora.org/ontology/knora-base#> . | ||
@prefix salsah-gui: <http://www.knora.org/ontology/salsah-gui#> . | ||
@prefix incunabula: <http://www.knora.org/ontology/0803/incunabula#> . | ||
@base <http://www.knora.org/ontology/invalid> . | ||
|
||
# An ontology that has a class whose base class is defined in a non-shared ontology in another project. | ||
|
||
@prefix : <http://www.knora.org/ontology/invalid#> . | ||
<http://www.knora.org/ontology/invalid> rdf:type owl:Ontology ; | ||
rdfs:label "The invalid ontology" ; | ||
knora-base:attachedToProject <http://rdfh.ch/projects/0001> . | ||
|
||
:InvalidThing rdf:type owl:Class ; | ||
|
||
rdfs:subClassOf incunabula:book ; | ||
|
||
knora-base:resourceIcon "thing.png" ; | ||
|
||
rdfs:label "Invalid Thing"@en ; | ||
|
||
rdfs:comment """An invalid thing"""@de . |
32 changes: 32 additions & 0 deletions
32
...pi/_test_data/responders.v2.OntologyResponderV2Spec/class-with-non-shared-cardinality.ttl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@prefix xml: <http://www.w3.org/XML/1998/namespace> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix knora-base: <http://www.knora.org/ontology/knora-base#> . | ||
@prefix salsah-gui: <http://www.knora.org/ontology/salsah-gui#> . | ||
@prefix incunabula: <http://www.knora.org/ontology/0803/incunabula#> . | ||
@base <http://www.knora.org/ontology/invalid> . | ||
|
||
# An ontology that has a class with a cardinality on a property defined in a non-shared ontology in another project. | ||
|
||
@prefix : <http://www.knora.org/ontology/invalid#> . | ||
<http://www.knora.org/ontology/invalid> rdf:type owl:Ontology ; | ||
rdfs:label "The invalid ontology" ; | ||
knora-base:attachedToProject <http://rdfh.ch/projects/0001> . | ||
|
||
:InvalidThing rdf:type owl:Class ; | ||
|
||
rdfs:subClassOf knora-base:Resource , | ||
[ | ||
rdf:type owl:Restriction ; | ||
owl:onProperty incunabula:description ; | ||
owl:minCardinality "0"^^xsd:nonNegativeInteger ; | ||
salsah-gui:guiOrder "1"^^xsd:nonNegativeInteger | ||
] ; | ||
|
||
knora-base:resourceIcon "thing.png" ; | ||
|
||
rdfs:label "Invalid Thing"@en ; | ||
|
||
rdfs:comment """An invalid thing"""@de . |
Oops, something went wrong.