Question

I am new to SPARQL. With this query, I can get the birthName of Ernest Hemingway:

select distinct ?birthName
where {
  ?person a dbpedia-owl:Person .
  ?person dbpprop:birthName ?birthName .
  FILTER (regex(?birthName, "Ernest Miller Hemingway"))
} 
LIMIT 1

Is there a way I can get the wikipedia abstract/introduction and thumbnail of Ernest Hemingway with DBPedia?

Was it helpful?

Solution

In general, the best way to start querying DBpedia if you already have an idea what you're looking for is to look at the page for the resource that you're interested in. In this case, you want

On that page, you'll see that the property relating a resource to its abstract is dbpedia-owl:abstract, and the thumbnail or image is dbpedia-owl:thumbnail. Thus, you want a query like the following (which you can run on the DBpedia SPARQL endpoint). I've taken the liberty of restricting the results to just the English language abstract.

prefix dbpedia: <http://dbpedia.org/resource/>
prefix dbpedia-owl: <http://dbpedia.org/ontology/>

select ?abstract ?thumbnail where { 
  dbpedia:Ernest_Hemingway dbpedia-owl:abstract ?abstract ;
                           dbpedia-owl:thumbnail ?thumbnail .
  filter(langMatches(lang(?abstract),"en"))
}

SPARQL results

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