query-81d9ad337ec45e5437d2111dc293bc4e

rq turtle/ttl

Query improvements removed from the label service language list): {{int:lang}} and {{PAGENAME}}I’d like to suggest an optimization to the SPARQL query to find constraint violations that the template includes. This is the current query (with a particular property substituted for

Use at

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
    } .
    FILTER(?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