mardi 7 novembre 2017

Sparql exists function not working with bind if

My Virtuoso is (virtuoso-t -h):

Virtuoso Open Source Edition (Column Store) (multi threaded)
Version 7.2.4.2.3217-pthreads as of Jun  3 2016
Compiled for Linux (x86_64-pc-linux-gnu)

The Sparql function exists is working fine, but not when combined with (bind if(...)).
The query:

PREFIX dbo: <http://ift.tt/1aI7wIh;
SELECT  ?uri  ?popEstimate ?existsPopEstim ?usedExPop
WHERE {
    ?uri  a <http://ift.tt/2lXUO3U;.

    {?uri rdfs:label "France"@fr}
    UNION {?uri rdfs:label "Brésil"@fr}
    UNION {?uri rdfs:label "Amérique"@fr}

    OPTIONAL {?uri dbo:populationEstimate ?popEstimate .}   
    BIND (exists{?uri dbo:populationEstimate ?popEstimate} AS ?existsPopEstim )
    BIND (IF(?existsPopEstim , "ok", "no") AS ?usedExPop)
}
LIMIT 100

The result:

uri                                  | popEstimate | existsPopEstim | usedExPop
-------------------------------------+-------------+----------------+----------
http://ift.tt/2yCFfVf   |             | 0              | ok
http://ift.tt/2m1iKTV   | 201032714   | 1              | ok
http://ift.tt/2yD9uvh |             | 0              | ok 

Aucun commentaire:

Enregistrer un commentaire