query-2d755c512c2c0f9e2ef690b827dc1c80

rq turtle/ttl

I succeeded in linking the sample value but not the list of them:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?count ?sample ?valueList
{
    {
        SELECT ?item (COUNT(?val) AS ?count) (SAMPLE(?value) AS ?sample) (GROUP_CONCAT(?value; separator=", ") AS ?valueList) {
            ?item wdt:{{PAGENAME}} ?val .
            OPTIONAL { wd:{{PAGENAME}} wdt:P1630 ?formatter } .
            BIND( IF( BOUND( ?formatter ), URI( REPLACE( ?formatter, '\\$1', ?val ) ), ?val ) AS ?value ) .
        } GROUP BY ?item
    } .
    FILTER( ?count > 1 ) .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "{{int:lang}},en" } .
} ORDER BY DESC(?count) LIMIT 1000

Query found at