[sc34wg3] TMQL: Scope and tuple sequences

Robert Barta rho at devc.at
Fri Nov 9 12:59:15 EST 2007


On Fri, Nov 09, 2007 at 10:41:43AM -0500, Patrick Durusau wrote:
> >would tend more to have the query author be fully in charge, i.e. the
> >language should allow/force to be VERY EXPLICIT _what_ should happen:
> >
> >  
> I assume the same answer to the earlier question about sorting?
> That is that sorting must be explicitly defined for any query result?

Yup.

By default, no ordering of results (be they tuples, XML fragments, ...)
is done. The query

   select $p / shoesize
   where
      $p isa person

returns something like

   [
     "42"^^xsd:integer,
     "42"^^xsd:integer,
     "41"^^xsd:integer,
     "43"^^xsd:integer,
    ]

If this unordered sequence is to be sorted according to a particular
criterion, then one has to say so:
     
   select $p / shoesize
   where
      $p isa person
   order by $p / shoesize

There is a lot of subtleness in ordering, though. For details please
refer to

   http://kill.devc.at/system/files/language.html#id2482521

The "unordered and ordered sequence" stuff we got from XQuery/XPath 2.0.
I think these guy have done it right.

\rho


More information about the sc34wg3 mailing list