对于 SPARQL 属性路径,否定无法按预期工作
根据 SPARQL 属性路径,否定用运算符 表示!
,即!(a|b|c|d)
表示任何不属于{a, b, c, d}
的关系。
根据这个定义,我发现下面的例子非常违反直觉。
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://rdf.freebase.com/ns/>
ASK {
:m.0262dl9
!(:type.object.type|<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)
:common.topic
}
上述查询返回 false
,因为从 :m.0262dl9
到 :common.topic
的唯一关系是 :type.object.type
和
,它们被否定。但是,如果我们将 ^:type.object.type
(这意味着 :type.object.type
的逆)添加到否定集合中,则答案将变为 true
。换句话说,我们修改
!(:type.object.type|<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)
为
!(:type.object.type|^:type.object.type|<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)
这很奇怪,因为第一个查询为假意味着第二个查询也必须为假。我真的不确定为什么第二个查询返回 true
。我是否误解了 !
或 ^
的定义?
According to SPARQL Property Paths, negation is expressed with the operator !
, i.e., !(a|b|c|d)
means any relations that do not fall into {a, b, c, d}
.
Based one this definition, I find the following example very counterintuitive.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://rdf.freebase.com/ns/>
ASK {
:m.0262dl9
!(:type.object.type|<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)
:common.topic
}
The above query returns false
because the only relations from :m.0262dl9
to :common.topic
are :type.object.type
and <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
, which are negated. However, if we add ^:type.object.type
, which means the inverse of :type.object.type
to the negated set, the answer becomes true
. In other words, we modify
!(:type.object.type|<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)
to
!(:type.object.type|^:type.object.type|<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)
This is quite weird, since the first query is false entails that the second query must also be false. I am really not sure why the second query returns true
. Am I misunderstanding the definition of !
or ^
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论