query-69be6bb946aed9b904aed4aeb243cc31
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?itemLabel ?dateofbirth ?dateofdeath ?positionLabel ?starttime ?endtime
WHERE
{
?item wdt:P31 wd:Q5; # human
wdt:P27 wd:Q29; # citizenship - Spain
wdt:P19 wd:Q2807 # born in Madrid
VALUES ?occupation { wd:Q82955 wd:Q372436 wd:Q116 wd:Q2304859 } # politician, statesperson, monarch, sovereign
?item wdt:P106 ?occupation.
OPTIONAL { ?item wdt:P570 ?dateofdeath . } # date of death
OPTIONAL { ?item wdt:P569 ?dateofbirth . } # date pf birth
OPTIONAL { ?item p:P39 ?p .
?p ps:P39 ?position.
OPTIONAL { ?p pq:P580 ?starttime. }
OPTIONAL { ?p pq:P582 ?endtime. }
} # position held
SERVICE wikibase:label { bd:serviceParam wikibase:language "es". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?dateofbirth"):::projected
v3("?dateofdeath"):::projected
v8("?endtime"):::projected
v1("?item")
v2("?occupation")
v5("?p")
v6("?position")
v7("?starttime"):::projected
c6(["wd:Q2807"]):::iri
c17(["es"]):::literal
c4(["wd:Q29"]):::iri
c15(["bd:serviceParam"]):::iri
c2(["wd:Q5"]):::iri
v1 --"p:direct/P31"--> c2
v1 --"p:direct/P27"--> c4
v1 --"p:direct/P19"--> c6
bind0[/VALUES ?occupation/]
bind0-->v2
bind00(["wd:Q82955"])
bind00 --> bind0
bind01(["wd:Q372436"])
bind01 --> bind0
bind02(["wd:Q116"])
bind02 --> bind0
bind03(["wd:Q2304859"])
bind03 --> bind0
v1 --"p:direct/P106"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P570".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P569".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P39".-> v5
v5 --"p:statement/P39"--> v6
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P580".-> v7
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P582".-> v8
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"wikibase:language"--> c17
end