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

:or: filter does not work in combination with :uri: filter #36

Open
x-m-el opened this issue Mar 5, 2024 · 0 comments
Open

:or: filter does not work in combination with :uri: filter #36

x-m-el opened this issue Mar 5, 2024 · 0 comments

Comments

@x-m-el
Copy link
Contributor

x-m-el commented Mar 5, 2024

When using the :or: filter and one of them is a :uri: filter, the created query internally will not be correct.

e.g. for filter[:or:][:uri:]=test&filter[:or:][:exact:alias]=test the query is:

SELECT DISTINCT ?uuid WHERE {
    GRAPH <http://mu.semte.ch/application> {
    ?s mu:uuid ?uuid; a ?class. VALUES ?class {void:Dataset}. 
{
 VALUES ?s { <test> } 
}  UNION 
{
  ?s ext:alias """test""".
} } } GROUP BY ?uuid OFFSET 0 LIMIT 20

This problem arises from using the VALUES block:
https://www.w3.org/TR/sparql11-query/#inline-data

VALUES provides inline data as a solution sequence which are combined with the results of query evaluation by a join operation.

A potential solution that works as expected would be

PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX void: <http://rdfs.org/ns/void#>

SELECT DISTINCT ?uuid WHERE {
  GRAPH <http://mu.semte.ch/application> {
    ?s mu:uuid ?uuid; a ?class. VALUES ?class {void:Dataset}. 
    {
      { SELECT ?s WHERE { VALUES ?s { <test> }  } }
    } UNION {
      ?s ext:alias """test""".
    }
  }
} GROUP BY ?uuid OFFSET 0 LIMIT 20

or using a FILTER instead of VALUES (but this would be slower).

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