[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XPath/XQuery - Typed Value Determination


xpath algorithm
* Vladimir Gapeyev <vgapeyev@s...> [2005-10-21 15:52]:
> 
> 
> On Fri, 21 Oct 2005, Alan Gutierrez wrote:
> 
> >* Vladimir Gapeyev <vgapeyev@s...> [2005-10-20 21:54]:
> >>
> >>
> >>On Thu, 20 Oct 2005, Alan Gutierrez wrote:
> >>
> >>>  I'm confused by the wording of...
> >>>
> >>>  http://www.w3.org/TR/xpath-datamodel/#TypedValueDetermination
> >>>
> >>>  ...where it discusses the value value determination for lists.
> >>>
> >>>  "For each of these lexical forms, the type of the corresponding
> >>>  item is found in {item type definition}."
> >>>
> >>>  I can't figure out if the {item type definition} is attached to
> >>>  the list as a property, or an index property, or if it attached
> >>>  to the item within the list. The mention of recursion implies
> >>>  the latter.
> >>
> >>I think one would need a larger quote to understand the question...:
> >
> >   Yes. But, I didn't know what to quote, because I didn't
> >   understand the question myself. :)
> >
> >>Brief answer: {item type definition} is a property of T, the
> >>schema's list _type_ that validated the value in question.  It is
> >>not a property the list _value_.
> >>
> >>One could arrive to this understanding after meditating over WXS Part 2,
> >>4.1.1  http://www.w3.org/TR/xmlschema-2/#rf-defn
> >
> >   Which means that a list defined in this section is a list of
> >   items that are of the same type, right?
> 
> No, if {item type definition} is a union type!

    Vladimir

    Thank you for going into such detail.
    
    I meant that they are all the same type, and that type might be
    a union type, but still all the same type, as indicated by {item
    type definition}. So, maybe not the same type, but {item type
    definition} described every item in the list in some way.

    I was trying to determine if it was...

        element::item-type-definition()
    
    or

        element::item-type-definition(position)

    or

        element::item(position)::item-type-definition()
    
    I'm not trying to quibble. I certinanly did not have the
    understanding of unions that you put forward.

> I guess, one needs an example, but I wouldn't try to reproduce WXS
> syntax, so please be forgiving for that!

    Makes it easier for me, too.

> Suppose you have successfully validated the element
> 
>   <a>2 foo 3.14</a>

> against the schema
> 
>   element a of type T1
>   simple type T1 = list of T2
>   simple type T2 = union of {xs:integer, xs:decimal, xs:string}

> In PSVI, the contents of <a> are typed as T1.

> But according to the above quoted algorithm from XPath / XQuery Data 
> Model, the typed value corresponding to the contents of <a> is the 
> following sequence of annotated values:

>     2 of type xs:integer, "foo" of type xs:string, 3.14 of type xs:decimal

> Note: T2 in this example is the {item type definition} menttioned in the 
> algorithm.

    Thus all items in the list are of the {item type definition}
    type, which in this case is type T2, but there's additional type
    information depending on how the value elements were validated.

    The type you'd do business with can differ among list items,
    when the {item type definition} is a union.

> As I understand this, the algorithm just reconstructs "the basic 
> reasons" why the PSVI has T1 as the annotation on <a>'s contents.
> One reason the algorithm is needed at all, because the names of union 
> types hide these "basic reasons".

    Unions will make more sense when I go back and read through WXS,
    but for now I'm trying to work forward to read the XPath,
    XQuery, and XSLT specifications. I'm not working with WXS yet,
    so I'm not familiar with the "basic reasons", and can't work
    back from them. I'm sure it's blindingly obvious to someone
    who's written schemas.

    Thank you for your help.

--
Alan Gutierrez - alan@e... - http://engrm.com/blogometer/

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.