Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordering in WHERE clause when generating SPARQL #23

Open
yfaria opened this issue Oct 23, 2021 · 0 comments
Open

Ordering in WHERE clause when generating SPARQL #23

yfaria opened this issue Oct 23, 2021 · 0 comments

Comments

@yfaria
Copy link
Contributor

yfaria commented Oct 23, 2021

The resulting SPARQL query is not easy to interpret considering the original WQL query; one of the reasons is the renaming of hte variables and the other is the order in which the triple patterns are added to the WHERE clause. The first one is a bit out of reach because we delegate this task the the library hsparql, the second problem is a consequence of our code to generate SPARQL. Most things in queries look as they are being outputted backwards; the reason is the laziness of Haskell and is solvable by reversing the order of execution of the code.

This is mostly for making the resulting query more interpretable and for embellishment, but before 228605b, the filtering of a negation would appear before the pattern of the type of MRS node; as a result the results of the query were distorted.
For example, the query !_dog_n_1 would have been

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 { 
  FILTER NOT EXISTS { 
    ?x3 delph:predText "_dog_n_1" . 
    ?x1 delph:hasPredicate ?x3 . 
    ?x1 rdfs:label ?x2 . 
    ?x0 mrs:hasEP ?x1 . 
  } 
  ?x0 rdf:type mrs:MRS . 
} 

This would take every MRS in the profile. If we put the triple pattern ?x0 rdf:type mrs:MRS . before the FILTER NOT EXISTS clause we effectively take the MRSs where there isn't a predicate _dog_n_1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant