Marklogic : Multiple XML files created on document on importing a csv. How to get root Document URI path?

Deadly 提交于 2019-12-12 19:15:15

问题


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?


回答1:


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")



回答2:


The answer does not work because your sample did not include the recommended command option

 -filename_as_collection 

Not to be found in:

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'


来源:https://stackoverflow.com/questions/36698593/marklogic-multiple-xml-files-created-on-document-on-importing-a-csv-how-to-ge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!