Can't retrieve movies with high IDs from LinkedMDB with SPARQL

前端 未结 1 457
南笙
南笙 2021-01-06 03:50

I\'m running the following query at the LinkedMDB SPARQL endpoint and it works. With it, I get all the information that I need about the director of the movie with id 72, wh

相关标签:
1条回答
  • SPARQL lets you write 72 as shorthand for the literal "72"^^xsd:integer. As you've seen, you can retrieve the film with the ID "72"^^xsd:integer without a problem. However, the other film that you're looking for has the id "44396"^^xsd:int (note that the datatype is xsd:int, not xsd:integer). I don't know why the datatype is different, but it's enough to help us retrieve what we want:

    PREFIX mdb: <http://data.linkedmdb.org/resource/movie/>
    SELECT ?director?nombre_director?id_director WHERE {
      ?pelicula mdb:filmid "44396"^^xsd:int .
      ?pelicula <http://data.linkedmdb.org/resource/movie/director> ?director .
      ?director <http://data.linkedmdb.org/resource/movie/director_name> ?nombre_director .
      ?director <http://data.linkedmdb.org/resource/movie/director_directorid> ?id_director .
    }
    

    SPARQL results (one)

    director          nombre_director  id_director
    ----------------------------------------------
    db:director/9025  "J.J. Abrams"    9025
    

    Note that rather than filtering, I just put the actual desired value into the query pattern. I find this to be a bit simpler, and if the query engine isn't optimized, it might be better performing (since it's not building a big result set and then filtering things out). In fact, that might explain why the semantically equivalent query that uses a variable and a filter returns no results, if there's a limit on how many results the query can return. (But this is pure speculation.) In any case, the following query doesn't work, but I think that it should:

    PREFIX mdb: <http://data.linkedmdb.org/resource/movie/>
    SELECT ?director?nombre_director?id_director WHERE {
      ?pelicula mdb:filmid ?id .
      ?pelicula <http://data.linkedmdb.org/resource/movie/director> ?director .
      ?director <http://data.linkedmdb.org/resource/movie/director_name> ?nombre_director .
      ?director <http://data.linkedmdb.org/resource/movie/director_directorid> ?id_director .
      filter ( ?id = "44396"^^xsd:int ) 
    }
    

    SPARQL results (none)

    0 讨论(0)
提交回复
热议问题