Databases Reference
In-Depth Information
People
Person
Person
Person
id
FirstName
Address
123
Dan
CityName
Minneapolis
StateCode
MN
Street
SteetNumber
107
StreetName
Main
Figure 4.23 How a document path is used like a key to get the value out of a
specific cell in a document. In this example, the path to the street name is
People/Person[id='123']/Address/Street/StreetName/text() .
4.4.4
Document store APIs
Each document store has an API or query language that specifies the path or path
expression to any node or group of nodes. Generally, nodes don't need to have dis-
tinct names; instead, a position number can be used to specify any given node in the
tree. For example, to select the seventh person in a list of people, you might specify
this query: Person[7] . Figure 4.23 is a more complex example of a complete path
expression.
In figure 4.23 you begin by selecting a subset of all people records that have the
identifier 123. Often this points to a single person. Next you look in the Address sec-
tion of the record and select the text from the Address street name. The full path name
to the street name is the following: People/Person[id='123']/Address/Street/
StreetName/text() . If you think this seems complicated, know that path expressions
are simple and easy to learn. When looking for something, you specify the correct
child element down a path of the tree structure, or you can use a where clause, called
a predicate , at any point in the path expression to narrow down the items selected.
We'll discuss more on using the World Wide Web standard for selecting a path
using the XPath language in the next chapter.
4.4.5
Document store implementations
A document store can come in many varieties. Some are based on simple serialized
object trees and some are more complex, containing content that might be found in
web pages with text markup. Simpler document structures are often associated with
serialized objects and may use the JavaScript Object Notation ( JSON ) format. JSON allows
Search WWH ::




Custom Search