query-4976d9e694e56b799f5a65e9b3c5c895
above for essentially the same question. Maybe there is some workaround. #Sort_ordering_within_a_group Above a way to concatenate some of it. You could add this in one line to the album (see below), but I don't think you can sort the songs when grouping it that way. See
Use at
- https://query.wikidata.org/sparql
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 (GROUP_CONCAT(DISTINCT ?songdesc; separator="; ") as ?s)
{
SELECT ?song ?songLabel
(GROUP_CONCAT(DISTINCT ?composerLabel; separator=" and ") as ?comp)
(GROUP_CONCAT(DISTINCT ?lyrics_byLabel; separator=" and ") 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")
v3("?composer")
v5("?composerLabel")
v1("?item")
v9("?lyri")
v4("?lyrics_by")
v6("?lyrics_byLabel")
v11("?s")
v2("?song")
v7("?songLabel")
v10("?songdesc"):::projected
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
bind7[/"?songdesc"/]
v10 --o bind7
bind7 --as--o v11