Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api-v2): Change link value comment #1582

Merged
merged 6 commits into from Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
111 changes: 78 additions & 33 deletions webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala
Expand Up @@ -1005,22 +1005,44 @@ object SharedTestDataADM {
}

def createLinkValueRequest(resourceIri: IRI,
targetResourceIri: IRI): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasOtherThingValue" : {
| "@type" : "knora-api:LinkValue",
| "knora-api:linkValueHasTargetIri" : {
| "@id" : "$targetResourceIri"
| }
| },
| "@context" : {
| "xsd" : "http://www.w3.org/2001/XMLSchema#",
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
targetResourceIri: IRI,
valueHasComment: Option[String] = None): String = {
valueHasComment match {
case Some(comment) =>
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasOtherThingValue" : {
| "@type" : "knora-api:LinkValue",
| "knora-api:linkValueHasTargetIri" : {
| "@id" : "$targetResourceIri"
| },
| "knora-api:valueHasComment" : "$comment"
| },
| "@context" : {
| "xsd" : "http://www.w3.org/2001/XMLSchema#",
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin

case None =>
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasOtherThingValue" : {
| "@type" : "knora-api:LinkValue",
| "knora-api:linkValueHasTargetIri" : {
| "@id" : "$targetResourceIri"
| }
| },
| "@context" : {
| "xsd" : "http://www.w3.org/2001/XMLSchema#",
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
}
}

def updateIntValueRequest(resourceIri: IRI,
Expand Down Expand Up @@ -1430,23 +1452,46 @@ object SharedTestDataADM {

def updateLinkValueRequest(resourceIri: IRI,
valueIri: IRI,
targetResourceIri: IRI): String = {
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasOtherThingValue" : {
| "@id" : "$valueIri",
| "@type" : "knora-api:LinkValue",
| "knora-api:linkValueHasTargetIri" : {
| "@id" : "$targetResourceIri"
| }
| },
| "@context" : {
| "xsd" : "http://www.w3.org/2001/XMLSchema#",
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
targetResourceIri: IRI,
comment: Option[String] = None): String = {
comment match {
case Some(definedComment) =>
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasOtherThingValue" : {
| "@id" : "$valueIri",
| "@type" : "knora-api:LinkValue",
| "knora-api:linkValueHasTargetIri" : {
| "@id" : "$targetResourceIri"
| },
| "knora-api:valueHasComment" : "$definedComment"
| },
| "@context" : {
| "xsd" : "http://www.w3.org/2001/XMLSchema#",
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin

case None =>
s"""{
| "@id" : "$resourceIri",
| "@type" : "anything:Thing",
| "anything:hasOtherThingValue" : {
| "@id" : "$valueIri",
| "@type" : "knora-api:LinkValue",
| "knora-api:linkValueHasTargetIri" : {
| "@id" : "$targetResourceIri"
| }
| },
| "@context" : {
| "xsd" : "http://www.w3.org/2001/XMLSchema#",
| "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
| "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
| }
|}""".stripMargin
}
}

def updateStillImageFileValueRequest(resourceIri: IRI,
Expand Down