|
[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?Oliver Hallam oliver at xqsharp.comThu 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 > semantics? 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? Yes. > 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 library allowing access to those functions imported. Checking for XQST0034 and XQST0036 is performed for each query and only takes into account the modules imported. > 3. Can users import a module without specifying a location URI? If so, > how > is the module located? The static context allows for a set of location hints to be provided for any given module namespace. These hints are used alongside any given in the query, so if no hints are given, then the hints given in the static context are used. > 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 location. > 5. If import module specifies more than one location URI, how are they > used? Each location hint specifies the location of a module and all the modules are 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 ignored > 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 added to 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 use the 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 functions in M with the same name. This allows for modules to be built against different 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 imports, the sections of the library defined by these modules are accessible to every 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 > variables? All global variables and functions are global to the query. Global variables are uniquely identified by their name and the location hint of the module that defined them. If we were to perform the XPST0034 checking on a per library basis, then a global variable would be uniquely identified by its name. Oliver Hallam XQSharp.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








