query-af7cea7fef071cd183ae5cbe0ed0342a

rq turtle/ttl

06:15, 28 May 2017 (UTC)) talk (SharkD is always empty. This seems to happen with many of the "labels" for other parameters and such. What do I need to change to fix it? propsetFor some reason $game group by } # SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,ja,ru". ?game rdfs:label ?gameLabel } ?gameLabel label:rdfs ?game .Q744038:wd P136:wdt ;Q7889:wd P31:wdt ?game { WHERE )?propset AS )"," = separator ; )?gameLabel(str distinct(group_concat( ?game SELECT :, I am actually trying to concatenate the game genre and some other parameters. I tried to apply your earlier trick, but am getting an error.Jura1@ 08:01, 28 May 2017 (UTC) Jura--- I had omitted "str()" in the initial version. As label includes the language code, this lead to repetitions. 06:32, 28 May 2017 (UTC)) talk (SharkD The results are not "distinct". I get a lot of repeated strings. It seems to be listing everything. Actually I'm not sure what is happening.Jura1 06:22, 28 May 2017 (UTC) Jura--- I think ?gameLabel may need to be set explicitly, either in the service or without. The above works.

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
  ?game
  (group_concat(distinct ?genreLabel ; separator = ",") AS ?genreLabels)
  WHERE {
    ?game wdt:P31 wd:Q7889;
    wdt:P136 wd:Q744038.
    OPTIONAL {
      ?game wdt:P136 ?genre;
      ?genre rdfs:label ?genreLabel
    }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} group by $game

Query found at