From de14ab1cf87b82f23b1d115164be51a9fad7811c Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Thu, 10 Sep 2020 13:14:25 +0200 Subject: [PATCH] feat(api-v2): Add test data. (#1704) --- .../webapi/routing/v2/OntologiesRouteV2.scala | 57 +-- .../sharedtestdata/SharedTestDataADM.scala | 348 +++++++++++++++++- .../webapi/e2e/v2/OntologyV2R2RSpec.scala | 46 +-- 3 files changed, 372 insertions(+), 79 deletions(-) diff --git a/webapi/src/main/scala/org/knora/webapi/routing/v2/OntologiesRouteV2.scala b/webapi/src/main/scala/org/knora/webapi/routing/v2/OntologiesRouteV2.scala index f89c926b08..a364d3e868 100644 --- a/webapi/src/main/scala/org/knora/webapi/routing/v2/OntologiesRouteV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/routing/v2/OntologiesRouteV2.scala @@ -58,6 +58,7 @@ class OntologiesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) private val ALL_LANGUAGES = "allLanguages" private val LAST_MODIFICATION_DATE = "lastModificationDate" + private val anythingLastModDate: Instant = Instant.parse("2017-12-19T15:23:42.166Z") /** * Returns the route. @@ -343,8 +344,6 @@ class OntologiesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) } private def createClassTestRequest: Future[Set[TestDataFileContent]] = { - val anythingLastModDate: Instant = Instant.parse("2017-12-19T15:23:42.166Z") - FastFuture.successful( Set( TestDataFileContent( @@ -403,8 +402,6 @@ class OntologiesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) } private def updateClassTestRequest: Future[Set[TestDataFileContent]] = { - val anythingLastModDate: Instant = Instant.parse("2017-12-19T15:23:42.166Z") - FastFuture.successful( Set( TestDataFileContent( @@ -455,13 +452,17 @@ class OntologiesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) } } - private def addCardinalitiesTestRequest: Future[TestDataFileContent] = { - val anythingLastModDate: Instant = Instant.parse("2017-12-19T15:23:42.166Z") - + private def addCardinalitiesTestRequestAndResponse: Future[Set[TestDataFileContent]] = { FastFuture.successful( - TestDataFileContent( - filePath = TestDataFilePath.makeJsonPath("add-cardinalities-to-class-nothing-request"), - text = SharedTestDataADM.addCardinality(SharedOntologyTestDataADM.ANYTHING_ONTOLOGY_IRI_LocalHost, anythingLastModDate) + Set( + TestDataFileContent( + filePath = TestDataFilePath.makeJsonPath("add-cardinalities-to-class-nothing-request"), + text = SharedTestDataADM.addCardinality(SharedOntologyTestDataADM.ANYTHING_ONTOLOGY_IRI_LocalHost, anythingLastModDate) + ), + TestDataFileContent( + filePath = TestDataFilePath.makeJsonPath("add-cardinalities-to-class-nothing-response"), + text = SharedTestDataADM.addCardinalityResponse + ) ) ) } @@ -500,9 +501,7 @@ class OntologiesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) } } - private def replaceCardinalitiesTestRequest: Future[Set[TestDataFileContent]] = { - val anythingLastModDate: Instant = Instant.parse("2017-12-19T15:23:42.166Z") - + private def replaceCardinalitiesTestRequests: Future[Set[TestDataFileContent]] = { FastFuture.successful( Set( TestDataFileContent( @@ -685,11 +684,25 @@ class OntologiesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) } } - private def createPropertyTestRequest: Future[TestDataFileContent] = { + private def createPropertyTestRequestsAndResponses: Future[Set[TestDataFileContent]] = { FastFuture.successful( - TestDataFileContent( - filePath = TestDataFilePath.makeJsonPath("create-property-hasName-request"), - text = SharedTestDataADM.createProperty(SharedOntologyTestDataADM.ANYTHING_ONTOLOGY_IRI_LocalHost) + Set( + TestDataFileContent( + filePath = TestDataFilePath.makeJsonPath("create-value-property-request"), + text = SharedTestDataADM.createValueProperty(SharedOntologyTestDataADM.ANYTHING_ONTOLOGY_IRI_LocalHost, anythingLastModDate) + ), + TestDataFileContent( + filePath = TestDataFilePath.makeJsonPath("create-value-property-response"), + text = SharedTestDataADM.createValuePropertyResponse + ), + TestDataFileContent( + filePath = TestDataFilePath.makeJsonPath("create-link-property-request"), + text = SharedTestDataADM.createLinkProperty(SharedOntologyTestDataADM.ANYTHING_ONTOLOGY_IRI_LocalHost, anythingLastModDate) + ), + TestDataFileContent( + filePath = TestDataFilePath.makeJsonPath("create-link-property-response"), + text = SharedTestDataADM.createLinkPropertyResponse + ) ) ) } @@ -729,8 +742,6 @@ class OntologiesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) } private def updatePropertyTestRequest: Future[Set[TestDataFileContent]] = { - val anythingLastModDate: Instant = Instant.parse("2017-12-19T15:23:42.166Z") - FastFuture.successful( Set( TestDataFileContent( @@ -998,15 +1009,15 @@ class OntologiesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) updateOntologyMetadataRequest: TestDataFileContent <- updateOntologyMetadataTestRequest createClassRequest: Set[TestDataFileContent] <- createClassTestRequest createClassResponse: TestDataFileContent <- createClassTestResponse - addCardinalitiesRequest: TestDataFileContent <- addCardinalitiesTestRequest - createPropertyRequest: TestDataFileContent <- createPropertyTestRequest + addCardinalitiesRequest: Set[TestDataFileContent] <- addCardinalitiesTestRequestAndResponse + createPropertyRequest: Set[TestDataFileContent] <- createPropertyTestRequestsAndResponses updateClassRequest: Set[TestDataFileContent] <- updateClassTestRequest - replaceCardinalitiesRequest: Set[TestDataFileContent] <- replaceCardinalitiesTestRequest + replaceCardinalitiesRequest: Set[TestDataFileContent] <- replaceCardinalitiesTestRequests updatePropertyRequest: Set[TestDataFileContent] <- updatePropertyTestRequest deleteOntologyResponse: TestDataFileContent <- deleteOntologyTestResponse } yield ontologyResponses + ontologyMetadataResponses ++ projectOntologiesResponses ++ ontologyClassResponses ++ ontologyPropertyResponses ++ createOntologyRequest ++ createOntologyResponse + updateOntologyMetadataRequest ++ - createClassRequest + createClassResponse + addCardinalitiesRequest + createPropertyRequest ++ + createClassRequest + createClassResponse ++ addCardinalitiesRequest ++ createPropertyRequest ++ updateClassRequest ++ replaceCardinalitiesRequest ++ updatePropertyRequest + deleteOntologyResponse } } diff --git a/webapi/src/main/scala/org/knora/webapi/sharedtestdata/SharedTestDataADM.scala b/webapi/src/main/scala/org/knora/webapi/sharedtestdata/SharedTestDataADM.scala index 8325826f43..0efb213cb0 100644 --- a/webapi/src/main/scala/org/knora/webapi/sharedtestdata/SharedTestDataADM.scala +++ b/webapi/src/main/scala/org/knora/webapi/sharedtestdata/SharedTestDataADM.scala @@ -2388,10 +2388,10 @@ object SharedTestDataADM { |}""".stripMargin } - def createClassWithCardinalities(anythinOntologyIri: IRI, anythingLastModDate: Instant): String = { + def createClassWithCardinalities(anythingOntologyIri: IRI, anythingLastModDate: Instant): String = { s""" |{ - | "@id" : "$anythinOntologyIri", + | "@id" : "$anythingOntologyIri", | "@type" : "owl:Ontology", | "knora-api:lastModificationDate" : { | "@type" : "xsd:dateTimeStamp", @@ -2436,10 +2436,10 @@ object SharedTestDataADM { } - def createClassWithoutCardinalities(anythinOntologyIri: IRI, anythingLastModDate: Instant): String = { + def createClassWithoutCardinalities(anythingOntologyIri: IRI, anythingLastModDate: Instant): String = { s""" |{ - | "@id" : "$anythinOntologyIri", + | "@id" : "$anythingOntologyIri", | "@type" : "owl:Ontology", | "knora-api:lastModificationDate" : { | "@type" : "xsd:dateTimeStamp", @@ -2466,7 +2466,7 @@ object SharedTestDataADM { | "owl" : "http://www.w3.org/2002/07/owl#", | "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", | "xsd" : "http://www.w3.org/2001/XMLSchema#", - | "anything" : "$anythinOntologyIri#" + | "anything" : "$anythingOntologyIri#" | } |} """.stripMargin @@ -2653,10 +2653,10 @@ object SharedTestDataADM { |}""".stripMargin } - def addCardinality(anythinOntologyIri: IRI, anythingLastModDate: Instant): String = { + def addCardinality(anythingOntologyIri: IRI, anythingLastModDate: Instant): String = { s""" |{ - | "@id" : "$anythinOntologyIri", + | "@id" : "$anythingOntologyIri", | "@type" : "owl:Ontology", | "knora-api:lastModificationDate" : { | "@type" : "xsd:dateTimeStamp", @@ -2679,20 +2679,197 @@ object SharedTestDataADM { | "owl" : "http://www.w3.org/2002/07/owl#", | "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", | "xsd" : "http://www.w3.org/2001/XMLSchema#", - | "anything" : "$anythinOntologyIri#" + | "anything" : "$anythingOntologyIri#" | } |} """.stripMargin } - def createProperty(anythinOntologyIri: IRI): String = { + def addCardinalityResponse: String = + """{ + | "@graph" : [ { + | "@id" : "anything:Nothing", + | "@type" : "owl:Class", + | "knora-api:canBeInstantiated" : true, + | "knora-api:isResourceClass" : true, + | "rdfs:comment" : [ { + | "@language" : "en", + | "@value" : "Represents nothing" + | }, { + | "@language" : "fr", + | "@value" : "ne représente rien" + | } ], + | "rdfs:label" : [ { + | "@language" : "en", + | "@value" : "nothing" + | }, { + | "@language" : "fr", + | "@value" : "rien" + | } ], + | "rdfs:subClassOf" : [ { + | "@id" : "knora-api:Resource" + | }, { + | "@type" : "owl:Restriction", + | "owl:maxCardinality" : 1, + | "owl:onProperty" : { + | "@id" : "anything:hasOtherNothing" + | } + | }, { + | "@type" : "owl:Restriction", + | "owl:maxCardinality" : 1, + | "owl:onProperty" : { + | "@id" : "anything:hasOtherNothingValue" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:cardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:arkUrl" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:cardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:attachedToProject" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:cardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:attachedToUser" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:cardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:creationDate" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:maxCardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:deleteComment" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:maxCardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:deleteDate" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:maxCardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:deletedBy" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:minCardinality" : 0, + | "owl:onProperty" : { + | "@id" : "knora-api:hasIncomingLinkValue" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:cardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:hasPermissions" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:minCardinality" : 0, + | "owl:onProperty" : { + | "@id" : "knora-api:hasStandoffLinkTo" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:minCardinality" : 0, + | "owl:onProperty" : { + | "@id" : "knora-api:hasStandoffLinkToValue" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:maxCardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:isDeleted" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:maxCardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:lastModificationDate" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:cardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:userHasPermission" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:cardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:versionArkUrl" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:maxCardinality" : 1, + | "owl:onProperty" : { + | "@id" : "knora-api:versionDate" + | } + | }, { + | "@type" : "owl:Restriction", + | "knora-api:isInherited" : true, + | "owl:cardinality" : 1, + | "owl:onProperty" : { + | "@id" : "rdfs:label" + | } + | } ] + | } ], + | "@id" : "http://0.0.0.0:3333/ontology/0001/anything/v2", + | "@type" : "owl:Ontology", + | "knora-api:attachedToProject" : { + | "@id" : "http://rdfh.ch/projects/0001" + | }, + | "knora-api:lastModificationDate" : { + | "@type" : "xsd:dateTimeStamp", + | "@value" : "2020-09-10T09:41:17.151318Z" + | }, + | "rdfs:label" : "The anything ontology", + | "@context" : { + | "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + | "knora-api" : "http://api.knora.org/ontology/knora-api/v2#", + | "owl" : "http://www.w3.org/2002/07/owl#", + | "salsah-gui" : "http://api.knora.org/ontology/salsah-gui/v2#", + | "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", + | "xsd" : "http://www.w3.org/2001/XMLSchema#", + | "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#" + | } + |}""".stripMargin + + def createValueProperty(anythingOntologyIri: IRI, anythingLastModDate: Instant): String = { s""" |{ - | "@id" : "$anythinOntologyIri", + | "@id" : "$anythingOntologyIri", | "@type" : "owl:Ontology", | "knora-api:lastModificationDate" : { | "@type" : "xsd:dateTimeStamp", - | "@value" : "2017-12-19T15:23:42.166Z" + | "@value" : "$anythingLastModDate" | }, | "@graph" : [ { | "@id" : "anything:hasName", @@ -2734,12 +2911,159 @@ object SharedTestDataADM { | "owl" : "http://www.w3.org/2002/07/owl#", | "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", | "xsd" : "http://www.w3.org/2001/XMLSchema#", - | "anything" : "$anythinOntologyIri#" + | "anything" : "$anythingOntologyIri#" | } |} """.stripMargin } + val createValuePropertyResponse: String = + """{ + | "@graph" : [ { + | "@id" : "anything:hasName", + | "@type" : "owl:ObjectProperty", + | "knora-api:isEditable" : true, + | "knora-api:isResourceProperty" : true, + | "knora-api:objectType" : { + | "@id" : "knora-api:TextValue" + | }, + | "knora-api:subjectType" : { + | "@id" : "anything:Thing" + | }, + | "salsah-gui:guiAttribute" : [ "maxlength=100", "size=80" ], + | "salsah-gui:guiElement" : { + | "@id" : "salsah-gui:SimpleText" + | }, + | "rdfs:comment" : [ { + | "@language" : "en", + | "@value" : "The name of a Thing" + | }, { + | "@language" : "de", + | "@value" : "Der Name eines Dinges" + | } ], + | "rdfs:label" : [ { + | "@language" : "en", + | "@value" : "has name" + | }, { + | "@language" : "de", + | "@value" : "hat Namen" + | } ], + | "rdfs:subPropertyOf" : [ { + | "@id" : "knora-api:hasValue" + | }, { + | "@id" : "http://schema.org/name" + | } ] + | } ], + | "@id" : "http://0.0.0.0:3333/ontology/0001/anything/v2", + | "@type" : "owl:Ontology", + | "knora-api:attachedToProject" : { + | "@id" : "http://rdfh.ch/projects/0001" + | }, + | "knora-api:lastModificationDate" : { + | "@type" : "xsd:dateTimeStamp", + | "@value" : "2020-09-10T09:28:47.884563Z" + | }, + | "rdfs:label" : "The anything ontology", + | "@context" : { + | "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + | "knora-api" : "http://api.knora.org/ontology/knora-api/v2#", + | "owl" : "http://www.w3.org/2002/07/owl#", + | "salsah-gui" : "http://api.knora.org/ontology/salsah-gui/v2#", + | "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", + | "xsd" : "http://www.w3.org/2001/XMLSchema#", + | "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#" + | } + |}""".stripMargin + + def createLinkProperty(anythingOntologyIri: IRI, anythingLastModDate: Instant): String = { + s""" + |{ + | "@id" : "$anythingOntologyIri", + | "@type" : "owl:Ontology", + | "knora-api:lastModificationDate" : { + | "@type" : "xsd:dateTimeStamp", + | "@value" : "$anythingLastModDate" + | }, + | "@graph" : [ { + | "@id" : "anything:hasOtherNothing", + | "@type" : "owl:ObjectProperty", + | "knora-api:subjectType" : { + | "@id" : "anything:Nothing" + | }, + | "knora-api:objectType" : { + | "@id" : "anything:Nothing" + | }, + | "rdfs:comment" : { + | "@language" : "en", + | "@value" : "Refers to the other Nothing of a Nothing" + | }, + | "rdfs:label" : { + | "@language" : "en", + | "@value" : "has nothingness" + | }, + | "rdfs:subPropertyOf" : { + | "@id" : "knora-api:hasLinkTo" + | } + | } ], + | "@context" : { + | "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + | "knora-api" : "http://api.knora.org/ontology/knora-api/v2#", + | "owl" : "http://www.w3.org/2002/07/owl#", + | "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", + | "xsd" : "http://www.w3.org/2001/XMLSchema#", + | "anything" : "$anythingOntologyIri#" + | } + |} + """.stripMargin + } + + val createLinkPropertyResponse: String = + """{ + | "@graph" : [ { + | "@id" : "anything:hasOtherNothing", + | "@type" : "owl:ObjectProperty", + | "knora-api:isEditable" : true, + | "knora-api:isLinkProperty" : true, + | "knora-api:isResourceProperty" : true, + | "knora-api:objectType" : { + | "@id" : "anything:Nothing" + | }, + | "knora-api:subjectType" : { + | "@id" : "anything:Nothing" + | }, + | "rdfs:comment" : { + | "@language" : "en", + | "@value" : "Refers to the other Nothing of a Nothing" + | }, + | "rdfs:label" : { + | "@language" : "en", + | "@value" : "has nothingness" + | }, + | "rdfs:subPropertyOf" : { + | "@id" : "knora-api:hasLinkTo" + | } + | } ], + | "@id" : "http://0.0.0.0:3333/ontology/0001/anything/v2", + | "@type" : "owl:Ontology", + | "knora-api:attachedToProject" : { + | "@id" : "http://rdfh.ch/projects/0001" + | }, + | "knora-api:lastModificationDate" : { + | "@type" : "xsd:dateTimeStamp", + | "@value" : "2020-09-10T09:28:51.537917Z" + | }, + | "rdfs:label" : "The anything ontology", + | "@context" : { + | "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + | "knora-api" : "http://api.knora.org/ontology/knora-api/v2#", + | "owl" : "http://www.w3.org/2002/07/owl#", + | "salsah-gui" : "http://api.knora.org/ontology/salsah-gui/v2#", + | "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", + | "xsd" : "http://www.w3.org/2001/XMLSchema#", + | "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#" + | } + |}""".stripMargin + def changeClassLabel(anythingOntologyIri: IRI, anythingLastModDate: Instant): String = { s""" |{ 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 497483bbd7..0d89f9a23f 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 @@ -307,8 +307,7 @@ class OntologyV2R2RSpec extends R2RSpec { } "create a property anything:hasName as a subproperty of knora-api:hasValue and schema:name" in { - val params = SharedTestDataADM.createProperty(SharedOntologyTestDataADM.ANYTHING_ONTOLOGY_IRI_LocalHost) - + val params = SharedTestDataADM.createValueProperty(SharedOntologyTestDataADM.ANYTHING_ONTOLOGY_IRI_LocalHost, anythingLastModDate) // Convert the submitted JSON-LD to an InputOntologyV2, without SPARQL-escaping, so we can compare it to the response. val paramsAsInput: InputOntologyV2 = InputOntologyV2.fromJsonLD(JsonLDUtil.parseJsonLD(params)).unescape @@ -485,46 +484,7 @@ class OntologyV2R2RSpec extends R2RSpec { } "create a property anything:hasOtherNothing with knora-api:objectType anything:Nothing" in { - val params = - s""" - |{ - | "@id" : "http://0.0.0.0:3333/ontology/0001/anything/v2", - | "@type" : "owl:Ontology", - | "knora-api:lastModificationDate" : { - | "@type" : "xsd:dateTimeStamp", - | "@value" : "$anythingLastModDate" - | }, - | "@graph" : [ { - | "@id" : "anything:hasOtherNothing", - | "@type" : "owl:ObjectProperty", - | "knora-api:subjectType" : { - | "@id" : "anything:Nothing" - | }, - | "knora-api:objectType" : { - | "@id" : "anything:Nothing" - | }, - | "rdfs:comment" : { - | "@language" : "en", - | "@value" : "Refers to the other Nothing of a Nothing" - | }, - | "rdfs:label" : { - | "@language" : "en", - | "@value" : "has nothingness" - | }, - | "rdfs:subPropertyOf" : { - | "@id" : "knora-api:hasLinkTo" - | } - | } ], - | "@context" : { - | "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - | "knora-api" : "http://api.knora.org/ontology/knora-api/v2#", - | "owl" : "http://www.w3.org/2002/07/owl#", - | "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", - | "xsd" : "http://www.w3.org/2001/XMLSchema#", - | "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#" - | } - |} - """.stripMargin + val params = SharedTestDataADM.createLinkProperty(SharedOntologyTestDataADM.ANYTHING_ONTOLOGY_IRI_LocalHost, anythingLastModDate) // Convert the submitted JSON-LD to an InputOntologyV2, without SPARQL-escaping, so we can compare it to the response. val paramsAsInput: InputOntologyV2 = InputOntologyV2.fromJsonLD(JsonLDUtil.parseJsonLD(params)).unescape @@ -547,9 +507,7 @@ class OntologyV2R2RSpec extends R2RSpec { "add a cardinality for the property anything:hasOtherNothing to the class anything:Nothing" in { val params = SharedTestDataADM.addCardinality(SharedOntologyTestDataADM.ANYTHING_ONTOLOGY_IRI_LocalHost, anythingLastModDate) - // Convert the submitted JSON-LD to an InputOntologyV2, without SPARQL-escaping, so we can compare it to the response. - val paramsAsInput: InputOntologyV2 = InputOntologyV2.fromJsonLD(JsonLDUtil.parseJsonLD(params)).unescape val paramsWithAddedLinkValueCardinality = paramsAsInput.copy(