Eliot, thanks for the improvement over my original ad hoc idea.
Dirk, part of the background is that the 200 databases might need to be in disparate places rather than sibling folders, in order to comply with certain file access rules of a larger system I'm working within. I actually want to build a single database instead of 200 databases, but to work within that larger system I need to keep certain processes self-contained. My potential workaround is to merge things afterward, outside that system. Don't databases need to be direct child subfolders of the DBPATH folder? I tried experimenting by moving database folders one level deeper under DBPATH, and then when I try to open a database, BaseX complains that the inf.basex file cannot be found.
Cheers, Amanda
-----Original Message----- From: Dirk Kirsten [mailto:dk@basex.org] Sent: Friday, July 24, 2015 4:40 PM To: Eliot Kimber ekimber@contrext.com Cc: Amanda Galtman Amanda.Galtman@mathworks.com; basex- talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Merging databases?
Hello,
I would be interested to know why you want to do that? I could imagine this being relevant when restructuring/refactoring your data, but given that you mention your design, it sounds like it is a recurring occurence. I currently can't imagine why you want to do that, given that you can access as many databases as you want using a single XQuery.
Cheers Dirk
On 07/24/2015 09:40 PM, Eliot Kimber wrote:
If there's to better way you should be able to simply copy the docs without first exporting them:
For $dbname in $dbNames Return Let $docs := collection($dbname) For $doc in $docs db:add($newDbName, $doc, $local:makeNewDocUrl($doc))
Or something close to that
Cheers,
Eliot
Eliot Kimber, Owner Contrext, LLC http://contrext.com
On 7/24/15, 2:30 PM, "Amanda Galtman" <basex-talk-bounces@mailman.uni-konstanz.de on behalf of Amanda.Galtman@mathworks.com> wrote:
Hi,
Is there a simple, fast way to merge databases? For example, suppose I have 200 databases, each with 5 XML documents, and the document paths are unique across all the databases. I want to produce a database containing all 1000 documents.
I looked in the Database Module wiki and nothing jumped out as being uniquely tailored for this task. I¹m sure there is an ad hoc way to do it by looping over the documents in the databases, exporting them, and adding them to the new database. But if that takes the same amount of time as building the 200 databases in the first place, I should change other things about my design to avoid the need to merge databases.
Thanks, Amanda
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22