MarkLogic 语义文档提到支持所有 SPARQL 1.1 属性路径(否定除外)。我无法获得指定路径长度的语法,即
elt{n,m} A path between n and m occurrences of elt.
elt{n} Exactly n occurrences of elt. A fixed length path.
elt{n,} n or more occurrences of elt.
elt{,n} Between 0 and n occurrences of elt.
如果我尝试这样的事情:
select ?leaf ?distance {
select ?leaf (count(?mid) as ?distance) {
?leaf <http://schemas.abbvienet.com/ontologies/infrastructure.owl#manager>{1,2} ?mid .
?mid <http://schemas.abbvienet.com/ontologies/infrastructure.owl#manager>{1,2} <http://rdf.abbvienet.com/infrastructure/person/10019933> .
}
group by ?leaf
}
我收到以下错误:
XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected {
这对其他人有效吗?或者有人知道 MarkLogic 是否支持此路径语法吗?
最佳答案
请参阅 property paths 的 SPARQL 1.1 规范- 请注意,这与 SPARQL 属性路径的早期草案不同,特别是属性的 n 到 m 次出现已被删除。
您可能还会发现这篇文章很有用 - boundary for arbitrary property path in SPARQL 1.1 .
顺便说一句,查询中的子选择并不是多余的(如果查询有效)。以下内容与您所拥有的内容等效:
select ?leaf (count(?mid) as ?distance) {
?leaf <http://schemas.abbvienet.com/ontologies/infrastructure.owl#manager>{1,2} ?mid .
?mid <http://schemas.abbvienet.com/ontologies/infrastructure.owl#manager>{1,2} <http://rdf.abbvienet.com/infrastructure/person/10019933> .
}
group by ?leaf
关于Marklogic 8 中的 SPARQL 1.1 属性路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37968370/