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

How do different XQuery products implement modules?

Makoto YUI yuin405 at gmail.com
Thu Oct 16 17:36:54 PDT 2008


  How do different XQuery products implement modules?
Hi Michael,

Some comments regarding the work-in-progress module implementation
in XBird.

> 1. Is the module URI just an arbitrary character string, or does it have any
> semantics?

A module URI represents generic URI reference defined by RFC 2396 [1].

[1] http://www.ietf.org/rfc/rfc2396.txt

>    1a. In particular, is it the location of a resource on the web?

Possibly.

> 2. Do you allow several different modules in the same query to have the same
> module URI?

Not allowed. It causes a static error "err:XQST0047".

http://www.w3.org/TR/xquery/#ERRXQST0047

>    2a. if so, can different "import module" declarations import different
> subsets of these?

<skip>

> 3. Can users import a module without specifying a location URI? If so, how
> is the module located?

At least one URIs are required due to [2].

[2] http://www.w3.org/TR/xquery/#doc-xquery-ModuleImport

> 4. If import module specifies a location URI, is it used, and if so how?

(1) Connected to the remote object that the URI locates.
(2) Read and parse the object.

> 5. If import module specifies more than one location URI, how are they used?

Currently, only the first one is used.

It would be better to use the first 'live' remote resource.

>    5b. If multiple location URIs are allowed, what happens if
>    import module specifies the same location URI more than once?

<skip>

> 6. What happens when two modules A and B both import module URI M
> 
>    6a. specifying the same location URI

[6a-1] When same target namespaces (module URIs) are specified.

See 2.

[6a-2] When distinct target namespaces (module URIs) are specified.

The resource that a location URI specifies might be a dynamic content.
Thus, child modules are individually parsed and imported to the parent
module.

As a consequence, it often follows an error (err:XQST0049 or
err:XQST0034) for *static* contents.

http://www.w3.org/TR/xquery/#ERRXQST0049
http://www.w3.org/TR/xquery/#ERRXQST0034

Skip loading a module on same location may be preferred.

>    6b. specifying different location URIs

6b turns into the same result to 6a.

>    6c. without specifying a location URI

As written in 3 and 1.

> 7. Is it possible (by means of multiple imports) to create two different
> "instances" of the same module in a query, with distinct values of global
> variables, or do all imports get the same instance with a common set of
> variables?

Possible if the target namespaces differ.
But it is practically impossible because a library module must have
a namespace URI that is the same as the target namespace [3,4].

[3] http://www.w3.org/TR/xquery/#doc-xquery-ModuleDecl
[4] http://www.w3.org/TR/xquery/#ERRXQST0048

What a wired behavior that does not actually allow loading a module
multiple times :-{

I think simply allowing users to override a module URI
with a target namespace makes it (both behavior conceptually) possible.
#Of course, topic 7 closely related to topic 2 and 6a-2.


Hope this helps,
Makoto YUI

-- 
XBird - Light-weight XQuery processor and XML database system
written in Java. http://code.google.com/p/xbird/


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