0

I'm trying to query DBPedia for some animal pictures.

The species I'm querying for is Pan_troglodytes. When one visits https://en.wikipedia.org/wiki/Pan_troglodytes in a browser, one gets redirected to https://en.wikipedia.org/wiki/Chimpanzee.

I'd like to query for Pan_troglodytes and get the thumbnail that appears in the Chimpanzee page. But my query returns nothing:

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

SELECT * WHERE { 
  dbpedia:Pan_troglodytes 
  dbpedia-owl:abstract ?abstract;
  dbpedia-owl:thumbnail ?thumbnail .
}

Does anyone know how I can get the thumbnail for the page to which one is redirected? Any pointers others can provide would be helpful!

duhaime
  • 25,611
  • 17
  • 169
  • 224
  • 2
    the property to use is `dbo:wikiPageRedirects` and a property path (either `*` for "zero or more steps" or `?` for "zero or one" step via the given property, the former is complete as it follow the transitive closure, but might be slow for other cases): `prefix dbr: prefix dbo: SELECT * WHERE { dbr:Pan_troglodytes dbo:wikiPageRedirects* ?o . ?o dbo:abstract ?abstract; dbo:thumbnail ?thumbnail . filter(lang(?abstract) = "en") }` – UninformedUser Nov 06 '21 at 20:31
  • Spectacular! UninformedUser has done it again! If you mark your comment as an answer I'll gladly accept it :) – duhaime Nov 07 '21 at 13:35

0 Answers0