query-d104f3f5fb893df82ee2ff5b22fc84ad
title:Ambassadors of Spain with position start & end dates & position ref SELECT ?item ?itemLabel ?position ?positionLabel ?start ?end ?ref WHERE { ?item p:P39 ?stat . ?stat ps:P39 ?position . ?position wdt:P31 wd:Q6348379. OPTIONAL {?stat pq:P580 ?start .} OPTIONAL {?stat pq:P582 ?end .} OPTIONAL {?stat prov:wasDerivedFrom/pr:P4256 ?ref .} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } }
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 prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Ambassadors of Spain with position start & end dates & position ref
SELECT ?item ?itemLabel ?position ?positionLabel ?start ?end ?ref
WHERE
{
?item p:P39 ?stat .
?stat ps:P39 ?position .
?position wdt:P31 wd:Q6348379.
OPTIONAL {?stat pq:P580 ?start .}
OPTIONAL {?stat pq:P582 ?end .}
OPTIONAL {?stat prov:wasDerivedFrom/pr:P4256 ?ref .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?end"):::projected
v1("?item"):::projected
v3("?position"):::projected
v6("?ref"):::projected
v4("?start"):::projected
v2("?stat")
a1((" "))
c10(["bd:serviceParam"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,es"]):::literal
c4(["wd:Q6348379"]):::iri
v1 --"p:P39"--> v2
v2 --"p:statement/P39"--> v3
v3 --"p:direct/P31"--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P580".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P582".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."prov:wasDerivedFrom".-> a1
a1 --"p:reference/P4256"--> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end