6

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?

sparkle
  • 7,530
  • 22
  • 69
  • 131

2 Answers2

4

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 .
  }
}
Hokascha
  • 1,709
  • 1
  • 23
  • 41
0

Is it possible for you to show the query?

for the text search, if you use the official dbpedia endpoint you can probably use the text search facilities of virtuoso.

see here: http://dbpedia.aksw.org/dbpedia_demo/dbpedia/tutorials/ranked_keyword_search/demo.php

florent
  • 801
  • 4
  • 17