I just learned about group_concat
and order by
, group by
, and now I'm trying to apply them to query murder cases. I.E., to this one below to get all participants and targets.
SELECT DISTINCT ?incident ?label ?participant ?participantLabel ?target ?targetLabel
WHERE {
?incident wdt:P31 wd:Q132821.
?incident rdfs:label ?label.
optional{?incident wdt:P710 ?participant.}
optional{?incident wdt:P533 ?target. } }
And I tried to apply group_concat
and group by
, order by
. (Didn't do anything on target
below because even this only for participants doesn't work):
SELECT DISTINCT ?incident ?label ?target ?targetLabel (group_concat(?participantLabel; separator=";") as ?participant)
WHERE {
?incident wdt:P31 wd:Q132821.
?incident rdfs:label ?label.
optional{?incident wdt:P710 ?participant.}
optional{?incident wdt:P533 ?target. }}
GROUP BY ?participant ?participantLabel
ORDER BY ?participantLabel
And I am told Query is malformed: Bad aggregate.
Is it because not every case has participants? How can I tackle this?