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
Sparql "exists" function not working with "bind if" #693
Comments
This issue has been reported to development to look into ... |
@niwizard , Copy of what I posted to Stackoverflow: I notice that you are experiencing this problem via Version 7.2.4.2.3217-pthreads as of Jun 3 2016. Here's what happens with the more recent 7.2.x and 8.0 releases via live example links:
That said, I can recreate your problem via our LOD Cloud Cache instance. Thus, I suggest:
|
The problem is the same with a unique BIND:
|
@niwizard -- share a link to a live example on DBpedia (for instance) so that I can reply with a potential workaround etc.. |
The even simplier query:
|
@niwizard, This is a datatype issue. Basically SQL Null datatype rearing its head.
That said, given -- SELECT ?uri ?pop ?existsPop ?usedExPop
WHERE {
?uri a <http://dbpedia.org/ontology/Place>.
{?uri rdfs:label "France"@en}
UNION {?uri rdfs:label "Brazil"@en}
UNION {?uri rdfs:label "Raging River"@en}
OPTIONAL {?uri dbo:populationTotal ?pop .}
BIND (xsd:boolean(exists{?uri dbo:populationTotal ?pop}) AS ?existsPop)
BIND (IF(xsd:boolean(?existsPop), "ok", "no") AS ?usedExPop)
FILTER (?pop > 0)
}
LIMIT 1000 -- we should be able to consider coercing |
OK so you casted the
|
@niwizard, Yes, as per: SELECT ?uri ?pop ?existsPop ?usedExPop xsd:boolean(?usedExPop) as ?usedExPop2
WHERE {
?uri a `<http://dbpedia.org/ontology/Place>`.
{?uri rdfs:label "France"@en}
UNION {?uri rdfs:label "Brazil"@en}
UNION {?uri rdfs:label "Raging River"@en}
OPTIONAL {?uri dbo:populationTotal ?pop .}
BIND (xsd:boolean(exists{?uri dbo:populationTotal ?pop}) AS ?existsPop)
BIND (IF(xsd:boolean(?existsPop) = "true"^^xsd:boolean, "ok", "no") AS ?usedExPop)
# FILTER (?pop > 0)
}
LIMIT 1000 Which shows the problem re. bug to be fixed as per this query results page. |
I have progress with debugging, but I don't have the fix yet. |
My Virtuoso is (
virtuoso-t -h
):The Sparql function
exists
is working fine, but not when combined with(bind if(...))
.The query:
The result:
(see https://stackoverflow.com/q/47161296/6833025)
The text was updated successfully, but these errors were encountered: