query-bbda68b0d95766cf0d7cd6a9869a6f8e

rq turtle/ttl

Dédoublonnage USA v4

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
    ?value (SAMPLE(?valueLabel) AS ?valueLabel) (SAMPLE(?ct) AS ?ct)
    (GROUP_CONCAT(DISTINCT(STRAFTER(STR(?item), "/entity/")); separator=", ") AS ?items)
    (GROUP_CONCAT(DISTINCT(?itemLabel); separator=", ") AS ?itemLabels)
WHERE    
{
    {   SELECT ?value (COUNT(DISTINCT ?item) as ?ct)
        WHERE
        { 
            ?item wdt:P240 ?value 
        }
        GROUP BY ?value HAVING (?ct>1) 
        ORDER BY DESC(?ct)
    }
    ?item wdt:P240 ?value . 
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "fr, en" . 
        ?item rdfs:label ?itemLabel .
        ?value rdfs:label ?valueLabel .
    }
}
GROUP BY ?value
ORDER BY DESC(?ct)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?ct"):::projected v2("?item"):::projected v4("?itemLabel"):::projected v7("?itemLabels") v6("?items") v3("?value"):::projected v6("?valueLabel"):::projected c6(["fr, en"]):::literal c4(["bd:serviceParam"]):::iri f0[["?ct > '1^^xsd:integer'"]] f0 --> v6 v2 --"wdt:P240"--> v3 bind2[/"count(?item)"/] v2 --o bind2 bind2 --as--o v6 v2 --"wdt:P240"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c4 --"wikibase:language"--> c6 v2 --"rdfs:label"--> v4 v3 --"rdfs:label"--> v6 end bind7[/"sample(?valueLabel)"/] v6 --o bind7 bind7 --as--o v6 bind8[/"sample(?ct)"/] v6 --o bind8 bind8 --as--o v6 bind9[/"substring-after(str(?item),'/entity/')"/] v2 --o bind9 bind9 --as--o v6 bind10[/"?itemLabel"/] v4 --o bind10 bind10 --as--o v7