Skip to content
Permalink
Browse files
feat(api-v2): Add routes for checking whether ontology entities can b…
…e changed (DSP-1621) (#1861)
  • Loading branch information
Benjamin Geer committed May 25, 2021
1 parent e58e463 commit fdd098f38acd2538a8a06bae79cc934703219437
Showing with 12,494 additions and 8,361 deletions.
  1. +69 −1 docs/03-apis/api-v2/ontology-information.md
  2. +442 −442 test_data/ontologyR2RV2/anythingOntologyWithValueObjects.ttl
  3. +88 −88 test_data/ontologyR2RV2/anythingThingWithAllLanguages.ttl
  4. +33 −33 test_data/ontologyR2RV2/boxOntologyWithValueObjects.ttl
  5. +89 −89 test_data/ontologyR2RV2/imagesBild.ttl
  6. +62 −62 test_data/ontologyR2RV2/incunabulaBook.ttl
  7. +89 −89 test_data/ontologyR2RV2/incunabulaOntologySimple.ttl
  8. +237 −237 test_data/ontologyR2RV2/incunabulaOntologyWithValueObjects.ttl
  9. +67 −67 test_data/ontologyR2RV2/incunabulaPage.ttl
  10. +138 −138 test_data/ontologyR2RV2/incunabulaPageAndBookWithValueObjects.ttl
  11. +27 −27 test_data/ontologyR2RV2/knoraApiDateValue.ttl
  12. +107 −107 test_data/ontologyR2RV2/knoraApiOntologySimple.ttl
  13. +9 −0 test_data/ontologyR2RV2/knoraApiOntologyWithValueObjects.jsonld
  14. +8,885 −5,342 test_data/ontologyR2RV2/knoraApiOntologyWithValueObjects.rdf
  15. +1,121 −1,116 test_data/ontologyR2RV2/knoraApiOntologyWithValueObjects.ttl
  16. +404 −404 test_data/ontologyR2RV2/standoffOntologyWithValueObjects.ttl
  17. +1 −0 webapi/scripts/expected-client-test-data.txt
  18. +4 −3 webapi/src/main/scala/org/knora/webapi/messages/OntologyConstants.scala
  19. +34 −8 webapi/src/main/scala/org/knora/webapi/messages/v2/responder/KnoraResponseV2.scala
  20. +21 −0 ...ra/webapi/messages/v2/responder/ontologymessages/KnoraBaseToApiV2ComplexTransformationRules.scala
  21. +71 −24 ...i/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/OntologyMessagesV2.scala
  22. +32 −13 webapi/src/main/scala/org/knora/webapi/responders/Responder.scala
  23. +202 −57 webapi/src/main/scala/org/knora/webapi/responders/v2/OntologyResponderV2.scala
  24. +1 −1 webapi/src/main/scala/org/knora/webapi/responders/v2/ResourcesResponderV2.scala
  25. +154 −10 webapi/src/main/scala/org/knora/webapi/routing/v2/OntologiesRouteV2.scala
  26. +107 −3 webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala
@@ -967,7 +967,7 @@ and the request must have this additional boolean property:
"knora-api:isShared" : true
```

See [Shared Ontologies](knora-iris.md#shared-ontologies) for details about
See [Shared Ontologies](../../02-knora-ontologies/introduction.md#shared-ontologies) for details about
shared ontologies.

A successful response will be a JSON-LD document providing only the
@@ -1051,6 +1051,23 @@ URL-encoded.
A successful response will be a JSON-LD document containing a
confirmation message.

To check whether a property can be deleted:

```
HTTP GET to http://host/v2/ontologies/candeleteontology/ONTOLOGY_IRI
```

The response will look like this:

```jsonld
{
"knora-api:canDo": false,
"@context": {
"knora-api": "http://api.knora.org/ontology/knora-api/v2#"
}
}
```

### Creating a Class Without Cardinalities

```
@@ -1558,6 +1575,23 @@ on the corresponding link value property is automatically added (see
A successful response will be a JSON-LD document providing the new class
definition (but not any of the other entities in the ontology).

To check whether a class's cardinalities can be replaced:

```
HTTP GET to http://host/v2/ontologies/canreplacecardinalities/CLASS_IRI
```

The response will look like this:

```jsonld
{
"knora-api:canDo": false,
"@context": {
"knora-api": "http://api.knora.org/ontology/knora-api/v2#"
}
}
```

### Changing the GUI Order of Cardinalities

To change the GUI order of one or more cardinalities in a class:
@@ -1625,6 +1659,23 @@ will automatically be deleted.
A successful response will be a JSON-LD document providing only the
ontology's metadata.

To check whether a property can be deleted:

```
HTTP GET to http://host/v2/ontologies/candeleteproperty/PROPERTY_IRI
```

The response will look like this:

```jsonld
{
"knora-api:canDo": false,
"@context": {
"knora-api": "http://api.knora.org/ontology/knora-api/v2#"
}
}
```

### Deleting a Class

A class can be deleted only if no other ontology entity refers to it,
@@ -1639,3 +1690,20 @@ URL-encoded.

A successful response will be a JSON-LD document providing only the
ontology's metadata.

To check whether a class can be deleted:

```
HTTP GET to http://host/v2/ontologies/candeleteclass/CLASS_IRI
```

The response will look like this:

```jsonld
{
"knora-api:canDo": false,
"@context": {
"knora-api": "http://api.knora.org/ontology/knora-api/v2#"
}
}
```

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -10,75 +10,80 @@ example-box:Box a owl:Class ;
rdfs:comment "A shared thing." ;
rdfs:label "shared thing" ;
rdfs:subClassOf knora-api:Resource ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:cardinality 1 ;
owl:onProperty knora-api:creationDate
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:cardinality 1 ;
owl:onProperty knora-api:attachedToProject
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:maxCardinality 1 ;
owl:onProperty knora-api:lastModificationDate
owl:onProperty knora-api:deleteComment
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:minCardinality 0 ;
owl:onProperty knora-api:hasStandoffLinkToValue
owl:cardinality 1 ;
owl:onProperty knora-api:attachedToUser
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:minCardinality 0 ;
owl:onProperty knora-api:hasStandoffLinkTo
owl:maxCardinality 1 ;
owl:onProperty knora-api:versionDate
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:maxCardinality 1 ;
owl:onProperty knora-api:isDeleted
owl:onProperty knora-api:deletedBy
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:maxCardinality 1 ;
owl:onProperty knora-api:deleteComment
owl:onProperty knora-api:isDeleted
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:cardinality 1 ;
owl:onProperty knora-api:hasPermissions
owl:maxCardinality 1 ;
owl:onProperty knora-api:deleteDate
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:cardinality 1 ;
owl:onProperty knora-api:attachedToUser
owl:minCardinality 0 ;
owl:onProperty knora-api:hasStandoffLinkTo
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:cardinality 1 ;
owl:onProperty knora-api:userHasPermission
owl:onProperty knora-api:hasPermissions
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:maxCardinality 1 ;
owl:onProperty knora-api:deleteDate
owl:onProperty knora-api:lastModificationDate
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:cardinality 1 ;
owl:onProperty knora-api:attachedToProject
] ;
rdfs:subClassOf [ a owl:Restriction ;
salsah-gui:guiOrder 0 ;
owl:maxCardinality 1 ;
owl:onProperty example-box:hasName
owl:minCardinality 0 ;
owl:onProperty knora-api:hasIncomingLinkValue
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:cardinality 1 ;
owl:onProperty knora-api:arkUrl
owl:onProperty knora-api:userHasPermission
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:cardinality 1 ;
owl:onProperty knora-api:versionArkUrl
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:minCardinality 0 ;
owl:onProperty knora-api:hasIncomingLinkValue
rdfs:subClassOf [ a owl:Restriction ;
salsah-gui:guiOrder 0 ;
owl:maxCardinality 1 ;
owl:onProperty example-box:hasName
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
@@ -87,18 +92,13 @@ example-box:Box a owl:Class ;
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:maxCardinality 1 ;
owl:onProperty knora-api:deletedBy
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:maxCardinality 1 ;
owl:onProperty knora-api:versionDate
owl:minCardinality 0 ;
owl:onProperty knora-api:hasStandoffLinkToValue
] ;
rdfs:subClassOf [ a owl:Restriction ;
knora-api:isInherited true ;
owl:cardinality 1 ;
owl:onProperty knora-api:creationDate
owl:onProperty knora-api:arkUrl
] ;
knora-api:canBeInstantiated true ;
knora-api:isResourceClass true ;

0 comments on commit fdd098f

Please sign in to comment.