[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Are we losing out because of grammars?

  • From: Joe English <jenglish@f...>
  • To: xml-dev@l...
  • Date: Mon, 29 Jan 2001 08:49:32 -0800

sql iff

Rick Jelliffe wrote:

> P.S. If anyone knows any good website on term rewriting that list rules for
> regular expressions -> paths of some kind, I would be very interested.

I don't know if this is quite what you're looking for,
but if you interpret XPath axes, name tests, and node tests 
as relations and add a relational transitive closure operation,
you end up with a very nice query/pattern matching framework.

For example, if 'x' and 'y' are nodes, then the relational
expression 'x (child) y' holds iff y is a child of x.
The infix '/' operator is the same as relational composition:
x (axis1/axis2) y iff there exists z such that x (axis1) z and
z (axis2) y.

Name tests and node tests are "coreflexive" relations;
for example 'x (element) y' holds iff x = y and x is an
element node.  Then the '::' in 'axis::node-test' can
also be interpreted as relational composition.  Other
XPath predicates -- as long as they don't involve
'position()' or 'last()' -- can be dealt with the same way.

It helps to add a few "single-step" axes 'x (right) y' ===
'y (left) x' === y is the next sibling of x, and
'x (down) y' === 'y (up) x' === y is the first child of x.
('right' and 'down' are the same as 'following-sibling::*[1]'
and 'child::*[1]', but it helps to add them as primitives
since the implied call to 'position()' in the predicate '[1]'
is a real bastard to work with in a relational framework.)

XML DTD content models map directly onto this framework:
content particles are predicates (coreflexives), "|" is relational
union, "x,y" becomes "x/right/y", "x*" is relational transitive
closure, and "x?" becomes "(x | id)" where "id" is the
identity relation.

It's not hard to add an "interleave" operator a la TREX;
this gives you unordered content models.  The TREX "concur"
operator is just relational intersection; this is easy
to deal with mathematically (but can be more difficult to
implement).  And, since you also have the other axes to
work with, this significantly extends the expressive power 
of content models.

I've built a toy XML processing library in Tcl (similar to Cost)
based on this framework, and it works pretty well.


--Joe English

  jenglish@f...

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.