query-3a1690bc82e5393cf1c07df4048eda10
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
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 ?sultan ?sultanLabel ?sultan_start ?sultan_end ?vizier ?vizierLabel ?vizier_start ?vizier_end WHERE {
?sultan p:P39 ?sultan_stmt .
?sultan_stmt ps:P39 wd:Q15315411 .
OPTIONAL {?sultan_stmt pq:P580 ?sultan_start } .
OPTIONAL {?sultan_stmt pq:P582 ?sultan_end } .
?vizier p:P39 ?vizier_stmt .
?vizier_stmt ps:P39 wd:Q15063567 .
OPTIONAL {?vizier_stmt pq:P580 ?vizier_start } .
OPTIONAL {?vizier_stmt pq:P582 ?vizier_end } .
FILTER ((?vizier_start <= ?sultan_end) && (?vizier_end >= ?sultan_start))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?sultan_start ?vizier_start
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?sultan"):::projected
v3("?sultan_end"):::projected
v1("?sultan_start"):::projected
v6("?sultan_stmt")
v7("?vizier"):::projected
v4("?vizier_end"):::projected
v2("?vizier_start"):::projected
v8("?vizier_stmt")
c6(["wd:Q15063567"]):::iri
c8(["bd:serviceParam"]):::iri
c3(["wd:Q15315411"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?vizier_start <= ?sultan_end?vizier_end >= ?sultan_start"]]
f0 --> v2
f0 --> v3
f0 --> v4
f0 --> v1
v5 --"p:P39"--> v6
v6 --"p:statement/P39"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:qualifier/P580".-> v1
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:qualifier/P582".-> v3
end
v7 --"p:P39"--> v8
v8 --"p:statement/P39"--> c6
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/P580".-> v2
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/P582".-> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end