在 marklogic 中,三元组可以嵌入到现有文档中。如何使用 cts 搜索查询返回文档。一个文档的例子可以是
<ContentVersion>
<Name>Testing</Name>
<Status>Approved</Status>
<sem:triples xmlns:sem="http://marklogic.com/semantics">
<sem:triple>
<sem:subject>http://mycontent/content/Testing</sem:subject>
<sem:predicate>is</sem:predicate>
<sem:object>Approved</sem:object>
</sem:triple>
</sem:triples>
</ContentVersion>
如果尝试以下查询
let $query := cts:word-query('Testing',"case-insensitive")
let $sparql := "PREFIX cts: <http://marklogic.com/cts#>
DESCRIBE ?s
WHERE{
?s ?p ?o .
FILTER cts:contains(?o, cts:word-query('Testing'))
}"
let $results := sem:sparql($sparql,(),("default-graph=magician"),($query))
return(sem:rdf-serialize($results,'rdfxml'))
我得到一个空的结果。关于为什么什么都不返回的任何想法?我正在使用 MarkLogic 7