query-3b5427382501594ca91913e7ea9672e2
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (COUNT(?p1661) AS ?count) (SUM(?with_P585) AS ?with_time) WHERE 
{ 
  ?item p:P1661 ?p1661 . 
  OPTIONAL {?p1661 pq:P585 ?t }
  BIND(IF(BOUND(?t),1,0) AS ?with_P585)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} 
GROUP BY ?item ?itemLabel
HAVING (?count>1)
ORDER BY DESC(?count) DESC(?with_time) ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v8("?count")
  v4("?item"):::projected 
  v3("?itemLabel"):::projected 
  v5("?p1661"):::projected 
  v6("?t")
  v7("?with_P585"):::projected 
  v8("?with_time")
  c5(["bd:serviceParam"]):::iri 
  c7(["en"]):::literal 
  f0[["?count > '1^^xsd:integer'"]]
  f0 --> v8
  v4 --"p:P1661"-->  v5
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v5 -."p:qualifier/P585".->  v6
  end
  bind1[/"if(bound(?t),'1^^xsd:integer','0^^xsd:integer')"/]
  v6 --o bind1
  bind1 --as--o v7
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c5 --"wikibase:language"-->  c7
  end
  bind4[/"count(?p1661)"/]
  v5 --o bind4
  bind4 --as--o v8
  bind5[/"sum(?with_P585)"/]
  v7 --o bind5
  bind5 --as--o v8