query-e454f1ca5cc4db27462443a3dbcb90d8
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item (GROUP_CONCAT(?elo; separator=', ') AS ?elos) (GROUP_CONCAT(?strtime; separator=', ') AS ?months) (COUNT(*) AS ?cnt) WHERE {
?item p:P1087 ?statement .
?statement ps:P1087 ?elo; wikibase:rank wikibase:PreferredRank .
OPTIONAL { ?statement pq:P585 ?time . BIND(SUBSTR(STR(?time), 1, 7) AS ?strtime) }
} GROUP BY ?item HAVING (?cnt != 1)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?cnt")
v4("?elo"):::projected
v7("?elos")
v2("?item"):::projected
v8("?months")
v3("?statement")
v6("?strtime"):::projected
v5("?time")
c5(["wikibase:PreferredRank"]):::iri
f0[["?cnt != '1^^xsd:integer'"]]
f0 --> v9
v2 --"p:P1087"--> v3
v3 --"p:statement/P1087"--> v4
v3 --"wikibase:rank"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P585".-> v5
bind1[/"substring(str(?time),'1^^xsd:integer','7^^xsd:integer')"/]
v5 --o bind1
bind1 --as--o v6
end
bind5[/"?elo"/]
v4 --o bind5
bind5 --as--o v7
bind6[/"?strtime"/]
v6 --o bind6
bind6 --as--o v8
bind7[/"count(*)"/]
bind7 --as--o v9