query-35a0384d2cdf3815bed88c59f970bfc7
TODO
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?nameLabel ?itemLabel ?itemDescription ?datebirth ?precDoB ?datedeath ?precDoD
WHERE
{
?item wdt:P119 wd:Q1457377 .
OPTIONAL {?item wdt:P734 ?name }
OPTIONAL {?item p:P569 [ps:P569 ?birthdate; psv:P569 [wikibase:timePrecision ?precDoB] ] .
BIND(IF(?precDoB=11,concat(str(year(?birthdate))," ",if(strlen(str(month(?birthdate)))=1,concat("0",str(month(?birthdate))),str(month(?birthdate)))," ",if(strlen(str(day(?birthdate)))=1,concat("0",str(day(?birthdate))),str(day(?birthdate)))),
if(?precDoB=10,concat(str(year(?birthdate))," ",if(strlen(str(month(?birthdate)))=1,concat("0",str(month(?birthdate))),str(month(?birthdate)))),
if(?precDoB=9,year(?birthdate),""))) as ?datebirth)
}
OPTIONAL {?item wdt:P19 ?birthplace }
OPTIONAL {?item wdt:P570 ?deathdate }
OPTIONAL {?item p:P570 [ps:P570 ?deathdate; psv:P570 [wikibase:timePrecision ?precDoD] ] .
BIND(IF(?precDoD=11,concat(str(year(?deathdate))," ",if(strlen(str(month(?deathdate)))=1,concat("0",str(month(?deathdate))),str(month(?deathdate)))," ",if(strlen(str(day(?deathdate)))=1,concat("0",str(day(?deathdate))),str(day(?deathdate)))),
if(?precDoD=10,concat(str(year(?deathdate))," ",if(strlen(str(month(?deathdate)))=1,concat("0",str(month(?deathdate))),str(month(?deathdate)))),
if(?precDoD=9,year(?deathdate),""))) as ?datedeath)
}
OPTIONAL {?item wdt:P20 ?deathplace }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
ORDER BY ?precDoD ?nameLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?birthdate")
v8("?birthplace")
v7("?datebirth"):::projected
v10("?datedeath"):::projected
v9("?deathdate")
v11("?deathplace")
v3("?item"):::projected
v4("?name")
v2("?nameLabel"):::projected
v6("?precDoB"):::projected
v1("?precDoD"):::projected
a1((" "))
a2((" "))
a3((" "))
a4((" "))
c2(["wd:Q1457377"]):::iri
c15(["bd:serviceParam"]):::iri
c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v3 --"p:direct/P119"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P734".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
a1 -."p:statement/P569".-> v5
a2 --"wikibase:timePrecision"--> v6
a1 --"p:statement/value/P569"--> a2
v3 --"p:P569"--> a1
bind0[/"if(?precDoB = '11^^xsd:integer',concat(str(year-from-dateTime(?birthdate)),' ',if(string-length(str(month-from-dateTime(?birthdate))) = '1^^xsd:integer',concat('0',str(month-from-dateTime(?birthdate))),str(month-from-dateTime(?birthdate))),' ',if(string-length(str(day-from-dateTime(?birthdate))) = '1^^xsd:integer',concat('0',str(day-from-dateTime(?birthdate))),str(day-from-dateTime(?birthdate)))),if(?precDoB = '10^^xsd:integer',concat(str(year-from-dateTime(?birthdate)),' ',if(string-length(str(month-from-dateTime(?birthdate))) = '1^^xsd:integer',concat('0',str(month-from-dateTime(?birthdate))),str(month-from-dateTime(?birthdate)))),if(?precDoB = '9^^xsd:integer',year-from-dateTime(?birthdate),'')))"/]
v6 --o bind0
v5 --o bind0
bind0 --as--o v7
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P19".-> v8
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P570".-> v9
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
a3 -."p:statement/P570".-> v9
a4 --"wikibase:timePrecision"--> v1
a3 --"p:statement/value/P570"--> a4
v3 --"p:P570"--> a3
bind1[/"if(?precDoD = '11^^xsd:integer',concat(str(year-from-dateTime(?deathdate)),' ',if(string-length(str(month-from-dateTime(?deathdate))) = '1^^xsd:integer',concat('0',str(month-from-dateTime(?deathdate))),str(month-from-dateTime(?deathdate))),' ',if(string-length(str(day-from-dateTime(?deathdate))) = '1^^xsd:integer',concat('0',str(day-from-dateTime(?deathdate))),str(day-from-dateTime(?deathdate)))),if(?precDoD = '10^^xsd:integer',concat(str(year-from-dateTime(?deathdate)),' ',if(string-length(str(month-from-dateTime(?deathdate))) = '1^^xsd:integer',concat('0',str(month-from-dateTime(?deathdate))),str(month-from-dateTime(?deathdate)))),if(?precDoD = '9^^xsd:integer',year-from-dateTime(?deathdate),'')))"/]
v1 --o bind1
v9 --o bind1
bind1 --as--o v10
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P20".-> v11
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"wikibase:language"--> c17
end