query-0b3c16bac7ce5e8077493b8eb3345b64
seems to be significantly more efficient (7.5 instead of 11 seconds): FILTER instead of HAVINGUsing
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?count ?sample
{
{
SELECT ?item (COUNT(?value) AS ?count) (SAMPLE(?value) AS ?sample) {
?item wdt:P213 ?value .
} GROUP BY ?item HAVING(?count > 1)
} .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
} ORDER BY DESC(?count) LIMIT 1000
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?count"):::projected
v2("?item"):::projected
v4("?sample"):::projected
v3("?value")
c4(["bd:serviceParam"]):::iri
c6(["en"]):::literal
f0[["?count > '1^^xsd:integer'"]]
f0 --> v4
v2 --"wdt:P213"--> v3
bind3[/"count(?value)"/]
v3 --o bind3
bind3 --as--o v4
bind4[/"sample(?value)"/]
v3 --o bind4
bind4 --as--o v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end