【问题标题】:inferencing working with xquery but not sparql query推理使用 xquery 但不是 sparql 查询
【发布时间】:2015-07-15 18:13:00
【问题描述】:

我正在尝试运行一个使用 subClassOf 关系进行推理的示例。

由于某种原因,我在使用 xquery 时得到了选择查询结果,但在使用 sparql 时却没有。

xquery

​​>
let $sq := 
'PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT *
WHERE { ?s rdf:type <http://www.smartlogic.com/geography#Europe> . 

} '

let $rs := sem:ruleset-store("rdfs.rules", sem:store())  

return sem:sparql($sq, (), (), $rs)  

sparql

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT *
WHERE { ?s rdf:type <http://www.smartlogic.com/geography#Europe> . 
} 

【问题讨论】:

  • 我使用的三元组是: smartlogic.com/document#Credit_Suisse> w3.org/1999/02/22-rdf-syntax-ns#type> smartlogic.com/geo#London> 。 smartlogic.com/geo#London> w3.org/2000/01/rdf-schema#subClassOf> smartlogic.com/geo#Europe> .

标签: xquery sparql marklogic inference


【解决方案1】:

截至目前(MarkLogic 8.0-3),SPARQL 接口不提供指定要使用的推理规则集的方法。 You can configure a default ruleset to use with the database,将用于所有 SPARQL 查询。

正如您所做的那样,您可以使用sem:ruleset-store() (XQuery)sem.rulesetStore() (JavaScript) 指定要使用的规则集。

【讨论】:

    猜你喜欢
    • 2011-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-15
    相关资源
    最近更新 更多