RE: Sequence type and other related questions

XPath's type inference rules are the same as XQuery's and are also
described in the Formal Semantics spec.

Best regards
Michael

> -----Original Message-----
> From: www-ql-request@w3.org [mailto:www-ql-request@w3.org] On Behalf
Of
> Paul Duffin
> Sent: Tuesday, July 15, 2003 9:18 AM
> To: Torsten Grust
> Cc: www-ql@w3.org
> Subject: Re: Sequence type and other related questions
> 
> 
> Torsten,
>      It does a little.
> 
> I am more interested in the usage of this within XPath than in XQuery.
I
> am not sure whether this mailing list is the right one to use it is
just
> it is referred to from the same page that refers to the XPath/XQuery
> model and functions / operators.
> 
> I cannot find anything within the XPath specifications that relate to
> this. The closest I found was the SequenceType but that does not
appear
> to match what you describe below.
> 
> Torsten Grust wrote:
> > Paul,
> >
> >   does the following help?
> >
> > On July 15 (11:03 +0100), Paul Duffin wrote with possible deletions:
> > |
> > | The section on sequences
> > | (http://www.w3.org/TR/xpath-datamodel/#sequences) states that a
> sequence
> > | that contains a single item is indistinguishable from the item
itself.
> > | Among other things this means that a sequence with one item in it
has
> > | the same type as that item. Therefore sequences must have types.
> > |
> > | This raises a couple of questions.
> > |
> > | What is the type of a sequence with two (or more) items in it
which
> are
> > | potentially different ?
> > |
> > | Is it just a generic sequence type, is it the type which is the
> closest
> > | ancestor of all the item types, or something else ?
> >
> > For two items x and y of types s and t, respectively, the sequence
> > value (x,y) has type s,t.  Note that (.,.) (the ``comma'') is used
as
> > a binary type constructor in forming the type s,t.
> >
> > As a derivation rule:
> >
> >                     E |- x:s   E |- y:t
> >                    ---------------------
> >                      E |- (x,y) : s,t
> >
> >
> > What you refer to above (``closest ancestor'') might be related to
> > approximations of such sequence types:
> >
> > The XQuery Formal Semantics sometimes compute (more or less rough)
> > approximations of these types (e.g., during the typing of a
for-bound
> > variable).   An approximation of the type  s,t  is
> >
> >                               (s | t)+
> >
> > computed as
> >
> >                         prime (s,t) quantifier (s,t)
> >                         \_________/ \______________/
> >                           = s | t        = +
> >
> > Note that information about the order of s and t in the original
type
> > as well as information about the exact number of occurrences of s
and
> > t in the original type are lost.  We do however have
> >
> >                             s,t <: (s | t)+
> >
> > which ensures that typing the rest of program using the
approximation
> > is safe.
> >
> > | What is the type of an empty sequence ?
> >
> > The type of the empty sequence is the special type empty.
> >
> >
> > Greetings,
> >    --Torsten
> >
> > --
> >   | Dr. Torsten Grust                          Torsten.Grust@uni-
> konstanz.de |
> >   |                                   http://www.inf.uni-
> konstanz.de/~grust/ |
> >   | Database Research Group, University of Konstanz (Lake
> Constance/Germany) |
> >   |             (Please avoid sending me MS Word or PowerPoint
> attachments.) |
> 
> 

Received on Tuesday, 15 July 2003 12:21:16 UTC