Skip to content

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

@x-m-el

Description

@x-m-el

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions