我正在尝试使用以下方法找到带有 RDF 的自引用循环:
SELECT ?sbj
# query pattern
WHERE {
?sbj skos:broader+ ?sbj .
}
当我在这些 RDF 三元组上运行它时:
http://www.example.com/Concept/0001 http://www.w3.org/2004/02/skos/core#broader http://www.example.com/Concept/0002
http://www.example.com/Concept/0002 http://www.w3.org/2004/02/skos/core#broader http://www.example.com/Concept/0003
http://www.example.com/Concept/0003 http://www.w3.org/2004/02/skos/core#broader http://www.example.com/Concept/0001
我得到:
http://www.example.com/Concept/0003
http://www.example.com/Concept/0001
http://www.example.com/Concept/0002
http://www.example.com/Concept/0002
http://www.example.com/Concept/0003
http://www.example.com/Concept/0001
http://www.example.com/Concept/0001
http://www.example.com/Concept/0002
http://www.example.com/Concept/0003
如果我对这些 RDF 三元组运行相同的查询:
http://www.example.com/Concept/0001 http://www.w3.org/2004/02/skos/core#broader http://www.example.com/Concept/0002
http://www.example.com/Concept/0002 http://www.w3.org/2004/02/skos/core#broader http://www.example.com/Concept/0003
http://www.example.com/Concept/0003 http://www.w3.org/2004/02/skos/core#narrower http://www.example.com/Concept/0001
我得到:
http://www.example.com/Concept/0003
http://www.example.com/Concept/0002
http://www.example.com/Concept/0003
正如我所期望的那样,它会返回空。
看起来 skos:broader+ 似乎允许 skos:broader 以外的属性,更像 ANY*,skos:broader,ANY* 或其他东西....这是正确的行为吗?
好吧,我使用:
Jena: VERSION: 2.6.4
Jena: BUILD_DATE: 2010-12-12T16:56:15+0000
ARQ: VERSION: 2.8.7
ARQ: BUILD_DATE: 2010-12-12T14:07:48+0000