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

Re: The limitations of XPath and navigation for XML databa

  • From: noah_mendelsohn@u...
  • To: mike@a...
  • Date: Thu, 7 Feb 2008 16:43:27 -0500

Re:  The limitations of XPath and navigation for XML     databa
Michael David writes:

> My definition of procedural and nonprocedural  (or 
> declarative), which I still go by, is that procedural languages
> require the user to specify what data is needed and how to get 
> it, while nonprocedural languages require a user to specifying 
> what data is needed without specifying how to get it. 

Yes, but I think you're misreading XPath.   By that definition, it's 
declarative, though that may not be obvious.   Let's look at a simple 
XPath:

/A/B/C

Someone could have specified the languages as: "First you go to the root, 
then you find an A, then within that you find a B".  That's a procedural 
language, and it's probably how you're thinking about it.  That's not the 
way I look at XPath and I think not the way it's intended to be looked at. 
 I believe that the intended way to think about the same expression is: 
"This expression matches any one or more C's that are within B's that are 
within an A that's an immediate child of the root.

Note that this latter interpretation does >not< tell you how to find them. 
 One obvious way, is to find all the A's, then within that find all the 
Bs, and so on, but there are other implementation strategies.  You might 
read in a whole document, make a hash to find out where all the elements 
are by name, and by the way count the number of occurrences and set up 
parent pointers.  You might notice that while there are 100,000 As, there 
are only 2 Cs.  Using this information, an XPath optimizer might decide to 
go directly to each of the Cs and follow its parent chain to discover 
whether it in fact satisfies the XPath.

I think it's fair to say that this is exactly the sort of optimization 
that's done with SQL.  I believe it's also in the spirit of what's done by 
many optimized XQuery implementations.  I agree with Michael Kay;  XPath 
is declarative in very much the same sense that SQL is.  It does not 
prescribe steps you must take in order -- it specifies declaratively what 
you must find.

Noah

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------






[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.