无法使用SPARQL从LinkedMDB检索具有高ID的电影 [英] Can't retrieve movies with high IDs from LinkedMDB with SPARQL
问题描述
我正在 LinkedMDB SPARQL端点上运行以下查询,并且可以正常运行.有了它,我得到了我需要的所有有关ID为72的电影的导演的信息,这些导演是《泰坦尼克号》,所以我得到了关于詹姆斯·卡梅隆的信息.
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, which is Titanic, so I get information about James Cameron.
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 = 72).
}
对于ID较高的电影,例如 ID为44396的星际迷航 ,如果我将72396替换为44396,则查询不会返回任何结果.不过,条目显然具有目录,ID和名称.为什么更改后的查询不起作用?
With movies that have a higher ID, e.g., example Star Trek with ID 44396, if I replace 72 with 44396, the query returns no results. The entry clearly has a directory, id, and name, though. Why doesn't the altered query work?
推荐答案
SPARQL允许您编写72
作为文字"72"^^xsd:integer
的简写.如您所见,您可以毫无问题地检索ID为"72"^^xsd:integer
的电影.但是,您要查找的另一部电影的ID为"44396"^^xsd:int
(请注意,数据类型为xsd:int
,不是 xsd:integer
).我不知道为什么为什么数据类型不同,但这足以帮助我们检索想要的内容:
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 .
}