[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Reserved namespaces, and QNames as extension keywords

G. Ken Holman gkholman at CraneSoftwrights.com
Mon Apr 20 19:47:08 PDT 2009


  Reserved namespaces
At 2009-04-20 15:29 -0700, Pavel Minaev wrote:
>I have two questions regarding implementation conformance to the XQuery spec.
>
>1) The spec requires every module and schema to be associated with a
>namespace, and seemingly doesn't restrict the value domain for such
>namespaces (except for restricting clashes between several
>modules/schemas imported within a single query).

Correct.  A namespace is just a URI string and there are no 
constraints on the strings based on module importation.

>Can an XQuery
>implementation go further than that, and reserve specific namespaces
>for its own use, not allowing programmer to define his modules and
>schemas within that namespace at all? (but, e.g., providing some
>additional predefined types available from such namespaces without any
>"import schema" declarations).

Not that I know of from my read of the specification.

>2) Assuming the answer to #1 is true, is it legal for a conforming
>XQuery implementation to use QNames from such a reserved namespace as
>"keywords" (i.e. syntax elements for extension language constructs),

The only expression extension allowed is the pragma and the pragma 
only has influence over its associated expression:

   (# pragma here #) { (:associated expression here:) }

>without fear of clashing with future XQuery versions?

It is not possible to define one's one keywords so there is no risk 
of name collision.

>I.e. something along the lines of:
>
>   declare namespace ext = "...";
>
>   declare variable $f
>   as ext:function(xs:integer, xs:integer => xs:integer) (* custom type
>keyword *)
>   := ext:lambda($x as xs:integer, $y as xs:integer) as xs:integer { $x
>+ $y } (* custom syntactic construct *)

For future reference, the comment facility uses "(: comment :)" syntax.

>I am aware of pragmas and "declare option", but, obviously, they are
>much more limited - in example above, ext:lambda could possibly be a
>pragma, though that would complicate nesting; but I don't see any way
>to use extensibility mechanisms explicitly spelled out in XQuery spec
>for something like ext:function.

It is unclear to me what benefit or feature you are trying to get 
with the ability to declare keywords.  How are keywords better than 
function calls?  What problem are you trying to solve?

>If the existing spec explicitly disallows such things, then I would
>like to propose enabling them in future XQuery versions; maybe with a
>new special construct to declare such "extensibility" namespaces for
>extra clarity, e.g.:
>
>   declare extension namespace ext = "...";

To address what use case that is not already addressed by the language?

You've asked a lot of "is there?" questions but I don't see a lot of 
"my problem" statements to be addressed.

I hope this helps.

. . . . . . . . . . Ken

--
XQuery/XSLT/XSL-FO hands-on training - Los Angeles, USA 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:http://x-query.com/mailman/listinfo/talk
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/q/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/q/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal



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
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-2007 All Rights Reserved.