2
votes

I want to get data (movie title, director name, actor name and the wikipedia link) of all movies present on dbpedia.

I tried this query on http://dbpedia.org/snorql/.

SELECT ?film_title ?star_name ?nameDirector ?link WHERE {
  {  
    SELECT DISTINCT ?movies ?film_title
    WHERE {
       ?movies rdf:type <http://dbpedia.org/ontology/Film>; 
       rdfs:label ?film_title.
    } 
  }. 
  ?movies dbpedia-owl:starring ?star;
  foaf:isPrimaryTopicOf ?link;
  dbpedia-owl:director ?director. 
  ?director foaf:name ?nameDirector.
  ?star foaf:name ?star_name.
  FILTER LANGMATCHES( LANG(?film_title), 'en')
} LIMIT 100

Responses seems correct, but the response time are slow, so I'm wondering if I can improve my query for get a faster response.

1
so did you come up with a better query? Can you share with us? - Bikal Basnet

1 Answers

0
votes

There are a couple of things you could change in your query that might make it faster.

Firstly what is the point of your SELECT DISTINCT subquery? Is that merely trying to eliminate duplicate film titles? Removing this may make things faster if you can live with a few duplicates.

Secondly the FILTER clauses requires the database to scan over all the possible matches and evaluate the expression on each possible match to determine whether to keep it or throw it away. Again if you can live with getting some duplicate data and don't mind non-English language tags removing the FILTER may make the query run faster.