Databases Reference
In-Depth Information
the extraction of the children of a node that are in given positions. Func-
tion last() evaluates to true on the last child of the current node. Function
position() evaluates to true on the node in the evaluation context whose
position is equal to the context position.
Path expressions are also the building blocks of other languages, such as
XQuery [4] that allows to make queries on XML documents through FLWOR
expressions. A FLOWR expression is composed of the following clauses:
FOR declares variables that are iteratively associated with elements in the
XML documents, which are identified via path expressions;
LET declares variables associated with the result of a path expression;
WHERE imposes conditions on tuples;
ORDER BY orders the result obtained by FOR and LET clauses;
RETURN generates the final result returned to the requester.
Example 2. Consider the DTD and the XML document in Example 1. Some
examples of path expressions are the following.
/account operation/operation : returns the content of the operation
element, child of account operation ;
/account operation/@bankAccN : returns attribute bankAccN of element
account operation ;
/account operation//notes : returns the content of the notes el-
ements, anywhere in the subtree rooted at account operation ;in
this case, it returns both /account operation/request/notes and
/account operation/operation/notes ;
/account operation/operation[./type= “bank transfer” ] : returns the
content of the operation element, child of account operation , only if
the type element, child of operation , has value equal to “bank transfer”.
The following XQuery extracts form the XML document in Fig. 1(b) all the
account operation elements with operation type equal to “bank transfer”.
For the selected elements, the amount and the recipient of the operation are
returned, along with all notes appearing in the selected account operation
element.
< BankTransf >
{ FOR $r in document (“update account”) /account operation
WHERE $r /operation/type =“bank transfer”
RETURN $r /operation/amount ,$r /operation/recipient ,$r //notes
} < /BankTransf >
3 XML Access Control Requirements
Due to the peculiar characteristics of the XML documents, they cannot be
protected by simply adopting traditional access control models, and specific
 
Search WWH ::




Custom Search