How to get all rdf file about berlin from dbpedia

on this page: http://thedatahub.org/dataset/dbpedia I can find information about dbpedia, such as sparql endpoint, etc. Where and how should I ask to get all rdf files that mention something about berlin?

+4
source share
3 answers

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

http://dbpedia.org/resource/Berlin

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

PS. ok, here is the SELECT version to capture references to the text "berlin":

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

This can lead to too many results / time, so can you replace? p by a known property (for example, abstract, not sure what the term dbPedia is). To get the output as RDF, you must configure it to do something like this:

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

You better do what the tribute suggested upload / download data from the page, or try

 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 last query should be sufficient if the results from the description are insufficient

+1
source

You can take a look at the DBPedia sample documentation section.

0
source

Source: https://habr.com/ru/post/1400538/


All Articles