Hi France,
If you believe that the two functions…
db:open-id($db-name, $doc-id) db:open($db-name)/*[@id=$doc-id]
…should be more or less equivalent, I would tend to stick with the current solution (overriding existing functions with new functionality is often prone to errors). What you can always do is to work with a utility module, which you copy into your BaseX repo directory, and which contains all the functions that you frequently use. Have you considered this option?
Best, Christian
On Thu, Nov 14, 2019 at 3:54 PM France Baril france.baril@architextus.com wrote:
Hi, any chance we could make the db indexed ids match the xml doc ids?
db:open-id() could match the id at the root of then documents (when one is provided) db:node-id() could match other nodes match internal ids (when they are provided). It would make indexing and querying a lot more efficient for any type of navigation/linking purposes.
Options:
I'd suggest that this could be an option that can be turned on/off for each doc level ids and node level ids I'd suggest that node id has the option to be unique within the db or within a document when the value for the entire db would then have to become something like doc-id#node-id to stay unique within the db
Then I can easily imagine also expending to db:save-id to reduce the workload of having to pass through base-uri() once the doc exists in the db under its path
let $db-name := 'en-us' let $doc := db:open-id($db-name, $doc-id) let $new-doc := copy, modify, return copy db:replace-id('en-us', $doc-id, $new-doc)
instead of
let $db-name := 'en-us' let $doc := db:open($db-name)/*[@id=$doc-id] let $new-doc := copy, modify, return copy let $path := substring-after($doc/base-uri(), $db-name) return db:replace($db-name, $path, $new-doc)
Is that something that can be considered?