使用xdmp:plan可以查看cts的计划:search()和可搜索的Xpath.但为什么像这样的表达 cts:search()/Xpath不可规划?另外,我会问同样的问题cts:uri-match().
使用以下示例三元组:
@prefix : <http://www.me.org/me_schema#> .
@prefix dc: <http://purl.org/dc#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://www.me.org/content/me_schema>
rdf:type owl:Ontology ;
owl:imports <http://www.w3.org/2004/02/skos/core> ;
.
:a
rdf:type owl:ObjectProperty ;
rdfs:label "A" ;
rdfs:subPropertyOf :b ;
.
:b
rdf:type owl:ObjectProperty ;
rdfs:label "B" ;
rdfs:subPropertyOf :c ;
.
:c
rdfs:label "C"^^xsd:string ;
.
Run Code Online (Sandbox Code Playgroud)
此查询按预期返回两行(列和?中的b和c):
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select *
from <test>
where
{
?s rdfs:label 'A' …Run Code Online (Sandbox Code Playgroud) 我在ML8中写了一个小的休息扩展,它基本上存储了上传到ml内容数据库的文件.当我这样做时,我得到以下异常
<error-response xmlns="http://marklogic.com/xdmp/error">
<status-code>500</status-code>
<status>Internal Server Error</status>
<message-code>INTERNAL ERROR</message-code>
<message>XDMP-UPDATEFUNCTIONFROMQUERY: xdmp:function(fn:QName("http://marklogic.com/rest-api/resource/repoLoad","post"), "/marklogic.rest.resource/repoLoad/assets/resource.xqy")($context, $service-params, $input) -- Cannot apply an update function from a query . See the MarkLogic server error log for further detail.</message>
</error-response>
Run Code Online (Sandbox Code Playgroud)
但我确实设置了声明选项xdmp:update"true"; 以下是代码..
module namespace repoLoad = "http://marklogic.com/rest-api/resource/repoLoad";
declare namespace rapi = "http://marklogic.com/rest-api";
declare default function namespace "http://www.w3.org/2005/xpath-functions";
declare option xdmp:mapping "false";
declare option xdmp:update "true";
(: Function responding to GET method - must use local name 'get':)
declare function repoLoad:get($context as map:map, $params as map:map) as …Run Code Online (Sandbox Code Playgroud) 我试图找到其中有一个属性的所有文件的共同出现<id>在文档的属性..以下是我做的,列出共发生和不正常的代码..可有人建议我在做什么错.
xquery version "1.0-ml";
declare namespace html = "http://www.w3.org/1999/xhtml";
declare namespace prop = "http://marklogic.com/xdmp/property";
import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy";
cts:value-co-occurrences(
cts:element-reference(xs:QName('prop:id')),
cts:uri-reference())
Run Code Online (Sandbox Code Playgroud)
如果它是最后一项,我试图在大括号后没有逗号.
for $row in /md:row
let $test := $row/md:test/text()
let $last := $row/*[fn:position() = fn:last()]
return (
'{
"test": {
"type": "test",
"test": [',$testa,',',$testb,']
}
}',
if($last)
then ''
else (',')
)
Run Code Online (Sandbox Code Playgroud) 查询:
let $collection := "sampledata"
for $uri1 in cts:uris((),(),(
cts:element-query(xs:QName("root"),
cts:and-query((
cts:element-attribute-value-query(xs:QName("root"),xs:QName($value1),$value2),
cts:element-attribute-value-query(xs:QName("root"),xs:QName($value3),$value4),
cts:element-value-query(xs:QName("year"),$value5),
cts:element-value-query(xs:QName("month"),$value6),
cts:element-attribute-value-query(xs:QName("num"),xs:QName("value"),$value7)
)))) )
return $uri1
Run Code Online (Sandbox Code Playgroud)
如何在上面提到的xquery中添加集合名称.
我正在使用,fn:distinct-values但是遇到了区分大小写的问题。
我需要删除MarkLogic db中的重复值。
Run Code Online (Sandbox Code Playgroud)Result : Antony antony
但我想得到一个结果,且没有任何重复:
安东尼或安东尼。
我在MarkLogic DB中有400万个xml文档.我需要将所有XMLS存储在本地文件夹中.
什么是最好和最快的方法?
我正在使用ML搜索语法abc NEAR\2 xyz.这个问题NEAR看起来是双向的.是否有可能告诉ML只朝一个方向看.
在我的项目之一,MarkLogic顾问建议我使用collection()的cts:search,而在另一个项目中,ML顾问建议在使用根元素cts:search.在这两个项目中,我们拥有相同数量的文档.哪一个在性能方面更好?
假设我们有一份文件(我正在拿一个小文件来解释这个场景).它有一个名为"demo"的集合:
<root>
<child1>ABC</child1>
<child2>DEF</child2>
<child3>GHI</child3>
<child4>JKL</child4>
</root>
Run Code Online (Sandbox Code Playgroud)
哪种情况更好/更有效:
cts:search(/root, cts:and-query((....some cts:queries..)))
cts:search(collection("demo"), cts:and-query((....some cts:queries..)))
请帮我解释一个比其他更好的解释.