我正在使用Tableau和MarkLogic.我有以下XML结构
<CustomerInformation CustomerId="1">
<CustomerBasicInformation>
<CustomerTitle></CustomerTitle>
<CustomerFirstName></CustomerFirstName>
<CustomerMiddleName></CustomerMiddleName>
<CustomerLastName></CustomerLastName>
</CustomerBasicInformation>
<CustomerEmplyomentDetails>
<CustomerEmployer>
<EmployerName IsCurrentEmployer=""></EmployerName>
<CustomerDesignation></CustomerDesignation>
<EmployerLocation></EmployerLocation>
<CustomerTenure></CustomerTenure>
</CustomerEmployer>
<CustomerEmplyomentDetails>
<PolcyDetails>
<Policy PolicyId="">
<PolicyName></PolicyName>
<PolicyType></PolicyType>
<PolicyCategory></PolicyCategory>
<QuoteNumber></QuoteNumber>
<PolicyClaimDetails>
<PolicyClaim ClaimId="">
<PolicyClaimedOn></PolicyClaimedOn>
<PolicyClaimType></PolicyClaimType>
<PolicyClaimantName></PolicyClaimantName>
</PolicyClaim>
</PolicyClaimDetails>
<PolicyComplaintDetails>
<PolicyComplaint ComplaintId="">
<PolicyComplaintStatus></PolicyComplaintStatus>
<PolicyComplaintOn></PolicyComplaintOn>
</PolicyComplaint>
</PolicyComplaintDetails>
<BillingDetails>
<Billing BillingId="">
<BillingAmount></BillingAmount>
<BillingMode></BillingMode>
</Billing>
</BillingDetails>
</Policy>
<Policy PolicyId="">
<PolicyName></PolicyName>
<PolicyType></PolicyType>
<PolicyCategory></PolicyCategory>
<QuoteNumber></QuoteNumber>
<PolicyClaimDetails>
<PolicyClaim ClaimId="">
<PolicyClaimedOn></PolicyClaimedOn>
<PolicyClaimType></PolicyClaimType>
<PolicyClaimantName></PolicyClaimantName>
</PolicyClaim>
</PolicyClaimDetails>
<PolicyComplaintDetails>
<PolicyComplaint ComplaintId="">
<PolicyComplaintStatus></PolicyComplaintStatus>
<PolicyComplaintOn></PolicyComplaintOn>
</PolicyComplaint>
</PolicyComplaintDetails>
<BillingDetails>
<Billing BillingId="">
<BillingAmount></BillingAmount>
<BillingMode></BillingMode>
</Billing>
</BillingDetails>
</Policy>
</PolcyDetails>
</CustomerInformation>
Run Code Online (Sandbox Code Playgroud)
我已经在上面的结构上创建了一个视图.最初我为所有元素创建了一个视图,但在Tableau上我得到了重复值以及笛卡尔连接结果.所以为了解决这个问题,我使用了片段根的方法.由于单个客户可以有多个PolicyDetails.我在Policy上创建了片段根目录.类似声明,投诉,计费,报价对于单个策略可以是多个,我已经在每个策略上创建了片段根. …
我正在使用MLCP(Marklogic内容泵)将内容从一个数据库复制到另一个数据库.在这个我使用-query_filter选项,它的值是一个cts:查询以XML序列化格式的一组cts:element-range-query包装在cts:and-query中:
<cts:and-query xmlns:cts="http://marklogic.com/cts">
<cts:element-range-query operator=">">
<cts:element xmlns:c="http://iddn.icis.com/ns/core">c:released-on</cts:element>
<cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2000-12-21T00:00:00Z</cts:value>
</cts:element-range-query>
<cts:element-range-query operator="<">
<cts:element xmlns:c="http://iddn.icis.com/ns/core">c:released-on</cts:element>
<cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2016-12-21T00:00:00Z</cts:value>
</cts:element-range-query>
</cts:and-query>
Run Code Online (Sandbox Code Playgroud)
现在,上面的查询在ML Qconsole上执行时返回有效结果,但是当传入MLCP的-query_filter选项时,它会给出错误"无效属性值字符"<'.
Marklogic和MLCP的版本是8.0-5.
在进一步深入研究这个问题时,我发现只有当运算符值小于'<'时才会出现问题.
注意:我已在数据库中为"已启动"元素配置了有效的范围索引.
我正在运行MarkLogic版本8.0-6.1.
主机操作系统是红帽企业Linux服务器版本6.8(圣地亚哥).
数据存储在具有90%可用空间的本地磁盘上.
服务器运行得相当好,但偶尔会抛出以下错误.
SVC-FILWRT: File write error: write '/var/opt/MarkLogic/Forests/clickstream-1/0000008a/ListData': File too large
Run Code Online (Sandbox Code Playgroud)
有关根本原因和可能修复的任何想法?
我有以下挑战.我们有想要使用mlcp加载到MarkLogic数据库的csv文件.我们还希望在加载期间将加载的行转换为OBI源,因此我们为此构建了转换函数.
现在我正在努力改造.如果没有转换,数据将按预期加载为每行doc.
csv示例:
voornaam,achternaam
hugo,koopmans
thijs,van ulden
Run Code Online (Sandbox Code Playgroud)
变换ambulance.xqy:
xquery version "1.0-ml";
module namespace rws = "http://marklogic.com/rws";
import module namespace source = "http://marklogic.com/solutions/obi/source" at "/ext/obi/lib/source-lib.xqy";
(: If the input document is XML, create an OBI source from it, with the value
: specified in the input parameter. If the input document is not
: XML, leave it as-is.
:)
declare function rws:transform(
$content as map:map,
$context as map:map
) as map:map*
{
let $attr-value :=
(map:get($context, "transform_param"), "UNDEFINED")[1]
let $the-doc := …
Run Code Online (Sandbox Code Playgroud) 我试图使用2层服务器端JavaScript应用程序返回JSON格式的XML文档.我知道MarkLogic可以使用REST api在JSON和XML格式之间轻松切换.
但是,以下返回xml:
cts.search('something', ['format-xml']) // options may be omitted
Run Code Online (Sandbox Code Playgroud)
但这没有任何回报:
cts.search('something', ['format-json'])
Run Code Online (Sandbox Code Playgroud)
根据文档,我认为我已正确使用该功能.
这可能使用服务器端javascript吗?
更新:
使用transformToJsonObject
方法如下:
var json = require('/MarkLogic/json/json.xqy');
var doc = fn.doc('/content/rss/72eb9bf835521446be8d2176e1ac9d22.xml')
var jsonDoc = json.transformToJsonObject(doc, json.config('custom'));
jsonDoc
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
500 Internal Server Error
XDMP-STACKOVERFLOW: Stack overflow
in /MarkLogic/json/custom.xqy, at 493:23,
in json-custom:is-ignore-attribute#2(json:object(<json:object xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:json="http://marklogic.com/xdmp/json"><json:entry key="element-qname-from-json-name"><json:value xsi:t...</json:object>...XDMP-ATOMIZEFUNC: (err:FOTY0013) Functions cannot be atomized...), fn:doc("/content/rss/72eb9bf835521446be8d2176e1ac9d22.xml")/newsitem/article/*:html/*:head/*:script[5]/*:script/*:script/*:script/*:link/*:script/*:script/*:script/*:script/*:script/*:script/*:style/*:script/*:script/*:script/*:script/*:script/*:script/*:script/*:script/*:script/*:script/*:link/*:script/*:script/*:noscript/*:link/*:meta/*:body/*:div/*:div/*:div/*:script/*:div/*:div/*:script/*:script/*:div/*:div/*:script/*:script/*:script/*:script/*:noscript/*:p/*:header/*:div/*:div/*:div/*:a/*:section/*:div/*:h2/*:ul/*:li/*:a/*:li/*:a/*:div/*:div/*:a/*:img/*:span/*:script/*:nav/*:div/*:h2/*:ul/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:li/*:a/*:span/*:div/*:a/*:form/*:div/*:label/*:div/*:script/*:div/*:div/*:div/*:div/*:div/*:a/*:svg/*:title/*:h2/*:a/*:div/*:button/*:div/*:ul/*:li/*:a/*:span/*:li/*:a/*:span/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:div/*:nav/*:a/*:span/*:span/*:ul/*:li/*:a/*:span/*:li/*:a/*:span/*:span/*:div/*:div/*:script/*:script/*:div/*:div/*:span/*:span/*:a/*:div/*:div/*:script/*:script/*:div/*:div/*:div/*:span/*:span/*:a/*:div/*:div/*:script/*:script/*:div/*:div/*:div/*:div/*:h1/*:div/*:ul/*:li/*:div/*:li/*:span/*:a/*:div/*:figure/*:span/*:img/*:span/*:span/*:figcaption/*:span/*:span/*:p/*:p/*:p/*:p/*:p/*:div/*:div/*:script/*:script/*:h2/*:p/*:p/*:figure/*:span/*:div/*:span/*:span/*:figcaption/*:span/*:span/*:p/*:p/*:p/*:p/*:p/*:p/*:p/*:p/*:div/*:a/*:h2/*:a/*:ul/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:li/*:a/*:span/*:div/*:div/*:div/*:h2/*:div/*:ul/*:li/*:a/*:div/*:div/*:div/*:span/*:div/*:div/*:li/*:a/*:div/*:div/*:div/*:span/*:div/*:div/*:li/*:a/*:div/*:div/*:div/*:span/*:div/*:div/*:li/*:a/*:div/*:div/*:div/*:span/*:div/*:div/*:li/*:a/*:div/*:div/*:div/*:span/*:div/*:div/*:li/*:a/*:div/*:div/*:div/*:span/*:div/*:div/*:li/*:a/*:div/*:div/*:div/*:span/*:div/*:div/*:li/*:a/*:div/*:div/*:div/*:span/*:div/*:div/*:li/*:a/*:div/*:div/*:div/*:span/*:div/*:div/*:div/*:div/*:div/*:h2/*:div/*:ul/*:li/*:div/*:div/*:a/*:div/*:span/*:p/*:div/*:div/*:div/*:div/*:script/*:script/*:div/*:div/*:script/*:script/*:div/*:div/*:script/*:script/*:div/*:div/*:h2/*:a/*:strong/*:p/*:div/*:a/*:strong/*:div/*:a/*:strong/*:div/*:div/*:div/*:script/*:script/*:div/*:div/*:h2/*:div/*:div/*:a/*:div/*:div/*:div/*:h3/*:p/*:div/*:a/*:div/*:div/*:div/*:h3/*:p/*:div/*:a/*:div/*:div/*:div/*:h3/*:p/*:div/*:a/*:div/*:div/*:div/*:h3/*:p/*:div/*:a/*:div/*:div/*:div/*:h3/*:p/*:div/*:a/*:div/*:div/*:div/*:h3/*:p/*:div/*:a/*:div/*:div/*:div/*:h3/*:p/*:div/*:a/*:div/*:div/*:div/*:div/*:div/*:span/*:span/*:span/*:h3/@class) [1.0-ml]
$config = json:object(<json:object xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:json="http://marklogic.com/xdmp/json"><json:entry key="element-qname-from-json-name"><json:value xsi:t...</json:object>...XDMP-ATOMIZEFUNC: (err:FOTY0013) Functions cannot be atomized...)
$a = fn:doc("/content/rss/72eb9bf835521446be8d2176e1ac9d22.xml")/newsitem/article/*:html/*:head/*:script[5]/*:script/*:script/*:script/*:link/*:script/*:script/*:script/*:script/*:script/*:script/*:style/*:script/*:script/*:script/*:script/*:scr
Run Code Online (Sandbox Code Playgroud) 我想在marklogic中使用rest api搜索基于其中一个属性的文档.这是文件 -
{
"id" : "101",
"sectionName" : "PI"
"firstName" : "I",
"middle name" : "Me",
"last name : "Myself",
"emailId" : "aaa@gmail.com"
}
Run Code Online (Sandbox Code Playgroud)
可以说,我想基于sectionName搜索文档,然后按ID排序,那么我的其余查询是什么?
我正在尝试构建一个角度应用程序来访问MarkLogic数据库中的数据.我正在使用MarkLogic rest API来访问数据.当我尝试运行该应用程序时,出现以下错误.
XMLHttpRequest无法加载 http://192.168.192.75:9550/v1/keyvalue?element=fieldId&value=1005&format=json.请求的资源上不存在"Access-Control-Allow-Origin"标头.因此,不允许来源" http:// localhost:8080 "访问.
我已经在stackoverflow上阅读了很多与此问题相关的答案,但无法正常工作.这是我到现在为止所尝试的.
1) Setting the response header using xdmp in qconsole
xdmp:add-response-header("Access-Control-Allow-Origin", "*");
xdmp:add-response-header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
xdmp:add-response-header("Access-Control-Allow-Headers", "x-requested-with, X-Auth-Token, Content-Type");
2) Tried to add headers by using REST [Extention][1]. Here is the example.sjs file which I wrote.
a) function get(context, params) {
var results = [];
context.outputTypes = [];
for (var pname in params) {
if (params.hasOwnProperty(pname)) {
results.push({name: pname, value: params[pname]});
context.outputTypes.push('application/json');
}
}
context.outputStatus = [201, 'Created My …
Run Code Online (Sandbox Code Playgroud) 我将非托管三元组存储为我存储在内容数据库中的单个文档的一部分.基本上每个文档代表一个人,定义的三元组指定了该人的经理的文档URI.我正在尝试使用SPARQL来确定管理器与层次结构中它们下面的所有人之间的路径长度.
文档中的三元组看起来像
<sem:triple xmlns:sem="http://marklogic.com/semantics">
<sem:subject>http://rdf.abbvienet.com/infrastructure/person/10740024</sem:subject>
<sem:predicate>http://schemas.abbvienet.com/ontologies/infrastructure.owl#manager</sem:predicate>
<sem:object>http://rdf.abbvienet.com/infrastructure/person/10206242</sem:object>
</sem:triple>
Run Code Online (Sandbox Code Playgroud)
我找到了以下sparql查询,该查询可用于返回管理器,层次结构中位于它们下方的人员以及它们所在的节点数量.
select ?manager ?leaf (count(?mid) as ?distance) {
BIND(<http://rdf.abbvienet.com/infrastructure/person/10025613> as ?manager)
?leaf <http://schemas.abbvienet.com/ontologies/infrastructure.owl#manager>* ?mid .
?mid <http://schemas.abbvienet.com/ontologies/infrastructure.owl#manager>+ ?manager .
}
group by ?manager ?leaf
order by ?manager ?leaf
Run Code Online (Sandbox Code Playgroud)
这是有效的,但是非常慢,即使我正在查看的层次结构树是一个或两个深度,大约15s.我在db中有63,139个这种类型的管理器三元组.
我正在调用sec:role-exists().我试图找出将此功能授予管理员以外的其他人所需的权限.我得到的错误意味着我需要http://marklogic.com/xdmp/privileges/get-role权限.
SEC-PRIVDNE: xdmp:security-assert("http://marklogic.com/xdmp/privileges/get-role", "execute") -- Privilege does not exist: action(http://marklogic.com/xdmp/privileges/get-role), kind(execute)
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试通过sec:privilege-add-roles使用admin帐户授予此角色时,它告诉我该权限不存在.
[1.0-ml] SEC-PRIVDNE: (err:FOER0000) Privilege does not exist: action(http://marklogic.com/xdmp/privileges/get-role), kind(execute)
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
这是我用来授权的代码片段,我以管理员身份运行.
(: grant the needed privileges to the role :)
let $grant_privs :=
xdmp:invoke-function(
function() {
let $required_roles := (
"http://marklogic.com/xdmp/privileges/create-role",
"http://marklogic.com/xdmp/privileges/remove-role",
"http://marklogic.com/xdmp/privileges/get-role-ids",
"http://marklogic.com/xdmp/privileges/get-role-names",
"http://marklogic.com/xdmp/privileges/get-role",
"http://marklogic.com/xdmp/privileges/xdmp-invoke-in",
"http://marklogic.com/xdmp/privileges/xdmp-invoke"
)
return
for $r in $required_roles
return
sec:privilege-add-roles(
$r,
"execute",
"auth-lib"
)
},
<options xmlns="xdmp:eval">
<database>{ xdmp:security-database() }</database>
<transaction-mode>update-auto-commit</transaction-mode>
<isolation>different-transaction</isolation>
</options>
)
Run Code Online (Sandbox Code Playgroud) 有什么方法可以创建自定义约束,使正确的部分可以包含复杂的逻辑?即
name:(phil OR tom)
Run Code Online (Sandbox Code Playgroud)
在我的函数中,当我获得$ right面时,整个值都简化为所有文本的简单串联字符串,即
<cts:word-query xmlns:cts="http://marklogic.com/cts">
<cts:text>phil tom</cts:text>
</cts:word-query>
Run Code Online (Sandbox Code Playgroud)
我想要做的是获取一个已解析的查询,然后将自己的添加内容添加到已解析的查询中。所以我希望有某种方法可以使$ right参数成为类似
<cts:or-query xmlns:cts="http://marklogic.com/cts">
<cts:word-query>
<cts:text>phil</cts:text>
</cts:word-query>
<cts:word-query>
<cts:text>tom</cts:text>
</cts:word-query>
</cts:or-query>
Run Code Online (Sandbox Code Playgroud)
我想获取查询的输出结果,并使用另一个查询进行扩展以获取实际结果。即我有一个name
限制,将搜索限制在各种名称字段中。找到匹配的人之后,我想将结果从匹配的人转变为一个人的层次结构,也许向下两层。作为转换结果或自定义约束,这似乎没有意义。这仅仅是一个自定义的REST端点吗?我希望利用已经内置在标准搜索端点中的分页。
marklogic ×10
marklogic-8 ×10
mlcp ×2
cors ×1
marklogic-7 ×1
search ×1
sparql ×1
tableau-api ×1
xml ×1
xquery ×1