From 6ec0215df616e09656e8852a5b0f293d9ab67f3e Mon Sep 17 00:00:00 2001 From: Willem Melder Date: Wed, 19 Oct 2022 11:56:35 +0200 Subject: [PATCH] gtaa query enabling the use of a full text index (#767) Co-authored-by: Bob Coret --- .../catalog/queries/search/gtaa.rq | 35 +++---------------- 1 file changed, 5 insertions(+), 30 deletions(-) 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 .