query-1e8baa84dea865698815c04943ec6134
Randomly (?) working queryThis query works fine to research data on people such as Cristiano Ronaldo, Angela Merkel or Alice Cooper, but it doesn't for other people (e.g. finds nothing for Eileen Bennett, finds Serena William when searching for Bob Ross). Can anybody fix it and help me understand the problem?
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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?genderLabel ?giorno_nascita ?mese_nascita ?anno_nascita ?image
WHERE {
?item ?label "Cristiano Ronaldo";
wdt:P31 wd:Q5;
wdt:P21 ?gender;
wdt:P569 ?dob.
BIND(day(?dob) as ?giorno_nascita).
BIND(month(?dob) as ?mese_nascita).
BIND(year(?dob) as ?anno_nascita).
OPTIONAL {?item wdt:P18 ?image.}
MINUS {
?item p:P570 ?statement_1.
?statement_1 psv:P570 ?statementValue_1.
?statementValue_1 wikibase:timeValue ?P570_1.
}
SERVICE wikibase:label {bd:serviceParam wikibase:language "it"}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v11("?P570_1")
v7("?anno_nascita"):::projected
v4("?dob")
v3("?gender")
v5("?giorno_nascita"):::projected
v8("?image"):::projected
v1("?item"):::projected
v2("?label")
v6("?mese_nascita"):::projected
v10("?statementValue_1")
v9("?statement_1")
c1(["Cristiano Ronaldo"]):::literal
c13(["it"]):::literal
c11(["bd:serviceParam"]):::iri
c3(["wd:Q5"]):::iri
v1 -->v2--> c1
v1 --"p:direct/P31"--> c3
v1 --"p:direct/P21"--> v3
v1 --"p:direct/P569"--> v4
bind0[/"day-from-dateTime(?dob)"/]
v4 --o bind0
bind0 --as--o v5
bind1[/"month-from-dateTime(?dob)"/]
v4 --o bind1
bind1 --as--o v6
bind2[/"year-from-dateTime(?dob)"/]
v4 --o bind2
bind2 --as--o v7
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P18".-> v8
end
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v1 --"p:P570"--> v9
v9 --"p:statement/value/P570"--> v10
v10 --"wikibase:timeValue"--> v11
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end