From db8b938f605aad966de4f77d269be404f56f2a14 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Tue, 30 Apr 2019 15:54:26 +0200 Subject: [PATCH] fix(api-v2): Cache base class IRIs correctly when creating/updating class (#1311) Fixes #1310. --- ...BaseToApiV2SimpleTransformationRules.scala | 3 +- .../ontologymessages/OntologyMessagesV2.scala | 2 +- .../responders/v2/OntologyResponderV2.scala | 3 + .../webapi/e2e/v2/OntologyV2R2RSpec.scala | 131 +++++++++++------- .../v2/OntologyResponderV2Spec.scala | 19 +++ 5 files changed, 108 insertions(+), 50 deletions(-) diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/KnoraBaseToApiV2SimpleTransformationRules.scala b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/KnoraBaseToApiV2SimpleTransformationRules.scala index 9fdab4298c..9e9684fdde 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/KnoraBaseToApiV2SimpleTransformationRules.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/KnoraBaseToApiV2SimpleTransformationRules.scala @@ -627,7 +627,8 @@ object KnoraBaseToApiV2SimpleTransformationRules extends OntologyTransformationR iri: IRI => iri.toSmartIri }, ontologySchema = ApiV2Simple - ) + ), + allBaseClasses = subClassOf.map(_.toSmartIri).toSet + datatypeIri.toSmartIri ) } } diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/OntologyMessagesV2.scala b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/OntologyMessagesV2.scala index ab7f501a2c..2f7f7e98bd 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/OntologyMessagesV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/OntologyMessagesV2.scala @@ -2077,7 +2077,7 @@ sealed trait ReadEntityInfoV2 { * @param fileValueProperties a [[Set]] of IRIs of properties in `allCardinalities` that point to `FileValue` objects. */ case class ReadClassInfoV2(entityInfoContent: ClassInfoContentV2, - allBaseClasses: Set[SmartIri] = Set.empty[SmartIri], + allBaseClasses: Set[SmartIri], isResourceClass: Boolean = false, isStandoffClass: Boolean = false, isValueClass: Boolean = false, diff --git a/webapi/src/main/scala/org/knora/webapi/responders/v2/OntologyResponderV2.scala b/webapi/src/main/scala/org/knora/webapi/responders/v2/OntologyResponderV2.scala index 863664f623..91f63f6912 100644 --- a/webapi/src/main/scala/org/knora/webapi/responders/v2/OntologyResponderV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/responders/v2/OntologyResponderV2.scala @@ -1906,6 +1906,7 @@ class OntologyResponderV2(responderData: ResponderData) extends Responder(respon readClassInfo = ReadClassInfoV2( entityInfoContent = unescapedClassDefWithLinkValueProps, + allBaseClasses = allBaseClassIris, isResourceClass = true, canBeInstantiated = true, inheritedCardinalities = inheritedCardinalities, @@ -2269,6 +2270,7 @@ class OntologyResponderV2(responderData: ResponderData) extends Responder(respon readClassInfo = ReadClassInfoV2( entityInfoContent = newInternalClassDefWithLinkValueProps, + allBaseClasses = allBaseClassIris, isResourceClass = true, canBeInstantiated = true, inheritedCardinalities = inheritedCardinalities, @@ -2433,6 +2435,7 @@ class OntologyResponderV2(responderData: ResponderData) extends Responder(respon readClassInfo = ReadClassInfoV2( entityInfoContent = newInternalClassDefWithLinkValueProps, + allBaseClasses = allBaseClassIris, isResourceClass = true, canBeInstantiated = true, inheritedCardinalities = inheritedCardinalities, diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala index 7db0dbb059..b851cb8076 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala @@ -480,38 +480,43 @@ class OntologyV2R2RSpec extends R2RSpec { """.stripMargin val expectedProperties: Set[SmartIri] = Set( - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasName".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasInterval".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThing".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasDate".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#hasIncomingLinkValue".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThingValue".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, "http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThingValue".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasUri".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#attachedToUser".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPicture".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherListItem".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasGeometry".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasDecimal".toSmartIri, "http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThing".toSmartIri, "http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPictureValue".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThingValue".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasDate".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasColor".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPicture".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasName".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherListItem".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasInterval".toSmartIri, "http://www.w3.org/2000/01/rdf-schema#label".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#lastModificationDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#creationDate".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#arkUrl".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThing".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasGeoname".toSmartIri, "http://0.0.0.0:3333/ontology/0001/anything/v2#hasText".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#hasPermissions".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasDecimal".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionArkUrl".toSmartIri, "http://0.0.0.0:3333/ontology/0001/anything/v2#hasBoolean".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasColor".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasUri".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue".toSmartIri, "http://0.0.0.0:3333/ontology/0001/anything/v2#hasInteger".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasGeometry".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasGeoname".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#hasPermissions".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#deleteDate".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThing".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#userHasPermission".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri ) // Convert the submitted JSON-LD to an InputOntologyV2, without SPARQL-escaping, so we can compare it to the response. @@ -569,18 +574,23 @@ class OntologyV2R2RSpec extends R2RSpec { """.stripMargin val expectedProperties: Set[SmartIri] = Set( + "http://api.knora.org/ontology/knora-api/v2#hasIncomingLinkValue".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#attachedToUser".toSmartIri, "http://www.w3.org/2000/01/rdf-schema#label".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#lastModificationDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#creationDate".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#arkUrl".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionArkUrl".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasPermissions".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#deleteDate".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri + "http://api.knora.org/ontology/knora-api/v2#userHasPermission".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri ) // Convert the submitted JSON-LD to an InputOntologyV2, without SPARQL-escaping, so we can compare it to the response. @@ -785,20 +795,25 @@ class OntologyV2R2RSpec extends R2RSpec { """.stripMargin val expectedProperties: Set[SmartIri] = Set( + "http://api.knora.org/ontology/knora-api/v2#hasIncomingLinkValue".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#attachedToUser".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherNothing".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherNothingValue".toSmartIri, "http://www.w3.org/2000/01/rdf-schema#label".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#lastModificationDate".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherNothing".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#creationDate".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#arkUrl".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherNothingValue".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionArkUrl".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasPermissions".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#deleteDate".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri + "http://api.knora.org/ontology/knora-api/v2#userHasPermission".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri ) // Convert the submitted JSON-LD to an InputOntologyV2, without SPARQL-escaping, so we can compare it to the response. @@ -858,18 +873,23 @@ class OntologyV2R2RSpec extends R2RSpec { """.stripMargin val expectedProperties: Set[SmartIri] = Set( + "http://api.knora.org/ontology/knora-api/v2#hasIncomingLinkValue".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#attachedToUser".toSmartIri, "http://www.w3.org/2000/01/rdf-schema#label".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#lastModificationDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#creationDate".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#arkUrl".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionArkUrl".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasPermissions".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#deleteDate".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri + "http://api.knora.org/ontology/knora-api/v2#userHasPermission".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri ) Put("/v2/ontologies/cardinalities", HttpEntity(RdfMediaTypes.`application/ld+json`, params)) ~> addCredentials(BasicHttpCredentials(anythingUsername, password)) ~> ontologiesPath ~> check { @@ -991,19 +1011,24 @@ class OntologyV2R2RSpec extends R2RSpec { """.stripMargin val expectedProperties: Set[SmartIri] = Set( + "http://api.knora.org/ontology/knora-api/v2#hasIncomingLinkValue".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#attachedToUser".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasNothingness".toSmartIri, "http://www.w3.org/2000/01/rdf-schema#label".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#lastModificationDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#creationDate".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#arkUrl".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionArkUrl".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasNothingness".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasPermissions".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#deleteDate".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri + "http://api.knora.org/ontology/knora-api/v2#userHasPermission".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri ) // Convert the submitted JSON-LD to an InputOntologyV2, without SPARQL-escaping, so we can compare it to the response. @@ -1114,19 +1139,24 @@ class OntologyV2R2RSpec extends R2RSpec { """.stripMargin val expectedProperties: Set[SmartIri] = Set( + "http://api.knora.org/ontology/knora-api/v2#hasIncomingLinkValue".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#attachedToUser".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasEmptiness".toSmartIri, "http://www.w3.org/2000/01/rdf-schema#label".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#lastModificationDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#creationDate".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#arkUrl".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo".toSmartIri, - "http://0.0.0.0:3333/ontology/0001/anything/v2#hasEmptiness".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionArkUrl".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasPermissions".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#deleteDate".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri + "http://api.knora.org/ontology/knora-api/v2#userHasPermission".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri ) // Convert the submitted JSON-LD to an InputOntologyV2, without SPARQL-escaping, so we can compare it to the response. @@ -1187,18 +1217,23 @@ class OntologyV2R2RSpec extends R2RSpec { """.stripMargin val expectedProperties: Set[SmartIri] = Set( + "http://api.knora.org/ontology/knora-api/v2#hasIncomingLinkValue".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#attachedToUser".toSmartIri, "http://www.w3.org/2000/01/rdf-schema#label".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#lastModificationDate".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#creationDate".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#arkUrl".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#versionArkUrl".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#hasPermissions".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#isDeleted".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#deleteDate".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deletedBy".toSmartIri, - "http://api.knora.org/ontology/knora-api/v2#deleteComment".toSmartIri + "http://api.knora.org/ontology/knora-api/v2#userHasPermission".toSmartIri, + "http://api.knora.org/ontology/knora-api/v2#attachedToProject".toSmartIri ) Put("/v2/ontologies/cardinalities", HttpEntity(RdfMediaTypes.`application/ld+json`, params)) ~> addCredentials(BasicHttpCredentials(anythingUsername, password)) ~> ontologiesPath ~> check { diff --git a/webapi/src/test/scala/org/knora/webapi/responders/v2/OntologyResponderV2Spec.scala b/webapi/src/test/scala/org/knora/webapi/responders/v2/OntologyResponderV2Spec.scala index e824c5e353..f91dcb8082 100644 --- a/webapi/src/test/scala/org/knora/webapi/responders/v2/OntologyResponderV2Spec.scala +++ b/webapi/src/test/scala/org/knora/webapi/responders/v2/OntologyResponderV2Spec.scala @@ -2095,11 +2095,18 @@ class OntologyResponderV2Spec extends CoreSpec() with ImplicitSender { "http://0.0.0.0:3333/ontology/0001/anything/v2#hasUri" ).map(_.toSmartIri) + val expectedAllBaseClasses: Set[SmartIri] = Set( + "http://api.knora.org/ontology/knora-api/v2#Resource".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#Thing".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#WildThing".toSmartIri + ) + expectMsgPF(timeout) { case msg: ReadOntologyV2 => val externalOntology = msg.toOntologySchema(ApiV2Complex) assert(externalOntology.classes.size == 1) val readClassInfo = externalOntology.classes(classIri) + readClassInfo.allBaseClasses should ===(expectedAllBaseClasses) readClassInfo.entityInfoContent should ===(classInfoContent) readClassInfo.inheritedCardinalities.keySet.contains("http://0.0.0.0:3333/ontology/0001/anything/v2#hasInteger".toSmartIri) should ===(false) readClassInfo.allResourcePropertyCardinalities.keySet should ===(expectedProperties) @@ -3095,11 +3102,17 @@ class OntologyResponderV2Spec extends CoreSpec() with ImplicitSender { propertyIri.fromLinkPropToLinkValueProp ) + val expectedAllBaseClasses: Set[SmartIri] = Set( + "http://api.knora.org/ontology/knora-api/v2#Resource".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#Nothing".toSmartIri + ) + expectMsgPF(timeout) { case msg: ReadOntologyV2 => val externalOntology = msg.toOntologySchema(ApiV2Complex) assert(externalOntology.classes.size == 1) val readClassInfo = externalOntology.classes(classIri) + assert(readClassInfo.allBaseClasses == expectedAllBaseClasses) readClassInfo.entityInfoContent.directCardinalities should ===(expectedDirectCardinalities) readClassInfo.allResourcePropertyCardinalities.keySet should ===(expectedProperties) @@ -3368,11 +3381,17 @@ class OntologyResponderV2Spec extends CoreSpec() with ImplicitSender { AnythingOntologyIri.makeEntityIri("hasEmptiness") ) + val expectedAllBaseClasses: Set[SmartIri] = Set( + "http://api.knora.org/ontology/knora-api/v2#Resource".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#Nothing".toSmartIri + ) + expectMsgPF(timeout) { case msg: ReadOntologyV2 => val externalOntology = msg.toOntologySchema(ApiV2Complex) assert(externalOntology.classes.size == 1) val readClassInfo = externalOntology.classes(classIri) + assert(readClassInfo.allBaseClasses == expectedAllBaseClasses) readClassInfo.entityInfoContent.directCardinalities should ===(classInfoContent.directCardinalities) readClassInfo.allResourcePropertyCardinalities.keySet should ===(expectedProperties)