3
芝麻2.8.4似乎有bug。
芝麻2.8.4子查詢限制錯誤修復?
如果我有下面的數據集:
@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 |
--------------------------------------------------------------------
有沒有人知道這個錯誤?有沒有人遇到同樣的問題?還是有另一個版本的芝麻修復了這個bug?
爲了避免任何混淆:我的問題得到回答後加入
下一行bug是在工作臺,而不是查詢引擎。 查詢引擎完美工作。
不回答你的問題,但你需要'{select ** DISTINCT **?s {?s a:AClass} limit 2}'現在,內部select可以返回:a和:a。 – AndyS
@AndyS對不起,但如果我添加** DISTINCT **它給了我完全相同的結果。它沒有其他作用。我已經嘗試過了。 – whitefang1993
@AndyS:爲什麼內部select會返回兩次相同的URI?圖中不應該只有一個三元組(::rdf:type:AClass)? – AKSW