query-5875d60de0c4672274d12beef011321a
Bouzinac(Q170850)Anglo-Zanzibar War
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?start ?end ?days1 ?days2 ?days
{
?item wdt:P31 / wdt:P279 * wd:Q198 .
OPTIONAL
{
?item p:P2047 / psn:P2047 / wikibase:quantityAmount ?duration_seconds .
BIND (?duration_seconds / 86400 AS ?days1)
}
OPTIONAL
{
?item p:P580 / psv:P580 [wikibase:timeValue ?start; wikibase:timePrecision 11 ] .
?item p:P582 / psv:P582 [wikibase:timeValue ?end; wikibase:timePrecision 11 ] .
BIND (xsd:integer(?end - ?start) AS ?days2)
}
BIND (COALESCE(?days1, ?days2) AS ?days)
FILTER BOUND(?days)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
ORDER BY ?days ?start
LIMIT 15
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?days"):::projected
v5("?days1"):::projected
v7("?days2"):::projected
v4("?duration_seconds")
v6("?end"):::projected
v3("?item"):::projected
v2("?start"):::projected
a1((" "))
a2((" "))
a3((" "))
a5((" "))
a4((" "))
a7((" "))
a6((" "))
c9(["11^^xsd:integer"]):::literal
c15(["bd:serviceParam"]):::iri
c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q198"]):::iri
f0[["bound(?days)"]]
f0 --> v8
v3 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:P2047".-> a2
a2 --"p:statement/value-normalized/P2047"--> a3
a3 --"wikibase:quantityAmount"--> v4
bind1[/"?duration_seconds / '86400^^xsd:integer'"/]
v4 --o bind1
bind1 --as--o v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
a4 -."wikibase:timeValue".-> v2
a4 --"wikibase:timePrecision"--> c9
v3 --"p:P580"--> a5
a5 --"p:statement/value/P580"--> a4
a6 --"wikibase:timeValue"--> v6
a6 --"wikibase:timePrecision"--> c9
v3 --"p:P582"--> a7
a7 --"p:statement/value/P582"--> a6
bind2[/"http://www.w3.org/2001/XMLSchema#integer(?end - ?start)"/]
v6 --o bind2
v2 --o bind2
bind2 --as--o v7
end
bind3[/"?days1?days2"/]
v5 --o bind3
v7 --o bind3
bind3 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"wikibase:language"--> c17
end