Confused ADDITIONAL - disappearing entries
I am having problems using OPTIONAL phrase in SPARQL statements. When I ask dbpedia like this:
CONSTRUCT { ?guitarist rdfs:label ?name . ?guitarist rdfs:comment ?desc . ?guitarist dbpprop:placeOfBirth ?placebirth }
WHERE {
?guitarist dbpprop:wikiPageUsesTemplate <http://dbpedia.org/resource/Template:Infobox_musical_artist> .
?guitarist rdfs:label ?name .
?guitarist rdfs:comment ?desc .
?guitarist dbpprop:placeOfBirth ?placebirth .
FILTER ( lang(?name) = "en" && lang(?desc) = "en" )
}
Roger Waters' birthplace and other details are returned. But when I go to this, all Roger_Waters entries are missing:
CONSTRUCT { ?guitarist rdfs:label ?name . ?guitarist rdfs:comment ?desc . ?guitarist dbpprop:placeOfBirth ?placebirth }
WHERE {
?guitarist dbpprop:wikiPageUsesTemplate <http://dbpedia.org/resource/Template:Infobox_musical_artist> .
?guitarist rdfs:label ?name .
?guitarist rdfs:comment ?desc .
OPTIONAL { ?guitarist dbpprop:placeOfBirth ?placebirth }
FILTER ( lang(?name) = "en" && lang(?desc) = "en" )
}
What am I doing wrong - I suppose complete entries will not be missing after applying OPTIONAL ...
The DBpedia endpoint returns partial results for queries that it deems too costly.
When doing SELECT COUNT(*) WHERE …
with these two queries, it looks like the first query should return 8k results and the second should return 60k results. Yours CONSTRUCT
should generate 2-3 triples per result, so the first query should give 16-24k of triples, and the second should give 120-180k. When I run queries, I get a curious amount of exactly 10001 triples from any request. Thus, the results are truncated.
Try LIMIT
and OFFSET
(maybe with ORDER BY
).