query-a4c53f2f5a4dcff0ee1e7302a9f05a36

rq turtle/ttl

12:52, 11 June 2017 (UTC)) talk (ValterVB so we have only one row for song (ex. "Flavio Premoli, Franco Mussida")? We need one row because Wikidatalist show only one row if exist multiple row for the same item. --(P676)lyricist and (P86)composer It's possible concatenate all the value in (P658)tracklist that there is in (P1545)series ordinal It's possible sort by qualifier

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 ?song ?songLabel
  (GROUP_CONCAT(DISTINCT ?composerLabel; separator=", ") as ?comp)
  (GROUP_CONCAT(DISTINCT ?lyrics_byLabel; separator=", ") as ?lyri)
  (CONCAT('"', str(?songLabel), '" by ', str(?comp), " (comp.), ", str(?lyri), " (lyrics)") as ?songdesc)
WHERE
{
    BIND(wd:Q530546 AS ?item) # this is the item of the album
    ?item wdt:P658 ?song.
    ?song wdt:P86 ?composer. # need concatenate all the composer
    ?song wdt:P676 ?lyrics_by # need concatenate all the lyrics by
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en,it" .  ?composer rdfs:label ?composerLabel . ?lyrics_by rdfs:label ?lyrics_byLabel . ?song rdfs:label ?songLabel }
}
GROUP BY ?song ?songLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?comp"):::projected v3("?composer") v5("?composerLabel"):::projected v1("?item") v9("?lyri"):::projected v4("?lyrics_by") v6("?lyrics_byLabel"):::projected v2("?song"):::projected v7("?songLabel"):::projected v10("?songdesc") c5(["bd:serviceParam"]):::iri c7(["en,it"]):::literal bind0[/"'wd:Q530546'"/] bind0 --as--o v1 v1 --"wdt:P658"--> v2 v2 --"wdt:P86"--> v3 v2 --"wdt:P676"--> v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 v3 --"rdfs:label"--> v5 v4 --"rdfs:label"--> v6 v2 --"rdfs:label"--> v7 end bind3[/"?composerLabel"/] v5 --o bind3 bind3 --as--o v8 bind4[/"?lyrics_byLabel"/] v6 --o bind4 bind4 --as--o v9 bind5[/"concat('"',str(?songLabel),'" by ',str(?comp),' (comp.), ',str(?lyri),' (lyrics)')"/] v7 --o bind5 v8 --o bind5 v9 --o bind5 bind5 --as--o v10