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 :(错误:XPST0003)意外的令牌语法错误,意外{
这是否适用于其他任何人,或者是否有人知道MarkLogic是否支持此路径语法?
答案 0 :(得分:3)
请参阅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