Frage

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

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top