Re: Formal semantics of step expressions

Hi Stijn,

There is a "duality" to the data model in that every element
node has two properties : its children, which is a a sequence
of comment, processing-instruction, and other element nodes, 
and its typed value, which is a sequence of atomic values.
Its typed value is a function of the node's text content and
its type annotation, which it obtains as the result of validation.

So in your example below, child::node() would yield the
text node containing the text "42", i.e.,

text { "42" }

This semantics may not be as clear as it should be in the 
Formal Semantics document.  A better denotation of your example
would be : 

element dummy of type xsd:integer { 
  text { "42" }
}

This makes more clear the duality of the data model -- the <dummy>
element contains a single text node and its type annotation is
xsd:integer.  Its typed value is determined by validating 
its text content according to its type annotation, xsd:integer.
In fact, there is a constraint in the data model that states 
a node's type annotation must be consistent with its content, 
i.e., its content must be valid w.r.t. the type in its annotation 
according to the rules of XML Schema.

Path expressions always yield sequences of nodes, never atomic
values -- this is consistent with the semantics of XPath 1.0
path expressions.  We considered extending the semantics of
XPath 2.0 path expressions to also yield sequences of atomic
values, but after much debate, decided that path expressions
should preserve their original semantics of navigation, selection
and projection (extraction) of nodes in a document.

I hope that helps,
Mary

On Mon, 2003-11-17 at 04:45, Stijn Vansummeren wrote:
> I have a question concerning the XQuery data model (as described in the formal 
> semantics), and the dynamic semantics of step expressions (also as described 
> in the formal semantics).
> 
> Suppose that the variable $dot is bound to the following value:
> 
> element dummy of type T1 {
>        42 of type xs:integer
> }
> 
> What would the result be of child::node()? Is it 42 of type xs:integer or is 
> it the empty sequence? More specifically, what is is value2 in
> 
> dynEnv |- axis child:: of element dummy of type T1 { 42 of type xs:integer } 
> => Value2
> 
> And what is Value3 in 
> 
> dynEnv |- test node() with element of Value2 => Value3
> 
> As far as I can see, the axis judgement only returns element child content in 
> this case, which would result in the empty sequence. Even if it did return 
> the value 42 of type xs:integer, the test judgement would return the empty 
> sequence, since 42 of type xs:integer is an atomic value, not a node. If this 
> reasoning is correct, how would I be able to obtain the entire child value of 
> the value above? 
> 
> Is it true that the dynamic semantics of step expressions cannot handle atomic 
> values, and therefore does not work on the entire data model? Or is atomic 
> data viewed as being a text node when applying a step expression?
> 
> --Stijn Vansummeren
> 
> Limburgs Universitair Centrum
> Universitaire Campus 
> Gebouw D
> 3590 Diepenbeek
> Belgium
-- 
Mary Fernandez <mff@research.att.com>
AT&T Labs - Research

Received on Friday, 28 November 2003 18:11:43 UTC