diff --git a/tests/src/test/resources/kg/views/sparql-search-response-tagged.json b/tests/src/test/resources/kg/views/sparql-search-response-tagged.json new file mode 100644 index 0000000000..e3d5b81677 --- /dev/null +++ b/tests/src/test/resources/kg/views/sparql-search-response-tagged.json @@ -0,0 +1,41 @@ +{ + "head": { + "vars": [ + "s" + ] + }, + "results": { + "bindings": [ + { + "s": { + "type": "uri", + "value": "https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/010b8ecb-21ac-4987-8faa-91f1274e656d" + } + }, + { + "s": { + "type": "uri", + "value": "https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/03e9025f-35ab-42ca-ac4a-5da2701b93f3" + } + }, + { + "s": { + "type": "uri", + "value": "https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/048bf2a9-c3e4-4401-bb1e-61f5fcacb85b" + } + }, + { + "s": { + "type": "uri", + "value": "https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/04e5f081-26fb-49ea-9d38-da7ef49d9e9f" + } + }, + { + "s": { + "type": "uri", + "value": "https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/08825325-0a84-4924-839b-baabcd9bdbb8" + } + } + ] + } +} \ No newline at end of file diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SparqlViewsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SparqlViewsSpec.scala index 7136cc572b..248bc05a88 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SparqlViewsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SparqlViewsSpec.scala @@ -259,6 +259,24 @@ class SparqlViewsSpec extends BaseSpec with EitherValuable with CirceEq { } } + val byTagQuery = + """ + |prefix nxv: + | + |select ?s where { + | ?s nxv:tags "one" + |} + |order by ?s + """.stripMargin + + "search by tag in SPARQL endpoint in project 1 with default view" in eventually { + deltaClient.sparqlQuery[Json](s"/views/$fullId/nxv:defaultSparqlIndex/sparql", byTagQuery, ScoobyDoo) { + (json, response) => + response.status shouldEqual StatusCodes.OK + json shouldEqual jsonContentOf("/kg/views/sparql-search-response-tagged.json") + } + } + "search instances in SPARQL endpoint in project 1 with custom SparqlView after tags added" in { eventually { deltaClient.sparqlQuery[Json](s"/views/$fullId/test-resource:cell-view/sparql", query, ScoobyDoo) {