[xquery-talk] How do different XQuery products implement modules?
oliver at xqsharp.com
Thu Oct 23 18:11:36 PDT 2008
This is the behaviour of XQSharp:
> 1. Is the module URI just an arbitrary character string, or does it
> have any
The value of the module URI is used only as a namespace.
> 1a. In particular, is it the location of a resource on the web?
If it is, that is irrelevant. Could be used for library documentation.
> 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?
Each "import module" statement can import a subset of the modules in a
allowing access to those functions imported. Checking for XQST0034 and
is performed for each query and only takes into account the modules
> 3. Can users import a module without specifying a location URI? If so,
> is the module located?
The static context allows for a set of location hints to be provided for
given module namespace. These hints are used alongside any given in the
so if no hints are given, then the hints given in the static context are
> 4. If import module specifies a location URI, is it used, and if so how?
The URI is resolved, and the source of the module is retrived from that
> 5. If import module specifies more than one location URI, how are they
Each location hint specifies the location of a module and all the
imported as in the answer to question 4.
> 5b. If multiple location URIs are allowed, what happens if
> import module specifies the same location URI more than once?
The location hints are treated as a set - that is, any repeated URIs are
> 6. What happens when two modules A and B both import module URI M
> 6a. specifying the same location URI
The module is resolved once, and its functions and global variables are
the set available to A and B.
> 6b. specifying different location URIs
Each location URI is loaded as a separate module, and A and B can only
subset of the module they imported. Conflict resolution is only
performed on a
per-module basis, so it is possible for A and B to refer to different
in M with the same name. This allows for modules to be built against
versions of the same library (which may or may not be a good thing).
> 6c. without specifying a location URI
Since the location hints in the static context are added to all library
the sections of the library defined by these modules are accessible to
module that imports that namespace
> 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
All global variables and functions are global to the query. Global
uniquely identified by their name and the location hint of the module
If we were to perform the XPST0034 checking on a per library basis, then
variable would be uniquely identified by its name.
More information about the talk