Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A robust search on DBpedia by title

I need to write a SPARQL query to get movies from dbpedia. I have wrote almost all the query but I have this problem:

I have all of these titles, and they have to give me the same wikipedia resource:

  • Spider-man
  • Spiderman
  • Film: Spiderman
  • Spiderman 1
  • Spiderman: the beginning

Target Wikipedia: http://en.wikipedia.org/wiki/Spider-Man_(film)

I would want a sparql query that let me find the same Wikipedia resource searching by title

Moreover, is there a way to get also the "relevancy" of each result?

like image 774
sparkle Avatar asked Dec 03 '12 15:12

sparkle


1 Answers

try this, it should return either the original page or any other page that redirects to the main page:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbo: <http://dbpedia.org/ontology/>

SELECT ?s WHERE {
  {
    ?s rdfs:label "Spider-man"@en .

  }
  UNION
  {
    ?altName rdfs:label "Spider-man"@en ;
             dbo:wikiPageRedirects ?s .
  }
}
like image 186
Hokascha Avatar answered Sep 23 '22 23:09

Hokascha