Hi Jason,
I am currently using BaseX for an XML database. Each XML file currently has a uuid.
If there is not need to preserve the original file names, you could also store the UUID as filename. If you use db:exists($db, $uuid), you will know if your file already exists.
So for example if I ran a test of adding a file to the database and then ran a test to query this file it would be unable to query this file.
I'm not sure if I can follow. Could you possibly provide us with the XQuery expressions you are using?
Christian