Marklogic 8 中的 SPARQL 1.1 属性路径

标签 sparql marklogic marklogic-8

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/

相关文章:

random - 如何从 SPARQL 中选择随机 DBPedia 节点?

types - SPARQL:如何列出和计算 RDF 数据集中的每种数据类型?

python - 从 DBpedia 中提取信息

sparql - 将文本搜索 where 子句添加到 SPARQL 查询

javascript - 如何在 MarkLogic 10 的资源扩展中导入 JavaScript 模块

Marklogic 计算的存储桶和 UTC 时区

search - 搜索选项错误中的提取文档数据

search - 通配符仅搜索特定元素

java - 使用 Marklogic 的 Java API 和 JAXB 对文档进行列表/搜索/分页

rest - 在用 XQuery 编写的 REST 扩展 GET 中输出内容类型和其他 header