[XQuery] IBM-XQ-002 - Metadata

XQuery currently lacks a mechanism to return metadata describing the 
persistent objects of interest to its users. While this capability could 
be added to each of the APIs that are designed for XQuery, we suggest that 
it would be better for XQuery to provide this metadata.

SQL defines the Information Schema tables that reflect its metadata. While 
these tables were provided in SQL-92, they have not been widely 
implemented. By the time that they were published, vendors had already 
started defining their own tables and API methods to make this type of 
information available.



XQuery users can make reference to a number of objects in their queries. 
The following table shows each of these objects and describes which 
constructs allow their use.

XQuery object
clause that allows the use of this object
schema
Schema Import in prolog
module
Module Import in prolog
collation
Default Collation Declaration in prolog
OrderModifier in OrderBy Clause
functions such as fn:contains
collection
fn:collection
document
fn:doc


XQuery metadata might be provided by a function, fn:metadata. This 
function would return the descriptions of schemas, modules, collations, 
collections, and documents that are accessible to the issuer of the query. 
A schema would be provided to describe the document or element produced by 
this function. Implementations could provide additional metadata by 
extending the types defined by this schema.

An application might request the entire metadata document, or it might 
operate on it with XQuery to return only part of this metadata.

We recognize that some XQuery implementations are "closed world", with all 
objects of these types registered in a repository of some sort, while 
others are "open world", attempting to resolve URI's across the world wide 
web. We suggest that the objects described by fn:metadata be defined to 
return a subset, possibly an empty subset, of the objects that can be used 
in a query. An open world implementation might return no object 
descriptions at all. 

A user might issue the following query:

        for $c in fn:metadata()//xqm:collection
        return fn:data($c/xqm:collection-uri)

This query might return the following:

        http://www.example.com/xqdb1/employees
        http://www.example.com/xqdb1/divisions
        http://www.example.com/xqdb2/capital-assets
        .
        .
        .


                                                        -- Andrew

--------------------
Andrew Eisenberg
IBM
5 Technology Park Drive
Westford, MA  01886

andrew.eisenberg@us.ibm.com
Phone: 978-399-5158    Fax: 978-399-5117

Received on Tuesday, 20 January 2004 17:08:21 UTC