Databases Reference
In-Depth Information
W ORKING WITH FLEXIBLE DATABASES
XML databases are designed to be flexible with the amount of data stored in a collec-
tion or XML file. They work equally well if you have a single file with 10,000 sales trans-
actions or 10,000 individual transaction files. The query you write won't need to be
changed if you alter how the files are grouped as long as you reference the root collec-
tion of your documents.
There are some design considerations to think about when you're performing
concurrent reads and writes on a document collection. Some native XML databases
only guarantee atomic operations within a single document, so placing two different
data elements that must be consistent within an single document might be a good
practice. For example, a sales order might have both the individual line item amounts
and the sales order total within the same XML document. When the document is
updated, all numbers will be updated in a consistent state.
You may also want to use a database lock on a document or a subdocument to pre-
vent other processes from modifying it at critical times. This feature is similar to the
file locks that are performed on a shared file in a filesystem. For example, if you're
using a forms application to edit a document, you may not want someone else to save
their version over your document. Locking a document helps you avoid conflicts
when multiple people attempt to edit the same document at the same time. You can
also calculate hash tags on a document as you load it into an editor to verify that it
hasn't been modified by someone else while you've been editing it. This strategy and
the use of HTTP ETags help you avoid the missing updates problem: when two users
open the same file and changes from user 1 are overwritten by user 2.
S TORING DOCUMENTS OF DIFFERENT TYPES
Native XML database collections can be used as a “primary taxonomy” to store docu-
ments of different types. This is similar to the categorization of a book in a library where
the topic is found according to its primary subject. But unlike a physical topic, a docu-
ment can contain many different category elements and thus doesn't have to be copied
or moved between collections. An XML document can contain keywords and category
terms that allow search tools to find documents that fit multiple subject categories.
G ROUPING DOCUMENTS BY ACCESS PERMISSIONS
Collections can also be used as a way to group documents according to who can access
them. You may have an internal policy that only allows users with a particular role to
modify a document. Some native XML systems provide basic UNIX -style permissions
on each collection to allow specific groups write access. The UNIX -style permissions
result in a fast calculation of which users have access to a document.
The disadvantage of using UNIX -style permissions is that only a single group can be
associated with a collection. Other native XML collection management systems add
more flexible access control lists to protect each collection according to multiple
groups or roles. Role-based collection management is the most robust permission sys-
tem and is preferred by large organizations with many concurrent users from multiple
business units. Unfortunately, only some native XML databases support role-based
access control.
Search WWH ::




Custom Search