Rdf sparql查询中三元组的顺序是否会影响结果?
我使用pellet进行sparql查询,根据查询中三元组的顺序得到不同的结果,对吗 例如,给定以下N-Triples数据输入:Rdf sparql查询中三元组的顺序是否会影响结果?,rdf,sparql,pellet,n-triples,Rdf,Sparql,Pellet,N Triples,我使用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-sch
<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".
但是下面的查询(只是对前一个查询的修改):
我没有预料到这种行为,我不知道它是否正确,我是那个提出错误查询的人。有人能给我解释一下吗?这两个查询肯定会得到相同的结果,像这样改变三重模式的顺序应该不会有什么区别。这可能是查询引擎中的一个bug。正如Jan建议的那样,一个纯SPARQL引擎不应该在给定数据和该查询的情况下给出不同的结果 然而,您使用的是Pellet(尽管您没有说明是哪个版本),它有一个带有嵌入式推理器的SPARQL引擎。这意味着SPARQL引擎可以合法地返回额外的结果,如果它可以通过reasoner派生这些结果(请参见规范中的)
查询的一个版本导致reasoner启动,而另一个版本没有启动,这一事实有点奇怪,您可能应该询问Pellet开发人员。三重模式的顺序不应该改变结果 查询的不寻常之处在于在属性位置使用了
?rel
\u TOP\u DATA\u PROPERTY\u
可能是小球引擎将在内部抑制的内容-但是如果?thing?rel“thing 4”。
是最后一个模式,数据不会再次通过小球,只是来自数据库
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_