diff --git a/packages/network-of-terms-catalog/catalog/queries/search/gtaa.rq b/packages/network-of-terms-catalog/catalog/queries/search/gtaa.rq index 58bac4d3d..9ade66408 100644 --- a/packages/network-of-terms-catalog/catalog/queries/search/gtaa.rq +++ b/packages/network-of-terms-catalog/catalog/queries/search/gtaa.rq @@ -1,5 +1,6 @@ PREFIX skos: PREFIX justskos: +PREFIX text: CONSTRUCT { ?uri a skos:Concept ; @@ -15,36 +16,10 @@ CONSTRUCT { ?related_uri skos:prefLabel ?related_prefLabel . } WHERE { - { - ?uri skos:inScheme ?datasetUri . - ?uri ?predicate ?label ; - justskos:status ?status . - VALUES ?predicate { skos:prefLabel skos:altLabel skos:hiddenLabel } - FILTER(LANG(?label) = "nl") - FILTER(?status IN ('approved', 'candidate')) - - # single word query, match case insensitive - FILTER regex(?query, "^[^ ]+$") - FILTER CONTAINS(LCASE(?label), LCASE(?query)) - } - UNION - { - ?uri skos:inScheme ?datasetUri . - ?uri ?predicate ?label ; - justskos:status ?status . - VALUES ?predicate { skos:prefLabel skos:altLabel skos:hiddenLabel } - FILTER(LANG(?label) = "nl") - FILTER(?status IN ('approved', 'candidate')) - - # double word query, whitespace separator - FILTER REGEX(?query, "^([^ ]+)[ ]+([^ ]+)$") - - BIND(REPLACE(?query, "^([^ ]+)[ ]+([^ ]+)$", "$1") AS ?term1) - BIND(REPLACE(?query, "^([^ ]+)[ ]+([^ ]+)$", "$2") AS ?term2) - - # search case insensitive using an AND construct for the query terms - FILTER( CONTAINS(LCASE(?label), LCASE(?term1)) && CONTAINS(LCASE(?label), LCASE(?term2)) ) - } + ?uri text:query ?query . + ?uri skos:inScheme ?datasetUri ; + justskos:status ?status . + FILTER(?status IN ('approved', 'candidate')) OPTIONAL { ?uri skos:prefLabel ?prefLabel .