[xquery-talk] How do different XQuery products implement modules?

Christian Gruen christian.gruen at gmail.com
Thu Oct 16 02:00:27 PDT 2008

Hi Michael,

some comments regarding the module implementation in BaseX:

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

  ..the module URI is handled as a simple URI instance without special
  semantics (non-empty, differing from the XML namespace, ..)

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


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


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

  ..no; only coders accessing can do so.

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

  ..similar to the doc(..) function.

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

  ..they are all sequentially parsed.

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

  ..the known location URIs are skipped.

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

  ..again, the known location URIs are skipped.

>    6b. specifying different location URIs

  ..if the resulting modules have different contents, everything
  works fine - see 2) - otherwise, an error will be thrown because
  of duplicate function/variable declarations.

>    6c. without specifying a location URI

  ..an error will be thrown - see 3)

> 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?

  ..all imports share the same instance.

Hope this helps,


More information about the talk mailing list