own-pt / wql

WQL query language
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Regex pattern to a predicate text #3

Closed yfaria closed 2 years ago

yfaria commented 3 years ago

By now, the query generator only creates queries searching for predicate texts which aren't regular expressions. For example; the WQL search x:_run*[] translates to

PREFIX mrs: <http://www.delph-in.net/schema/mrs#> 
PREFIX erg: <http://www.delph-in.net/schema/erg#> 
PREFIX delph: <http://www.delph-in.net/schema/> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
SELECT ?x0 WHERE { ?x0 rdf:type mrs:MRS . ?x0 mrs:hasEP ?x1 . ?x1 delph:hasPredicate ?x2 . ?x2 delph:predText <_run*> . 

and we needed ?x2 delph:predText ?x3. FILTER regex(?x3,"_run.*").

yfaria commented 2 years ago

Solved in demo branch. Now, this WQL query, x:_run*[] is transformed to

PREFIX mrs: <http://www.delph-in.net/schema/mrs#> 
PREFIX delph: <http://www.delph-in.net/schema/> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
SELECT ?x2 ?x0 WHERE { 
  ?x0 rdf:type mrs:MRS . 
  FILTER (REGEX(?x5, "_run.*")) . 
  ?x4 delph:predText ?x5 . 
  ?x3 delph:hasPredicate ?x4 . 
  ?x3 mrs:hasLabel ?x1 . 
  ?x3 rdfs:label ?x2 . 
  ?x0 mrs:hasEP ?x3 . 
}