LinkedMDB SPARQL Queries

I'm a little confused. I have the following SPARQL query that works brilliantly with LinkedMDB Explorer .

PREFIX mdb: <http://data.linkedmdb.org/resource/movie/film> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX dc: <http://purl.org/dc/terms/> SELECT ?label?resource WHERE { ?resource mdb:id ?uri . ?resource dc:title ?label . FILTER regex(?label,'^Batman') } 

This filter filters out all the Batman movies like this (I filtered all the results and there are only five here):

 -----------------------------------------------| | Label | Resource | |----------------------------------------------| | Batman | db:film/2 | | Batman | db:film/3 | | Batman & Robin | db:film/4 | | Batman: Mask of the Phantasm | db:film/737| | Batman: Mystery of the Batwoman | db:film/974| -----------------------------------------------| 

But the question arises here. If I write "Forrest Gump" instead of "Batman", the query cannot find any result.

However, if I changed the last line to

  ?resource dc:title "Forrest Gump". 

he finds the movie in the LinkedMDB database, so I know that he is hiding somewhere. But it does not return when I use the FILTER regex solution.

I noticed that if I only search without a filter and just print all the movies in the database, it looks like LinkedMDB has some kind of LIMIT at 2557 so that the web page will not break. And it seems that FILTER filters only those 2557 films. Is there a way to get more movies?

+2
source share
1 answer

SPARQL 1.1 introduces more string functions such as contains , strstarts and strends , which are much more specialized and can be much faster than using full-scale regular expression. However, it does not look like LinkedMDB Explorer supports SPARQL 1.1, so they are not useful here.

If you know the exact name of the movie, it will be much easier to just ask for it instead of using regular expressions. For instance,

 SELECT ?resource WHERE { ?resource movie:filmid ?uri . ?resource dc:title "Forrest Gump" . } 

SPARQL Results

returns the movie db: film / 38179 .

+1
source

Source: https://habr.com/ru/post/1200182/


All Articles