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

Evaluation error using OPTIONAL with FILTER #148

Open
aldonline opened this issue Feb 24, 2017 · 0 comments
Open

Evaluation error using OPTIONAL with FILTER #148

aldonline opened this issue Feb 24, 2017 · 0 comments

Comments

@aldonline
Copy link

aldonline commented Feb 24, 2017

Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?label ?comment from <http://dbpedia.org/ontology/> where {
    <http://dbpedia.org/ontology/Agglomeration> ?p ?o .
    optional {
        <http://dbpedia.org/ontology/Agglomeration> rdfs:label ?label .
        filter  ( (lang(?label) = "") || langmatches(lang(?label), "EN") ) 
    } .
    optional {
        <http://dbpedia.org/ontology/Agglomeration> rdfs:comment ?comment .
        filter ( (lang(?comment) = "") || langmatches(lang(?comment), "EN") )          
    } .
} limit 1

Dataset

The data I'm querying against comes from a full dump of the named graph http://dbpedia.org/ontology/ on the main dbpedia server (https://dbpedia.org/sparql).

Stack

TypeError: Cannot read property 'token' of undefined
at Object.QueryFilters.runBuiltInCall (  rdfstore/src/query_filters.js:1342:22)
at Object.QueryFilters.runFilter (  rdfstore/src/query_filters.js:395:33)
at Object.QueryFilters.runFilter (  rdfstore/src/query_filters.js:385:36)
at Object.QueryFilters.runOrFunction (  rdfstore/src/query_filters.js:895:32)
at Object.QueryFilters.runFilter (  rdfstore/src/query_filters.js:389:33)
at Object.QueryFilters.runAndFunction (  rdfstore/src/query_filters.js:931:32)
at Object.QueryFilters.runFilter (  rdfstore/src/query_filters.js:391:33)
at   rdfstore/src/query_filters.js:186:36    at   rdfstore/src/query_engine.js:556:9
at   rdfstore/src/utils.js:385:21

Explanation

The engine tries to evaluate the FILTER(...) clause even if the ?label or ?comment variables are not bound. My expectation would be for the complete OPTIONAL clause to fail if there are no bindings for the BGP. You can try the same query in Virtuoso (https://dbpedia.org/sparql) and it will work.

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