This is the query I am running to get these details of All programming languages.Every programming language has some influenced other languages or influenced by other language. So there may be many languages in influenced or influenced by. Now the prob is when it is printing all the values of it prints every values separately in rows. You can look into the picture. I want all its influenced or influencedBy programming languages in a single row. Query is below.
SELECT ?pl ?abstract ?influenced ?influencedBy
WHERE {
?pl dbo:abstract ?abstract .
?pl dbo:influenced ?influenced .
?pl dbo:influencedBy ?influencedBy .
?pl rdf:type dbo:ProgrammingLanguage .
FILTER (LANG(?abstract) = 'en') .
}
Screen shot of my result
![](https://www.manongdao.com/static/images/pcload.jpg)
You can see that This language has two influencedBy values and it is printing them in separate rows.
Website data example
![](https://www.manongdao.com/static/images/pcload.jpg)
As @AKSW said, something like --
SELECT ?pl
?abstract
( group_concat ( ?_influenced; separator="; " ) AS ?influenced )
( group_concat ( ?_influencedBy; separator="; " ) AS ?influencedBy )
WHERE
{ ?pl dbo:abstract ?abstract .
?pl dbo:influenced ?_influenced .
?pl dbo:influencedBy ?_influencedBy .
?pl rdf:type dbo:ProgrammingLanguage .
FILTER ( LANG ( ?abstract ) = 'en' ) .
}
GROUP BY ?pl ?abstract
Edit to Add
To get the ?pl_label
(and I'm guessing, the ?_influenced_label
and ?_influencedBy_label
) you now say you want, you will need (and/or want) to tweak things a bit...
SELECT ?pl
?pl_label
( group_concat ( DISTINCT ?_influenced_label; separator="; " ) AS ?influenced )
( group_concat ( DISTINCT ?_influencedBy_label; separator="; " ) AS ?influencedBy )
?abstract
WHERE
{ ?pl rdf:type dbo:ProgrammingLanguage .
?pl dbo:abstract ?abstract .
FILTER ( LANG ( ?abstract ) = 'en' )
?pl rdfs:label ?pl_label
FILTER ( LANG ( ?pl_label ) = 'en' ) .
?pl dbo:influenced ?_influenced .
?_influenced rdfs:label ?_influenced_label
FILTER ( LANG ( ?_influenced_label ) = 'en' ) .
?pl dbo:influencedBy ?_influencedBy .
?_influencedBy rdfs:label ?_influencedBy_label
FILTER ( LANG ( ?_influencedBy_label ) = 'en' ) .
}
GROUP BY ?pl ?pl_label ?abstract