Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sparql Query to get all the possible movies available from dbpedia

To get all the possible film name, I used sparql query:

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

SELECT DISTINCT ?film_title ?film_abstract
WHERE {
?film_title rdf:type <http://dbpedia.org/ontology/Film> .
?film_title rdfs:comment ?film_abstract 
}

It returned me only 10,000 movies. DBpedia mentions on its website that it has around 60,000 movies. For my application I need all the possible movies. Could someone guide me what all other possibilities are there to get rest of the movies

like image 574
Shruts_me Avatar asked Nov 30 '11 15:11

Shruts_me


People also ask

How to query DBpedia with SPARQL?

To actually query DBpedia, you can go to dbpedia.org/sparql and submit your query to return the results in a number of formats such as HTML, JSON or CSV. You can also run SPARQL on DBpedia from within a Python application but that will be covered in my next blog.

How many movies are in DBpedia?

The 2016-04 release of the DBpedia data set describes 6.0 million entities, out of which 5.2 million are classified in a consistent ontology, including 1.5 million persons, 810,000 places, 135,000 music albums, 106,000 films, 20,000 video games, 275,000 organizations, 301,000 species and 5,000 diseases.


1 Answers

DBPedia has a cap on how many results it can return in one call. If you want to get all of them you can do it through multiple queries using limit and offset e.g. (limit 1000 offset 0, limit 1000 offset 1000 etc.). So you first query would be:

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

SELECT DISTINCT ?film_title ?film_abstract
WHERE {
?film_title rdf:type <http://dbpedia.org/ontology/Film> .
?film_title rdfs:comment ?film_abstract 
} LIMIT 1000 OFFSET 0
like image 55
ip. Avatar answered Sep 20 '22 13:09

ip.