Hi all,

I threw this together yesterday. and figured I'd share it with the
group.


Random Notes and Thoughts on XML Update Langauge
================================================
Tom Bradford - September 26, 2000


This paper represents personal ramblings based on about an hour of
work that I did developing a schema for a minimal XML database query
and update language.  Don't assume that this is what I'm proposing
be our ultimate solution, it's just a bit of research.


What an XML Update Language SHOULD BE:
--------------------------------------

   - A simple, yet powerful query, aggregation,  and update language
     for XML repositories.
   - Implementation agnostic.  We should not define how and where a
     repository stores its data.
   - A framework for querying and building document sets in disparate
     locations.
   - A harness for executing implementation-specific logic.
   - Built on top of existing W3C standards like XPath and XPointer.
   - Open to future extensibility.


What an XML Update Language SHOULD NOT BE:
------------------------------------------

   - A swiss-army knife that tries to be everything to everyone.
   - A transformation language like XSLT (been done).
   - A document-centric query language like XQL or XPath (been done).
   - Designed specifically favoring a vendor's current implementation.
     (Unless that implementation meets every proposed requirement)
   - Designed dependant on a XML object or parser model (DOM, SAX).


XML Update Language Implementations MUST:
-----------------------------------------

   - Provide a minimal set of standardized base logic as determined by
     the XML:DB initiative.  This logic includes string, math, and
     date manipulation routines.


Schema Elements:
----------------

query:
   query is the top level element of any XML query.  A query must
   contain at least 1 element, logic, or xml tag to be considered
   valid.

param:
   param defines a query parameter.  Query parameters can be
   considered macros in query executive.  A param can either be
   defined as a static value or as a required provided value from
   the querying interface.

element:
   element defines an output element.  Elements are typically
   aggregated from data sources in the XML repository.  An element can
   also nest other elements, attributes (for that specific element),
   logic and pass through xml.

attribute:
   attributes add attribute information to an element tag.  These
   attribute values can be static, or they can be aggregated from data
   sources in the XML repository.

logic:
   logic provides base or implementation specific logic.  The type of
   logic that is performed is based on the logic class that is
   provided.  A class matching "http://xmldb.org/logic"; represents
   base XML Update logic.

xml:
   xml allows well-formed, static XML data to be embedded into the
   output.

update:
   update performs an update against the query output as that data
   that will be updated.  The target defines where in the document set
   that the update should occur.

delete:
   delete performs a delete against the specified target, potentially
   using the query output as the constraining data in performing the
   delete.

insert:
   insert performs an insert operation against the specified target,
   using the query output as the data to be inserted.

where:
   where narrows the input document set for the query operation that
   will be performed.  Operations in the where section are implicitly
   ANDed.

match:
   match narrows the input document set based on the validity of the
   provided XPath expression.

or, not:
   Are all logical operators used in performing match operations. The
   'and' operator is implicit.

exists:
   Checks that the specified target node exists.


Given my current schema:
------------------------

<query>
   <element name="output"
            source="local/cart/addresses"
            xpath="/address" />
   <where>
      <match target="local/cart/addresses"
             xpath="/[EMAIL PROTECTED]'Tom Bradford'" />
      <not>
         <match target="local/cart/addresses"
                xpath="/[EMAIL PROTECTED]'vacation']" />
      </not>
   </where>
</query>


This query retrieves all address elements in the addresses collection
(dbXML) where the name attribute on the address is 'Tom Bradford' :),
and the type attribute on the address is NOT 'vacation'.  The name
match could have been performed in the element XPath as well, but for
consistency, I included it in the where section.  Also...  The target
attributes in the where section are optional if only one source is
being queried from.


Output might be:
----------------

<output>
   <address name="Tom Bradford" type="home">
      <address1>1234 West Black Road</address1>
      <city>Mesa</city>
      <state>AZ</state>
      <postal>85205</postal>
   </address>
   <address name="Tom Bradford" type="work">
      <address1>6900 East Camelback Road</address1>
      <address2>Suite 700</address2>
      <city>Scottsdale</city>
      <state>AZ</state>
      <postal>85251</postal>
   </address>
</output>
<?xml version ="1.0"?>
<!--Generated by XML Authority. Conforms to w3c http://www.w3.org/1999/XMLSchema-->
<schema xmlns = "http://www.w3.org/1999/XMLSchema";>
	<element name = "query">
		<complexType content = "elementOnly">
			<sequence>
				<element ref = "param" minOccurs = "0" maxOccurs = "unbounded"/>
				<choice>
					<element ref = "element"/>
					<element ref = "logic"/>
					<element ref = "xml"/>
				</choice>
				<element ref = "where" minOccurs = "0" maxOccurs = "1"/>
				<choice minOccurs = "0" maxOccurs = "1">
					<element ref = "update"/>
					<element ref = "insert"/>
					<element ref = "delete"/>
				</choice>
			</sequence>
		</complexType>
	</element>
	
	<element name = "update">
		<complexType content = "empty">
			<attribute name = "xpath" type = "string"/>
			<attribute name = "target" type = "string"/>
			<attribute name = "validate" use = "default" value = "true" type = "boolean"/>
		</complexType>
	</element>
	
	<element name = "insert">
		<complexType content = "empty">
			<attribute name = "xpath" type = "string"/>
			<attribute name = "target" type = "string"/>
			<attribute name = "validate" use = "default" value = "true" type = "boolean"/>
		</complexType>
	</element>
	
	<element name = "delete">
		<complexType content = "empty">
			<attribute name = "xpath" type = "string"/>
			<attribute name = "target" type = "string"/>
			<attribute name = "validate" use = "default" value = "true" type = "boolean"/>
		</complexType>
	</element>
	
	<element name = "element">
		<complexType content = "elementOnly">
			<choice minOccurs = "0" maxOccurs = "unbounded">
				<element ref = "attribute"/>
				<element ref = "element"/>
				<element ref = "logic"/>
				<element ref = "xml"/>
			</choice>
			<attribute name = "xpath" type = "string"/>
			<attribute name = "name" type = "string"/>
			<attribute name = "recursive" use = "default" value = "true" type = "boolean"/>
			<attribute name = "source" use = "required" type = "string"/>
			<attribute name = "replace" use = "default" value = "false" type = "boolean"/>
		</complexType>
	</element>
	
	<element name = "attribute">
		<complexType content = "empty">
			<attribute name = "xpath" type = "string"/>
			<attribute name = "name" type = "string"/>
		</complexType>
	</element>
	
	<element name = "param">
		<complexType content = "empty">
			<attribute name = "name" type = "string"/>
			<attribute name = "value" type = "string"/>
		</complexType>
	</element>
	
	<element name = "logic">
		<complexType content = "textOnly">
			<attribute name = "name" type = "string"/>
			<attribute name = "source" use = "required" type = "string"/>
			<attribute name = "replace" use = "default" value = "false" type = "boolean"/>
			<attribute name = "class" use = "default" value = "http://xmldb.org/logic"; type = "string"/>
		</complexType>
	</element>
	
	<element name = "xml">
		<complexType content = "textOnly">
			<attribute name = "name" type = "string"/>
			<attribute name = "replace" use = "default" value = "false" type = "boolean"/>
		</complexType>
	</element>
	
	<element name = "match">
		<complexType content = "empty">
			<attribute name = "xpath" type = "string"/>
			<attribute name = "target" type = "string"/>
		</complexType>
	</element>
	
	<element name = "or">
		<complexType content = "elementOnly">
			<choice minOccurs = "0" maxOccurs = "unbounded">
				<element ref = "match"/>
				<element ref = "or"/>
				<element ref = "not"/>
				<element ref = "exists"/>
			</choice>
		</complexType>
	</element>
	
	<element name = "not">
		<complexType content = "elementOnly">
			<choice minOccurs = "0" maxOccurs = "unbounded">
				<element ref = "match"/>
				<element ref = "or"/>
				<element ref = "not"/>
				<element ref = "exists"/>
			</choice>
		</complexType>
	</element>
	
	<element name = "exists">
		<complexType content = "empty">
			<attribute name = "xpath" type = "string"/>
			<attribute name = "target" type = "string"/>
		</complexType>
	</element>
	
	<element name = "where">
		<complexType content = "elementOnly">
			<choice minOccurs = "0" maxOccurs = "unbounded">
				<element ref = "match"/>
				<element ref = "or"/>
				<element ref = "not"/>
				<element ref = "exists"/>
			</choice>
		</complexType>
	</element>
	
</schema>
begin:vcard 
n:Bradford;Tom
tel;fax:(480) 947-2280
tel;home:(480) 654-4134
tel;work:(480) 421-1233
x-mozilla-html:FALSE
url:http://www.dbxmlgroup.com/bradford.html
org:<b>The dbXML Group, L.L.C.</b>;<a href="http://www.dbxmlgroup.com/";><img src="http://www.dbxmlgroup.com/images/dbxmllogo.gif"; border="0"></a>
version:2.1
email;internet:[EMAIL PROTECTED]
title:Chief Software Architect
adr;quoted-printable:;;6900 East Camelback Road=0D=0ASuite 700;Scottsdale;AZ;85251;USA
x-mozilla-cpt:;31264
fn:Tom Bradford
end:vcard

Reply via email to