hudi
hudi

Reputation: 16525

How to get all rdf file about berlin from dbpedia

in this page: http://thedatahub.org/dataset/dbpedia I can find information about dbpedia such as sparql endpoint and so on. Where and how I should ask to get all rdf file where is mention something about berlin ?

Upvotes: 4

Views: 1719

Answers (3)

Michael
Michael

Reputation: 4886

You're better off either doing what danja suggested w/ downloading the data off the page, or trying

describe <http://dbpedia.org/resource/Berlin>

or

construct { 
  <http://dbpedia.org/resource/Berlin> ?p ?o .
  ?s ?p2 <http://dbpedia.org/resource/Berlin>.
} 
where { 
  { <http://dbpedia.org/resource/Berlin> ?p ?o } 
  union 
  { ?s ?p2 <http://dbpedia.org/resource/Berlin> } 
}

The latter query should suffice if the results from the describe are insufficient

Upvotes: 1

danja
danja

Reputation: 1058

To get everything related to Berlin in RDF you'll probably have to write your own SPARQL (CONSTRUCT) query including regexs, but to get all the triples directly featuring the resource :

http://dbpedia.org/resource/Berlin

you can go to that URL (which will redirect you to http://dbpedia.org/page/Berlin which is about Berlin) and at the bottom of the page are links to the data in various formats.

PS. ok, here's a SELECT version for grabbing mentions of the text "berlin" :

SELECT DISTINCT ?s ?p ?o WHERE { 
   ?s ?p ?o .
   FILTER regex(?o, 'berlin', 'i') 
}

That may produce too many results/time out, so you might want to replace ?p with a known property (like abstract, not sure what the dbPedia term is). To get the output as RDF you'd tweak it to something this shape:

CONSTRUCT { ?s ?p ?o } WHERE { 
   ?s ?p ?o .
   FILTER regex(?o, 'berlin', 'i') 
}

Upvotes: 2

boferri
boferri

Reputation: 696

You may have a look at the examples section of the DBPedia documention.

Upvotes: 0

Related Questions