query-68f5c30e545be06e35d9b5514c9e8bb5
In short, the query was trying to use the wdt:P569 to select the truthy DoB value, but for reasons unknown (maybe a cut & paste error) also decided to go down the p:/ps: path to get exactly the same data. and we tell that part of the query that we're only interested in a statement which is BestRank, and we get what we wanted, a single row.?dob_stm a wikibase:BestRank and we constrain ?dob to the 23 April and for the reason above, find two rows. Add in the ?item wdt:P569 ?dob. Uncomment the ?item p:P569 ?dob_stm . ?dob_stm ps:P569 ?dob , then ?dob is unbound when we go into ?dob_stm a wikibase:BestRank, and the ?item wdt:P569 ?dobIf we comment out the after which the query looked for the P569 statament, and the ps: value for that statement - also bound as ?dob. That finds two rows, because 11 April 1891 Julian - one of the DoB statements, equals the truthy 23 April 1891 Gregorian DoB value. So for the optional clause, two dates are in scope.?item wdt:P569 ?dobAnd the cause is ... there are three DoB statements. The code as you supplied it required that a truthy DoB be found and bound as ?dob - (EC)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?dob ?dob_stm
WHERE
{
VALUES ?item {wd:Q49481}
# ?item wdt:P569 ?dob .
?item p:P569 ?dob_stm .
?dob_stm ps:P569 ?dob .
# ?dob_stm a wikibase:BestRank
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}