【发布时间】:2015-09-02 07:05:05
【问题描述】:
Sesame 2.8.4好像有bug。
如果我有以下数据集:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix : <http://example.org/>.
:a rdf:type :AClass .
:a :hasName "a"^^xsd:string .
:a :hasProperty :xa .
:a :hasProperty :ya .
:a :hasProperty :za .
:b rdf:type :AClass .
:b :hasName "b"^^xsd:string .
:b :hasProperty :xb .
:b :hasProperty :yb .
:c rdf:type :AClass .
:c :hasName "c"^^xsd:string .
:c :hasProperty :xc .
并对其运行以下查询:
prefix : <http://example.org/>
select ?s ?p ?o {
#-- first, select two instance of :AClass
{ select ?s { ?s a :AClass } limit 2 }
#-- then, select all the triples of
#-- which they are subjects
?s ?p ?o
}
我得到的结果是这样的:
--------------------------------------------------------------------
| s | p | o |
====================================================================
| :a | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | :AClass |
| :a | :hasName | "a" |
--------------------------------------------------------------------
而不是这个是正确的结果:
--------------------------------------------------------------------
| s | p | o |
====================================================================
| :a | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | :AClass |
| :a | :hasName | "a" |
| :a | :hasProperty | :xa |
| :a | :hasProperty | :ya |
| :a | :hasProperty | :za |
| :b | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | :AClass |
| :b | :hasName | "b" |
| :b | :hasProperty | :xb |
| :b | :hasProperty | :yb |
--------------------------------------------------------------------
有人知道这个错误吗?有没有人遇到过同样的问题?或者是否有其他版本的 Sesame 修复了这个错误?
在回答我的问题后添加了下一行:
为避免任何混淆:错误在工作台中,而不是在查询引擎中。 查询引擎完美运行。
【问题讨论】:
-
不回答您的问题,但您需要
{ select **DISTINCT** ?s { ?s a :AClass } limit 2 }目前,内部选择可能会返回:a 和:a。 -
@AndyS 对不起,但如果我添加 DISTINCT 它会给我完全相同的结果。它没有其他效果。我已经试过了。
-
@AndyS:为什么内部选择要返回两次相同的 URI?图中不应该只有一个三元组(:a rdf:type :AClass)吗?
-
您检查过Sesame project support resources -- 错误跟踪器、邮件列表等吗?
标签: sparql semantic-web sesame