小编Hug*_*ans的帖子

mlcp将csv文件转换为OBI源

我有以下挑战.我们有想要使用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)

marklogic marklogic-8 mlcp

5
推荐指数
1
解决办法
214
查看次数

如何在R-studio中编织希腊符号以生成pdf

我正在与R studio markdown和knitr合作,这些都很棒.

我似乎无法将希腊符号编织成pdf.

相同的Rmd文件:

---
title: "Untitled"
author: "Hugo Koopmans"
date: "11-01-2015"
output: pdf_document
---


Test Greek symbol
----------------

P-value
In statistics, the p-value is a function of the observed sample results (a statistic) that is used for testing a statistical hypothesis. Before performing the test a threshold value is chosen, called the significance level of the test, traditionally 5% or 1% [1] and denoted as ?. If the p-value is equal or smaller than the significance level (\alpha) …
Run Code Online (Sandbox Code Playgroud)

pdf-generation r tex pandoc knitr

4
推荐指数
1
解决办法
9242
查看次数

关于分析器结果的Marklogic查询优化

你好MarkLoggers在那里,

我再次向你提问!我有一系列包含邮政编码信息的文件.400.000个文档.文档按文档订购一个邮政编码,每个文档包含400个功能,按类别和变量排序,如下所示:

<postcode id="9728" xmlns="http://www.nvsp.nl/p4">
<meta-data>
<!--
Generated by DIKW for NetwerkVSP ST!P
-->
<version>0.3</version>
<dateCreated>2014-06-28+02:00</dateCreated>
</meta-data>
<category name="Oplages">
<variable name="Oplage" updated="2014-08-12+02:00">
  <segment name="Bruto">1234</segment>
  <segment name="Stickers">234</segment>
  <segment name="Netto">1000</segment>
  <segment name="Aktief">J</segment>
</variable>
</category>
<category name="Automotive">
<variable name="Leaseauto">
<segment name="Leaseauto">2.68822210725987</segment>
</variable>
<variable name="Autotype">
<segment name="De Oudere Stadsrijder">4.61734781858941</segment>
<segment name="De Dure Tweedehandsrijder">6.02534919813761</segment>
<segment name="De Autoloze">41.187790998448</segment>
<segment name="De Leasende Veelrijder">0.608035868253147</segment>
<segment name="De Modale Middenklasser">13.1996896016555</segment>
<segment name="De Vermogende Autoliefhebber">4.45283669598206</segment>
<segment name="De Vermogende Kilometervreter">2.07690981203656</segment>
<segment name="De Doelmatige Budgetrijder">17.2048629073978</segment>
<segment name="De Doorsnee Nieuw Kopende Automob">10.1595102603897</segment>
</variable>
... …
Run Code Online (Sandbox Code Playgroud)

performance xpath xquery marklogic

3
推荐指数
1
解决办法
311
查看次数

MarkLogic 8用户名和角色中允许哪些字符?

我尝试使用等于电子邮件地址("demo@wildspaces.com")的用户名在MarkLogic中设置用户,似乎我可以创建用户但不能创建相应的角色.

我创建了用户,但是当我想添加一个角色时,就像这样:

sec.userAddRoles(user,role)
Run Code Online (Sandbox Code Playgroud)

这给出了一个错误:

2016-03-11 20:00:48.820 Notice: api-cluey-app: in /v1/projects.sjs, at 182:26, in projPost() [javascript]
2016-03-11 20:00:48.820 Notice: api-cluey-app: in [anonymous], at 1:67,
2016-03-11 20:00:48.820 Notice: api-cluey-app: in xdmp:eval("declareUpdate(); var sec = require('/MarkLogic/security.xqy'); s...", {role:"scc-proj-8327360-owner", user:"bill@wildspaces.com"}, {isolation:"different-transaction", userId:"11821709629759202109", database:"17312114676051821586"}) [javascript]
2016-03-11 20:00:48.820 Notice: api-cluey-app: in /v1/projects.sjs [javascript]
2016-03-11 20:00:48.820 Notice: api-cluey-app: in /v1/projects.sjs [javascript]
2016-03-11 20:00:49.416 Info: api-cluey-app: Status 500: XDMP-LEXVAL: sec:role-name("bill@wildspaces.com") -- Invalid lexical value "demo@wildspaces.com"
Run Code Online (Sandbox Code Playgroud)

如果我试着查看管理员安全数据库,它会变得更糟:

You've encountered an error in the server. If you have a maintenance …
Run Code Online (Sandbox Code Playgroud)

marklogic

3
推荐指数
1
解决办法
82
查看次数

ggplot geom_bar如果值高于阈值,我可以突出显示不同颜色的条

我使用ggplot和geo_bar来生成一个图,结果如下:

在此输入图像描述

# Faceting is a good alternative:
ggplot(df.cnts, aes(x=date,y=freq)) + geom_bar(stat="identity") +
  facet_wrap(~ operator, nrow = 3) +
  theme(axis.text.x  = element_text(angle=90, vjust=0.5, size=8))
Run Code Online (Sandbox Code Playgroud)

我可以使用代码来为值大于1000的所有条形图着色.

谢谢

r ggplot2 geom-bar

2
推荐指数
1
解决办法
5382
查看次数

如何将JSON文档集合作为JSON数组返回

我在MarklLogic中有一组JSON文档,我希望将其作为JSON数组返回到API调用.

fn.collection('my-users')
Run Code Online (Sandbox Code Playgroud)

返回一系列JSON文档,我需要一个有效的JSON对象,一个数组.我在服务器端java脚本中执行此操作,推送到新的空数组().

据我所知,没有真正的示例文档,仅在XQuery中有一些例子.Google 在这里一直提到这个非常高级的文档

var myArray = [];

for (d of fn.collection('my-users')){
  myArray.push(d);
}

myArray
Run Code Online (Sandbox Code Playgroud)

我是否需要遍历序列中的每个项目以推送到阵列或是否有更优雅/更快的解决方案?

雨果

json marklogic serverside-javascript

2
推荐指数
1
解决办法
263
查看次数

选择数据帧的一列将返回一个因子,而不是另一个数据帧

我有下面的代码,如果m == 2则cd仍然是数据帧,而名称(cd)来自原始数据帧d.但是,如果m == 3,则数据帧中只有一列仍然存在而cd变为一个因子而我丢失了名称......

samplesize <-100
g1 <- gl(2,samplesize/2,labels=c("V","M"))
g2 <- gl(3,samplesize/3,labels=c("V","M","U"))
m <- 2
d <- data.frame(g1,g2)
l <-  sapply(d,nlevels)
cd <- d[,l <= m]
names(cd)
Run Code Online (Sandbox Code Playgroud)

即使过滤器只留下一列,我还想保留d的名称?

r dataframe r-factor

1
推荐指数
1
解决办法
129
查看次数

如何使用 python 请求发布 JSON/xml 文件的多部分列表

在 python2.7 中,我用来requests与 REST 端点进行通信。我可以向其中上传单个 JSON 和 xml 对象。为了加快速度,我想使用 multipart 上传多个 json 对象。

我有一个curl 命令,它展示了如何完成它并且它是有效的。我需要在 python requests POST 命令中翻译它。

工作卷曲杆:

curl --anyauth --user admin:admin -X POST --data-binary \@sample-body \
     -i -H "Content-type: multipart/mixed; boundary=BOUNDARY" \
     "http://localhost:8058/v1/resources/sight-ingest?rs:transform=aireco-transform&rs:title=file1.xml&rs:title=file2.xml&rs:title=file3.xml"
Run Code Online (Sandbox Code Playgroud)

需要注意的是:我需要发送自定义参数列表,包括“标题”参数列表,不能通过传递字典来做到这一点吗?但我们可以解决这个问题。

我的蟒蛇足迹:

import requests
files = {'file1': ('foo.txt', 'foo\ncontents\n','text/plain'), 
          'file2': ('bar.txt', 'bar contents', 'text/plain'),
          'file3': ('baz.txt', 'baz contents', 'text/plain')}

headers = {'Content-Type': 'multipart/mixed','Content-Disposition': 'attachment','boundary': 'GRENS'}
params={'title':'file1','title':'file2','title':'file2'}
r = requests.Request('POST', 'http://example.com', files=files , headers=headers, params=params)
print r.prepare().url
print r.prepare().headers
print r.prepare().body
Run Code Online (Sandbox Code Playgroud)

给我:

http://example.com/?title=file2 …
Run Code Online (Sandbox Code Playgroud)

python python-requests

1
推荐指数
1
解决办法
7575
查看次数

如何在node.js中使用marklogic查询结果

我已经相当粗略地环顾四周,找不到任何关于如何使用node.js中的marklogic模块的查询结果的例子......

大多数示例都会执行结果的console.log(),但是如果我需要查询结果(例如在JSON数组中并稍后使用这些结果,该怎么办?

似乎我在这里缺少一些node.js ascynch东西......

示例:

var marklogic = require('marklogic');
var my = require('./my-connection.js');

var db = marklogic.createDatabaseClient(my.connInfo);
var qb = marklogic.queryBuilder;

db.documents.query(
    qb.where(qb.parsedFrom('oslo'))
).result( function(results) {
  console.log(JSON.stringify(results, null, 2));
});

// I would like to use the results here
// console.log(JSON.stringify(results, null, 2))
Run Code Online (Sandbox Code Playgroud)

现在的问题是我想在稍后的脚本中使用结果对象.我试过使用.then(),或者将它传递给变量并返回该变量但没有运气.

问候,

雨果

marklogic node.js

1
推荐指数
1
解决办法
53
查看次数

REST扩展示例不是xdmp:在调用POST时记录任何内容

我试图通过在XQuery中使用xdmp:log()来调试MarkLogic中的REST扩展.似乎我实际上有一些调用POST调用的问题实际上......?现在有点困惑.

我用的是确切的示例代码从MarkLogic文件在这里

我通过Roxy> deploy> ext安装它

当我查看http:// host:port/v1/config/resources时,就在那里

文档中提供的PUT命令可以工作并返回"完成".

但是我无法获取POST语句来将xdmp:log消息转储到服务器上的errorlog.txt中?

我尝试了几个curl命令:

curl --anyauth --user admin:admin -X POST  http://host:8040/LATEST/resources/example
curl: (52) Empty reply from server
Run Code Online (Sandbox Code Playgroud)

问题:触发示例POST功能的正确curl命令是什么,以便在日志中显示某些内容?

rest post curl marklogic

0
推荐指数
1
解决办法
59
查看次数