As I am using this query text to find out those skos:broader related concepts of the keyword: England.

select ?ChildNodes where 
{
<http://dbpedia.org/resource/Category:England> skos:broader ?ChildNodes
}

and I've got the result like this:

ChildNodes
http://dbpedia.org/resource/Category:Germanic_countries_and_territories
http://dbpedia.org/resource/Category:Great_Britain
http://dbpedia.org/resource/Category:Island_countries
http://dbpedia.org/resource/Category:Wikipedia_categories_named_after_countries
http://dbpedia.org/resource/Category:United_Kingdom_by_country

In order to build the concept hierarchy (tree), it is necessary for me to find out all the skos:broader relations of the result. Can any one let me know how to combine those SPARQL queries in one query? Thank you so much!!!

1

There are 1 best solutions below

0
Stratos K On

If I understand correctly, you need to find the broader concepts for each of the five results in the resultset. If this is the case, your query should be like this:

SELECT ?ChildNodes ?ChildBroader WHERE {
   <http://dbpedia.org/resource/Category:England> skos:broader ?ChildNodes .
   ?ChildNodes skos:broader ?ChildBroader .
}

Furthermore, by using SPARQL property paths you can traverse the graph at an arbitrary level.