diff --git a/docker-compose.yml b/docker-compose.yml index e8cd9dddde..32dc9f21d7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3.7' services: app: - image: daschswiss/dsp-app:v10.23.5 + image: daschswiss/dsp-app:v10.24.2 ports: - "4200:4200" networks: diff --git a/integration/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala b/integration/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala index 2aaf3ef4bf..740d44ca2e 100644 --- a/integration/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala +++ b/integration/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala @@ -216,6 +216,50 @@ class SearchRouteV2R2RSpec extends R2RSpec { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Queries without type inference + "perform a Gravsearch query using simple schema which allows to sort the results by external link" in { + val query = + """PREFIX knora-api: + |PREFIX anything: + | + |CONSTRUCT { + | ?res knora-api:isMainResource true . + | ?res anything:hasUri ?exLink . + |} WHERE { + | ?res a knora-api:Resource . + | ?res a anything:Thing . + | ?res anything:hasUri ?exLink . + |} + |ORDER BY (?exLink) + |""".stripMargin + + Post( + "/v2/searchextended", + HttpEntity(SparqlQueryConstants.`application/sparql-query`, query) + ) ~> searchPath ~> check(assert(status == StatusCodes.OK)) + } + + "perform a Gravsearch query using complex schema which allows to sort the results by external link" in { + val query = + """PREFIX knora-api: + |PREFIX anything: + | + |CONSTRUCT { + | ?res knora-api:isMainResource true . + | ?res anything:hasUri ?exLink . + |} WHERE { + | ?res a knora-api:Resource . + | ?res a anything:Thing . + | ?res anything:hasUri ?exLink . + |} + |ORDER BY (?exLink) + |""".stripMargin + + Post( + "/v2/searchextended", + HttpEntity(SparqlQueryConstants.`application/sparql-query`, query) + ) ~> searchPath ~> check(assert(status == StatusCodes.OK)) + } + "perform a Gravsearch query for an anything:Thing with an optional date and sort by date" in { val gravsearchQuery = diff --git a/webapi/src/main/scala/org/knora/webapi/messages/util/search/gravsearch/prequery/AbstractPrequeryGenerator.scala b/webapi/src/main/scala/org/knora/webapi/messages/util/search/gravsearch/prequery/AbstractPrequeryGenerator.scala index cf29ed3902..a450a06d9a 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/util/search/gravsearch/prequery/AbstractPrequeryGenerator.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/util/search/gravsearch/prequery/AbstractPrequeryGenerator.scala @@ -795,21 +795,23 @@ abstract class AbstractPrequeryGenerator( // that point to literals. This is used only for generating additional statements for ORDER BY clauses, so it only needs to include // types that have a meaningful order. private val valueTypesToValuePredsForOrderBy: Map[IRI, IRI] = Map( - OntologyConstants.Xsd.Integer -> OntologyConstants.KnoraBase.ValueHasInteger, - OntologyConstants.Xsd.Decimal -> OntologyConstants.KnoraBase.ValueHasDecimal, - OntologyConstants.Xsd.Boolean -> OntologyConstants.KnoraBase.ValueHasBoolean, - OntologyConstants.Xsd.String -> OntologyConstants.KnoraBase.ValueHasString, - OntologyConstants.KnoraApiV2Simple.Date -> OntologyConstants.KnoraBase.ValueHasStartJDN, - OntologyConstants.KnoraApiV2Simple.Color -> OntologyConstants.KnoraBase.ValueHasColor, - OntologyConstants.KnoraApiV2Simple.Geoname -> OntologyConstants.KnoraBase.ValueHasGeonameCode, - OntologyConstants.KnoraApiV2Complex.TextValue -> OntologyConstants.KnoraBase.ValueHasString, - OntologyConstants.KnoraApiV2Complex.IntValue -> OntologyConstants.KnoraBase.ValueHasInteger, - OntologyConstants.KnoraApiV2Complex.DecimalValue -> OntologyConstants.KnoraBase.ValueHasDecimal, - OntologyConstants.KnoraApiV2Complex.TimeValue -> OntologyConstants.KnoraBase.ValueHasTimeStamp, OntologyConstants.KnoraApiV2Complex.BooleanValue -> OntologyConstants.KnoraBase.ValueHasBoolean, - OntologyConstants.KnoraApiV2Complex.DateValue -> OntologyConstants.KnoraBase.ValueHasStartJDN, OntologyConstants.KnoraApiV2Complex.ColorValue -> OntologyConstants.KnoraBase.ValueHasColor, - OntologyConstants.KnoraApiV2Complex.GeonameValue -> OntologyConstants.KnoraBase.ValueHasGeonameCode + OntologyConstants.KnoraApiV2Complex.DateValue -> OntologyConstants.KnoraBase.ValueHasStartJDN, + OntologyConstants.KnoraApiV2Complex.DecimalValue -> OntologyConstants.KnoraBase.ValueHasDecimal, + OntologyConstants.KnoraApiV2Complex.GeonameValue -> OntologyConstants.KnoraBase.ValueHasGeonameCode, + OntologyConstants.KnoraApiV2Complex.IntValue -> OntologyConstants.KnoraBase.ValueHasInteger, + OntologyConstants.KnoraApiV2Complex.TextValue -> OntologyConstants.KnoraBase.ValueHasString, + OntologyConstants.KnoraApiV2Complex.TimeValue -> OntologyConstants.KnoraBase.ValueHasTimeStamp, + OntologyConstants.KnoraApiV2Complex.UriValue -> OntologyConstants.KnoraBase.ValueHasUri, + OntologyConstants.KnoraApiV2Simple.Color -> OntologyConstants.KnoraBase.ValueHasColor, + OntologyConstants.KnoraApiV2Simple.Date -> OntologyConstants.KnoraBase.ValueHasStartJDN, + OntologyConstants.KnoraApiV2Simple.Geoname -> OntologyConstants.KnoraBase.ValueHasGeonameCode, + OntologyConstants.Xsd.Boolean -> OntologyConstants.KnoraBase.ValueHasBoolean, + OntologyConstants.Xsd.Decimal -> OntologyConstants.KnoraBase.ValueHasDecimal, + OntologyConstants.Xsd.Integer -> OntologyConstants.KnoraBase.ValueHasInteger, + OntologyConstants.Xsd.String -> OntologyConstants.KnoraBase.ValueHasString, + OntologyConstants.Xsd.Uri -> OntologyConstants.KnoraBase.ValueHasUri ) /**