query-a4419adaab75aa66e8f1cf25a29aa78e
TODO
Use at
- https://query.wikidata.org/sparql
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/>
SELECT ?pointintime (COUNT(?item) AS ?count) WHERE {
?month wdt:P31 wd:Q5151 .
?month wdt:P585 ?pointintime .
?item p:P39 ?positionstatement .
?positionstatement ps:P39 wd:Q18887908 .
?positionstatement pq:P580 ?startdate .
FILTER( ?startdate < ?pointintime ) .
OPTIONAL { ?positionstatement pq:P582 ?enddate } .
FILTER( !BOUND( ?enddate )|| ?pointintime < ?enddate ) .
} GROUP BY ?pointintime ORDER BY ?pointintime
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?count")
v2("?enddate")
v5("?item"):::projected
v4("?month")
v1("?pointintime"):::projected
v6("?positionstatement")
v3("?startdate")
c2(["wd:Q5151"]):::iri
c6(["wd:Q18887908"]):::iri
f0[["(not bound(?enddate) || ?pointintime < ?enddate)"]]
f0 --> v2
f0 --> v1
f1[["?startdate < ?pointintime"]]
f1 --> v3
f1 --> v1
v4 --"p:direct/P31"--> c2
v4 --"p:direct/P585"--> v1
v5 --"p:P39"--> v6
v6 --"p:statement/P39"--> c6
v6 --"p:qualifier/P580"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:qualifier/P582".-> v2
end
bind3[/"count(?item)"/]
v5 --o bind3
bind3 --as--o v7