query-f56bf63dc33635d937dff4565be10d28

rq turtle/ttl

TODO

Use at

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 ?vizier ?vizierLabel ?start ?end WHERE {
  {
    ?sultan p:P39 ?sultan_stmt .
    ?sultan_stmt ps:P39 wd:Q15315411 .
    OPTIONAL {?sultan_stmt pq:P580 ?start } .      
    OPTIONAL {?sultan_stmt pq:P582 ?end } .
  } UNION {
    ?vizier p:P39 ?vizier_stmt .
    ?vizier_stmt ps:P39 wd:Q15063567 .
    OPTIONAL {?vizier_stmt pq:P580 ?start } .      
    OPTIONAL {?vizier_stmt pq:P582 ?end } .
  } 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?start

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?end"):::projected v1("?start"):::projected v2("?sultan"):::projected v3("?sultan_stmt") v5("?vizier"):::projected v6("?vizier_stmt") c6(["wd:Q15063567"]):::iri c8(["bd:serviceParam"]):::iri c3(["wd:Q15315411"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v5 --"p:P39"--> v6 v6 --"p:statement/P39"--> c6 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".-> v4 end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"p:P39"--> v3 v3 --"p:statement/P39"--> c3 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P580".-> v1 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P582".-> v4 end end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end