I ran the query given below:

select distinct ?p ?o
where {
  ?film a dbpedia-owl:Film.
  ?film ?p ?o
LIMIT 1000

In this, one of the results was

dbpedia2:wikiPageUsesTemplate [http]    :Template:IMDb_title [http]

I think that this means that

dbpedia-owl:Film -> dbpedia2:wikiPageUsesTemplate -> Template:IMDb_title

So now I want to know the SPARQL to be written to be able to get the IMDb_title for every film:

select distinct ?o ?d ?ititle ?x ?y
where {
   ?film a dbpedia-owl:Film.
   ?film dbpedia2:title ?o.
   ?film dbpedia2:director ?d.
   ?film dbpedia2:wikiPageUsesTemplate ?ititle.
   ?ititle ?x ?y.

This gives me the result which includes:

"The Man Who Knew Too Much"@en  :Alfred_Hitchcock [http]    :Template:Infobox_film [http]   (http://www.w3.org/ns/prov#wasDerivedFrom) [http]   (http://en.wikipedia.org/wiki/Template:Infobox_film?oldid=490017704) [http]

"The Man Who Knew Too Much"@en  :Alfred_Hitchcock [http]    :Template:IMDb_title [http] (http://www.w3.org/ns/prov#wasDerivedFrom) [http]   (http://en.wikipedia.org/wiki/Template:IMDb_title?oldid=390733276) [http]

"The Man Who Knew Too Much"@en  :Alfred_Hitchcock [http]    :Template:Tcmdb_title [http]    (http://www.w3.org/ns/prov#wasDerivedFrom) [http]   (http://en.wikipedia.org/wiki/Template:Tcmdb_title?oldid=435283667) [http]

"The Man Who Knew Too Much"@en  :Alfred_Hitchcock [http]    :Template:Rotten_Tomatoes [http]    (http://www.w3.org/ns/prov#wasDerivedFrom) [http]   (http://en.wikipedia.org/wiki/Template:Rotten_Tomatoes?oldid=444805797) [http]

The second row gives me an ID to IMDb_title:

"The Man Who Knew Too Much"@en  :Alfred_Hitchcock [http]    :Template:IMDb_title [http] (http://www.w3.org/ns/prov#wasDerivedFrom) [http]   (http://en.wikipedia.org/wiki/Template:IMDb_title?oldid=390733276) [http]

But when I search this ID on IMDb - 390733276, I dont get the movie. Could anyone explain?

Regards, Bonson

asked 13 Nov '12, 20:01

Bonson's gravatar image

accept rate: 0%

edited 14 Nov '12, 10:48

Signified's gravatar image

Signified ♦

Looks like you have misinterpreted the dbpprop:wikiPageUsesTemplate property. As far as i know it is stating that the corresponding wikipedia page uses the template Template:IMDb_title. ie. http://en.wikipedia.org/wiki/Template:IMDb_name.

The id that you are getting is the http://www.w3.org/ns/prov#wasDerivedFrom object ie. the wikipedia page for the infobox - http://en.wikipedia.org/wiki/Template:IMDb_title?oldid=390733276

the oldid querystring is to do with the revision history of wikipedia

IMDB ids are rather poorly represented in DBPedia (and indeed in Wikipedia): try the properties: http://dbpedia.org/property/imdbTitle, http://dbpedia.org/property/imdbId unfortunately this will yield only a handfull of ids

IMDB related properties:

 select distinct ?p 
    where { 
    ?film a dbpedia-owl:Film. 
    ?film ?p ?o.
    FILTER regex(?p, "imdb")
permanent link

answered 14 Nov '12, 02:20

Sweet%20Burlap's gravatar image

Sweet Burlap
accept rate: 18%

edited 14 Nov '12, 06:24


Thanks for the information.

I would like to understand how you are able to get the information about the different attributes? Is there a help or something from where we can get this information?

Regards Bonson

(15 Nov '12, 03:40) Bonson Bonson's gravatar image

It can be a bit tricky at times. Usually I look at a few pages to see what kind of data is available eg. http://dbpedia.org/page/Pulp_Fiction, and use the query in my answer (usually without regex filter) to see what else might be available. The property pages (eg. http://dbpedia.org/property/imdbId) of some datasets will have a helpful comment etc. Otherwise it can be a case of simply checking what a property does manually. eg. select distinct * where { ?film a dbpedia-owl:Film. ?film http://dbpedia.org/property/imdbId ?id. }

(15 Nov '12, 04:29) Sweet Burlap Sweet%20Burlap's gravatar image

This makes it very difficult to use the correct attributes. So now in the below query, I am trying to filter on the film title "Toy" so that I find the details of "Toy Story". I am not sure what would be the right attribute to search.

select distinct ?t ?d ?s where { ?film a dbpedia-owl:Film. ?film foaf:name ?t. ?film dbpedia2:director ?d. ?film dbpedia2:starring ?s. FILTER regex(?t, "Toy", "i") }

Is foaf:name the correct attribute to use in a search when filtering on titles of movies on dbpedia?

(15 Nov '12, 20:34) Bonson Bonson's gravatar image

rdfs:label is probably better to use. although foaf:name seems widely used throughout dbpedia films too.

Possibly better again is to search for both (either) foaf:name and rdfs:label using UNION to get more comprehensive results (although I suspect you won't get many more results - you could experiment a bit to check if the more complex query is necessary).

(16 Nov '12, 05:14) Sweet Burlap Sweet%20Burlap's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 13 Nov '12, 20:01

question was seen: 908 times

last updated: 16 Nov '12, 05:14