简体   繁体   中英

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

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

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM