DBPEDIA + SPARQL Selecting movies based on their genre

Can I get a list of films depending on their genre?

I tried this:

SELECT DISTINCT ?film_title ?film_abstract ?film_genre WHERE { ?film_title rdf:type <http://dbpedia.org/ontology/Film> . ?film_title rdfs:comment ?film_abstract . ?film_genre <http://dbpedia.org/ontology/genre> ?film_genre . FILTER(lang(?film_abstract) = "en" ). } LIMIT 20 

But I’m probably doing something wrong!

Thanks,
Danilo

+4
source share
1 answer

Looks like a simple typo on your part. The third triple pattern should be as follows:

  ?film_title <http://dbpedia.org/ontology/genre> ?film_genre 

Also, the FILTER you use can make the request very slow, try using the following instead:

  FILTER(LANGMATCHES(LANG(?film_abstract), "en")) 

Although playing with your query, there is no data that actually matches your query in DBPedia. Essentially, the genre property you use seems to apply only to music, not movies, so you should completely remove the third triple picture if you really want to get any results.

+2
source

All Articles