Question

I am new to RDF

I am trying to get companies and number of its subsidaries through dbpedia

I started with writing below queries in sparql at http://dbpedia.org/sparql or DBpedia SPARQL Explorer

select ?p ?v where {<http://dbpedia.org:8890/ontology/subsidiary ?p ?v}

And This:

 SELECT * WHERE {
  ?P <http://dbpedia.org/ontology/subsidiary> ?C 
}

See here

http://dbpedia.org:8890/ontology/subsidiary

Was it helpful?

Solution

you should aggregate the results with group by and use count, e.g like:

SELECT str(?lab) as ?label ?com count(?subs) as ?count WHERE {
  ?com <http://dbpedia.org/ontology/subsidiary> ?subs .
  ?com rdfs:label ?lab .
filter langMatches(lang(?lab), 'en') .
} 
group by ?com ?lab

run query

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top