What would be your recommendation for dealing with compound documents?
Suppose we have a larger work of literature that consists of chapters,
and for some reason we want to store the chapters as different files. A
rationale for splitting the work might be that different persons should
be able to edit two chapters at the same time. There’s a skeleton
document that slurps in the individual chapters, maybe using XInclude or
another linking/transclusion mechanism.
Suppose there’s an XML database that stores a copy of the complete work
and keeps it up to date. And that’s the point: how to implement the
update procedure?
a) Resolve transclusions first, then store whole work as one XML (as a
consequence, every node has the same base URI)
b) Store skeleton and individual chapter files, provide virtual
single-tree view transparently (but each node would still know its base URI)
c) Store skeleton and individual chapter files, leave it to the user (=
xquery programmer) to create a custom transcluder for creating
intermediate compound document instances that may then be queried or
exported
In cases b) and c), if a content unit (chapter) was edited, I’d just
delete the corresponding DB item and add the changed file to the DB. In
case a), I’d either reassemble the compound work and replace the
probably large XML file in the DB with a new one (probably an expensive
operation), or I’d replace the corresponding content via XQUF (requires
that I’m able to precisely locate where the altered snippet was in the
compound document).
So if fine-granular file-based storage was a requirement, what would you
do in order to index the content in BaseX? I think b) is desirable, but
not implemented. Maybe you even know a method d)?
Gerrit