Marklogic:在导入csv时在文档上创建多个XML文件。如何获取根文档的URI路径? [英] Marklogic : Multiple XML files created on document on importing a csv. How to get root Document URI path?

查看:280
本文介绍了Marklogic:在导入csv时在文档上创建多个XML文件。如何获取根文档的URI路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Marklogic,我试图导入我的CSV文件的10万条记录到Marklogic导入后,我发现它被导入到文档数据库默认情况下。此外,我发现对于每个记录,我看到一个XML文件生成在数据库中增加的数字附加到documentUri,我提到在导入时。例如:documentUri_1.xml。我理解创建多个xml文件以便以分布式方式读取数据。


问题:
1.如何获取此文档的根文档URI?它有多个xml文件?
问题:2.如何将同一个CSV文件导入到不同的数据库?

问题:3.当我使用xquery列出数据库中的所有文档时,我得到所有的xml文件的URI而不是dummy.xml的uri?如何实现这一点?


注意:我使用以下命令导入:

  mlcp.bat import -host localhost -port 8000 -username admin -password admin -input_file_path dummy.csv -mode local -input_file_type delimited_text -uri_id'dummy.xml'$ b $ 

解决方案

问题1)没有这样的东西作为根文档。每个文档都是独立的。但您可以按收藏将文件分组(见下文)。



问题2)使用 -database mlcp选项。



问题3)我想您正在寻找mlcp选项 -filename_as_collection 。这将允许您通过以文件命名的集合来查找文档。例如,在XQuery中:

  collection(dummy.csv)


I am new to Marklogic, I tried to import my CSV files of 100k records to Marklogic and after import, I found it gets imported to Documents Database by default. Also, I found for each records, I see a XML file generated in the database with incremental number appended to the "documentUri" that I mentioned while importing. For Example: documentUri_1.xml. I understands multiple xml files are created inorder to read the data in a distributed manner.

Question: 1. How to get the root document URI for this document? which has multiple xml files? Question: 2. How do i import the same CSV file to a different database?
Question: 3. When I use xquery to list all documents in the database, I am getting all the all xml files URI rather just the dummy.xml uri? How do I achieve this?

Note: I was using following command to import:

mlcp.bat import -host localhost -port 8000 -username admin -password admin -input_file_path dummy.csv -mode local -input_file_type delimited_text -uri_id 'dummy.xml'

Can you someone help me on this?

解决方案

Question 1) There is no such thing as a "root document". Every document stands on its own. But you can group documents together by collection (see below).

Question 2) Use the -database mlcp option.

Question 3) I think you're looking for the mlcp option -filename_as_collection. This will allow you to find documents by a collection named after the file. For example, in XQuery:

collection("dummy.csv")

这篇关于Marklogic:在导入csv时在文档上创建多个XML文件。如何获取根文档的URI路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆