Hi

I have just discovered that a query with count have a behaviour that
is different from the same query without count. Now, I might be
missing something, but here is what happens.
My understanding is that COUNT only counts the statements that would
otherwise be returned using the same SPARQL query without COUNT.

Query:

PREFIX onto: <http://dbpedia.org/ontology/> PREFIX rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:
<http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?uri WHERE {
?cave rdf:type onto:Cave . ?cave onto:location ?uri . OPTIONAL {?uri
rdfs:label ?string. FILTER (lang(?string) = 'en') } } HAVING
(count(?cave) > 2)

returns 18 results

now the same query but with count

PREFIX onto: <http://dbpedia.org/ontology/> PREFIX rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:
<http://www.w3.org/2000/01/rdf-schema#> SELECT count(DISTINCT ?uri)
WHERE { ?cave rdf:type onto:Cave . ?cave onto:location ?uri . OPTIONAL
{?uri rdfs:label ?string. FILTER (lang(?string) = 'en') } } HAVING
(count(?cave) > 2)

returns 156

it seems that it ignores the part with HAVING(count(?cave)>2) as

PREFIX onto: <http://dbpedia.org/ontology/> PREFIX rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:
<http://www.w3.org/2000/01/rdf-schema#> SELECT count(DISTINCT ?uri)
WHERE { ?cave rdf:type onto:Cave . ?cave onto:location ?uri . OPTIONAL
{?uri rdfs:label ?string. FILTER (lang(?string) = 'en') } }

returns 156 as well


-- 
Best,
Danica Damljanovic
--
Research Associate
GATE team http://gate.ac.uk
Natural Language Processing Group
University of Sheffield
http://www.dcs.shef.ac.uk/~danica

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to