On 06/27/11 07:21, Ivan Mikhailov wrote:
Hello Lorenz,
Both queries are correct and results looks correct, but these are two
different queries. For variant with !BOUND you need an OPTIONAL, without
OPTIONAL all variables from triple patterns are bound in every result by
definition.
SELECT DISTINCT ?x0 WHERE{
?x0<http://dbpedia.org/ontology/position> ?x7.
?x0<http://purl.org/dc/terms/subject>
<http://dbpedia.org/resource/Category:Premier_League_clubs>.
?x0<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://dbpedia.org/class/yago/PremierLeagueClubs>.
OPTIONAL {?x0<http://dbpedia.org/property/league> ?x8.}
filter (!bound (?x8))
} LIMIT 10
returns one http://dbpedia.org/resource/Wimbledon_F.C. as well.
Best Regards,
Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com
On Sun, 2011-06-26 at 23:17 +0200, Lorenz Buehmann wrote:
Hi,
i'm not sure whether it is a bug, but i hope you can explain me the
behaviour. To me it sounds like the following 2 queries should return
the same result:
Query 1:
SELECT DISTINCT ?x0 WHERE{
?x0<http://dbpedia.org/ontology/position> ?x7.
?x0<http://purl.org/dc/terms/subject>
<http://dbpedia.org/resource/Category:Premier_League_clubs>.
?x0<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://dbpedia.org/class/yago/PremierLeagueClubs>.
FILTER(
(!bif:exists((
SELECT * WHERE {?x0<http://dbpedia.org/property/league> ?x8.}
)))
)
} LIMIT 10
Query 2:
SELECT DISTINCT ?x0 WHERE{
?x0<http://dbpedia.org/ontology/position> ?x7.
?x0<http://purl.org/dc/terms/subject>
<http://dbpedia.org/resource/Category:Premier_League_clubs>.
?x0<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://dbpedia.org/class/yago/PremierLeagueClubs>.
?x0<http://dbpedia.org/property/league> ?x8.
FILTER(!BOUND(?x8))
} LIMIT 10
When i execute this queries on http://dbpedia.org/sparql i get 1 result
for query 1, but no result for query 2. Is this correct?
There is also a difference in the results when i compare query 1 with
another query 3 on http://live.dbpedia.org/sparql , because executing
query 1 returns no result, but if i change the order of the triple pattern,
then i get some result.
Query 3:
SELECT DISTINCT ?x0 WHERE{
?x0<http://purl.org/dc/terms/subject>
<http://dbpedia.org/resource/Category:Premier_League_clubs>.
?x0<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://dbpedia.org/class/yago/PremierLeagueClubs>.
?x0<http://dbpedia.org/ontology/position> ?x7.
FILTER(
(!bif:exists((
SELECT * WHERE {?x0<http://dbpedia.org/property/league> ?x8.}
)))
)
} LIMIT 10
By the way, on http://live.dbpedia.org/sparql query 2 and 3 return also
not the same result.
Maybe one of the developers can explain this all to me. Thanks in advance.
Regards,
Lorenz
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Virtuoso-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtuoso-devel
Hi,
yes your right. I don't know why i've forgotten the OPTIONAL as i even
mentioned it in the Subject of my post.
By the way, are the advantages using the built-in function over
FILTER...!BOUND()?
Thanks for your effort.
Regards,
Lorenz