我使用SPARQL面临一个奇怪的问题。这段代码在QConsole上运行良好 -
xquery version "1.0-ml";
import module namespace sem = "http://marklogic.com/semantics" at "/MarkLogic/semantics.xqy";
declare function local:forex-series (
$from-currency-id as xs:string,
$to-currency-id as xs:string,
$forex-supplier-id as xs:string,
$feed-name-id as xs:string
)
{
let $map := map:map()
let $series-sparql := 'PREFIX series: <http://iddn.icis.com/series/>
PREFIX predicates: <http://iddn.icis.com/predicates/>
PREFIX xmls: <http://www.w3.org/2001/XMLSchema#>
SELECT ?series
WHERE {
?series predicates:to-currency $toCurrencyId ;
predicates:from-currency $fromCurrencyId ;
predicates:forex-provider $forexSupplierId ;
predicates:forex-feed $feedNameId ;
}'
let $_ := map:put($map, "toCurrencyId", sem:iri($to-currency-id))
let $_ := map:put($map, "fromCurrencyId", sem:iri($from-currency-id))
let $_ := map:put($map, "forexSupplierId", sem:iri($forex-supplier-id))
let $_ := map:put($map, "feedNameId", sem:iri($feed-name-id))
return
sem:query-results-serialize(sem:sparql($series-sparql, $map))
};
let $to-currency-id := "http://iddn.icis.com/ref-data/currency/10"
let $from-currency-id := "http://iddn.icis.com/ref-data/currency/18"
let $forex-supplier-id := "http://iddn.icis.com/asset/forex/xe"
let $feed-name-id := "http://iddn.icis.com/asset/forex/current"
return local:forex-series($from-currency-id, $to-currency-id, $forex-supplier-id, $feed-name-id)
但是当它添加到XQuery开发代码并部署到模块中时,它无法正常工作。 sem:sparql在这种情况下不会返回任何内容。
是否需要进行任何设置?或者我错过了什么?对此请考虑一下!
答案 0 :(得分:1)
请记住,三元组是文档,并遵循与其他文档相同的安全性。
那么,你确定你有权阅读包含三元组的文件吗?
示例:您是在查询控制台中使用admin还是以其他方式运行代码的其他用户?