给定这样的 RDF 图:
:Matrix [rdfs:label] :The Matrix .
:Matrix [movie:id] :23 .
:Matrix [movie:actor] :Keanu Reaves .
:Matrix [movie:actor] :Laurence Fishburne .
:Die Hard 3 [rdfs:label] :Die Hard 3 .
:Die Hard 3 [movie:id] :42 .
:Die Hard 3 [movie:actor] :Bruce Willis .
:Die Hard 3 [movie:actor] :Samuel L. Jackson .
和这样的查询:
SELECT ?id ?name ?actor
WHERE {
?instance movie:id ?id .
?instance rdfs:label ?name .
?instance movie:actor ?actor .
}
我希望得到如下结果:
id | name | actor
23 | The Matrix | Laurence Fishburne
23 | The Matrix | Keanu Reaves
42 | Die Hard 3 | Bruce Willis
42 | Die Hard 3 | Samuel L. Jackson
但相反,我只得到:
id | name | actor
23 | The Matrix | Laurence Fishburne
42 | Die Hard 3 | Bruce Willis
那是怎么回事?
顺便说一句,当我使用这个查询时:
SELECT *
WHERE {
?instance movie:id ?id .
?instance rdfs:label "The Matrix" .
?instance movie:actor ?actor .
}
结果是(如预期的那样):
id | name | actor
23 | The Matrix | Laurence Fishburne
23 | The Matrix | Keanu Reaves