我正在使用pellet进行sparql 查询,并且根据查询中三元组的顺序得到不同的结果,对吗?
例如,给定以下 N-Triples 数据输入:
<http://example.com/thing1> <http://example.com/hasDefinition> <http://example.com/def_thing1> .
<http://example.com/thing1> <http://www.w3.org/2000/01/rdf-schema#label> "Thing 1" .
<http://example.com/def_thing1> <http://www.w3.org/2000/01/rdf-schema#comment> "thing 1 it's awesome".
<http://example.com/thing2> <http://example.com/hasDefinition> <http://example.com/def_thing2> .
<http://example.com/thing2> <http://www.w3.org/2000/01/rdf-schema#label> "Thing 2" .
<http://example.com/def_thing2> <http://www.w3.org/2000/01/rdf-schema#comment> "thing 1 it's cool".
<http://example.com/thing3> <http://example.com/hasDefinition> <http://example.com/def_thing3> .
<http://example.com/thing3> <http://www.w3.org/2000/01/rdf-schema#label> "Thing 3" .
<http://example.com/def_thing3> <http://www.w3.org/2000/01/rdf-schema#comment> "thing 3 it's fine".
<http://example.com/thing4> <http://example.com/hasDefinition> <http://example.com/def_thing4> .
<http://example.com/thing4> <http://www.w3.org/2000/01/rdf-schema#label> "Thing 4" .
<http://example.com/def_thing4> <http://www.w3.org/2000/01/rdf-schema#comment> "thing 4 it's exactly what i need".
以下查询:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX example: <http://example.com/>
SELECT * WHERE {
?thing ?rel "Thing 4".
?thing example:hasDefinition ?def.
?def rdfs:comment ?definition.
}
回报:
Query Results (1 answers):
thing | rel | def | definition
================================================================
thing4 | label | def_thing4 | "thing 4 it's exactly what i need"
但下面的查询(只是前一个的改变):
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX example: <http://example.com/>
SELECT * WHERE {
?thing example:hasDefinition ?def.
?def rdfs:comment ?definition.
?thing ?rel "Thing 4".
}
我得到以下答案:
Query Results (5 answers):
thing | def | definition | rel
==============================================================================
thing4 | def_thing4 | "thing 4 it's exactly what i need" | _TOP_DATA_PROPERTY_
thing4 | def_thing4 | "thing 4 it's exactly what i need" | label
thing1 | def_thing1 | "thing 1 it's awesome" | _TOP_DATA_PROPERTY_
thing2 | def_thing2 | "thing 1 it's cool" | _TOP_DATA_PROPERTY_
thing3 | def_thing3 | "thing 3 it's fine" | _TOP_DATA_PROPERTY_
我没想到这种行为,我不知道它是否正确,我是那个提出错误查询的人。谁能给我解释一下?