如何使用cts:triple-range-query()返回一组MarkLogic URI?
我有一个内容存储库,其中最新版本的文档使用最新版本如何使用cts:triple-range-query()返回一组MarkLogic URI?,marklogic,marklogic-8,triplestore,Marklogic,Marklogic 8,Triplestore,我有一个内容存储库,其中最新版本的文档使用最新版本 Document URI: /Transaction/00000000000101000000/1.xml <aptp:Transaction xmlns:aptp="http://sample.com/aptp"> <aptp:TransactionDate>2016-07-28</aptp:TransactionDate> <aptp:TransactionType>Prin
Document URI: /Transaction/00000000000101000000/1.xml
<aptp:Transaction xmlns:aptp="http://sample.com/aptp">
<aptp:TransactionDate>2016-07-28</aptp:TransactionDate>
<aptp:TransactionType>Principal</aptp:TransactionType>
<aptp:Operation>Buy</aptp:Operation>
<sem:triple name="isLatestVersion"
xmlns:aptp="http://sample.com/aptp"
xmlns:sem="http://marklogic.com/semantics">
<sem:subject datatype="http://www.w3.org/2001/XMLSchema#string">
/Transaction/00000000000101000000/1.xml
</sem:subject>
<sem:predicate>isLatestVersion</sem:predicate>
<sem:object datatype="http://www.w3.org/2001/XMLSchema#boolean">true</sem:object>
</sem:triple>
</aptp:Transaction>
这是isLatestVersion三元组的文档示例
Document URI: /Transaction/00000000000101000000/1.xml
<aptp:Transaction xmlns:aptp="http://sample.com/aptp">
<aptp:TransactionDate>2016-07-28</aptp:TransactionDate>
<aptp:TransactionType>Principal</aptp:TransactionType>
<aptp:Operation>Buy</aptp:Operation>
<sem:triple name="isLatestVersion"
xmlns:aptp="http://sample.com/aptp"
xmlns:sem="http://marklogic.com/semantics">
<sem:subject datatype="http://www.w3.org/2001/XMLSchema#string">
/Transaction/00000000000101000000/1.xml
</sem:subject>
<sem:predicate>isLatestVersion</sem:predicate>
<sem:object datatype="http://www.w3.org/2001/XMLSchema#boolean">true</sem:object>
</sem:triple>
</aptp:Transaction>
我是否遗漏了一些明显的东西?一些想法:
- 考虑在
。您可以改为以空序列传递cts:triple-range查询中省略$uri
- 您可能需要在
中包装sem:iri
,例如“isLatestVersion”
sem:iri(“isLatestVersion”)
- 确保启用了三重索引,但我认为如果不启用,它会抱怨
- 考虑在
。您可以改为以空序列传递cts:triple-range查询中省略$uri
- 您可能需要在
中包装sem:iri
,例如“isLatestVersion”
sem:iri(“isLatestVersion”)
- 确保启用了三重索引,但我认为如果不启用,它会抱怨
嗯 此代码段运行良好
declare function local:getLatestUris($uris)
{
let $query := cts:triple-range-query($uris, sem:iri("isLatestVersion"), fn:true())
return cts:uris((), (), $query)
};
local:getLatestUris((
"/Transaction/00000000000101000000/1.xml",
"/Transaction/00000000000101000001/1.xml",
"/Transaction/111111/1.xml"
))
此代码段运行良好
declare function local:getLatestUris($uris)
{
let $query := cts:triple-range-query($uris, sem:iri("isLatestVersion"), fn:true())
return cts:uris((), (), $query)
};
local:getLatestUris((
"/Transaction/00000000000101000000/1.xml",
"/Transaction/00000000000101000001/1.xml",
"/Transaction/111111/1.xml"
))
我看到我只需要将sem:iri(“IslatesVersion”)添加到查询中,我看到我只需要将sem:iri(“IslatesVersion”)添加到查询中。