XQuery Reflection

September 17, 2008

I have been thinking about this issue for a while in regards to working on a Marklogic as an Xml Platform.  My wish is for an XQuery Reflection functionality that would allow me to inspect module metadata for various programming tasks such as dynamic programming, documentation stubs and plugin modules. So given a module at a specific uri, you could ask for an xml representation of the module in a serialized xml version.

module “urn:my-module”
declare namespace ns1 = http://www.myns.com
declare namespace ns2 = http://www.ns2.com
import module namespace util = “urn:my-utilities” at “../utilities.xqy”

define function map($node as element(ns2:object)) as element(ns1:object)*


Would return:

<namespace-declaration prefix=”ns1″ uri=”http://www.myns.com”/&gt;
<namespace-declaration prefix=”ns2″ uri=”http://www.ns2.com”/&gt;
<module-declaration prefix=”util” uri=”urn:my-utilities” location=”../utilities.xqy”/>
<function name=”map”>
   <return type=”element” prefix=”ns1″ localname=”object” cardinality=”*”/>
   <parameter name=”node” type=”element” prefix=”ns2″ localname=”object” cardinality=””/> 

 Question:  How would anybody else see this being useful?


Get every new post delivered to your Inbox.