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

RE: Annotations in XPath-NG? (Re: XPath/XSLT 2.0 co


2 co element name
This is actually something similar to what I intend to implement over an XML
Repository [probably Xindice].

We have a requirement to be able to; given a node, find all annotations [of
a particular type or matching certain criteria], on that node.

While I want to be able to express this as an Axis in the XPath object
model, I've got a few problems with that:
1.  How do I specify the Annotation context for the annotation axis.  Our
annotations are stored as standoff annotations, and to complicate things
further, may apply to either a single document or a collection of documents.
2.  It's a heck of a lot easier to create a new XPath function in existing
public domain XPath implementations than it is to change the parsing and
execution model.
3.  The association between a node and it's annotation isn't totally clear.
Does a node have an annotation if the annotation directly specifies the
node?  That's easy -- yes.  Does the node have an annotation if it's
ancestor has an annotation?  That's not very clear, although I lean towards
yes.  So, then I really want to axes, the annotation:: axis which returns
the former, and the annotation-closure:: axis, which returns the latter.

This became to complicated for what I required in the short run, so, I've
made a design decision that we'll probably have to go the function route.

What I came up with for an API was:

node-set extension:annot(node-set source [, string tag])

Returns the node-set consisting of all annotations on source.  If tag is
supplied, then only those annotations whose element name matches it will be
returned.  The value of tag is a list of tags to be included in the result,
separated by white space or | symbols [NOTE: What I really wanted to pass in
to this function here was a relative location path so that I could optimize
the selection].

So expr[extension:annot(.,"tag")] returns anly those nodes which have a
<tag> annotation, and expr[extension:annot(./ancestor-or-self,"tag")]
selects a similar set, save that the annotation can be on the nodes or its
ancestors.  I didn't feel it necessary to have a function that automatically
applied the ancestor-or-self notion simply because the number of ancestors
is going to be small [3-7] for any given node I have to apply this to in our
system, however, I may change my mind once I start implementing.

Of course, I still haven't figured out how to set the context up yet for
annotations, but still I have a few weeks to do some more design.

	Keith


Engineering is what happens when science and
mathematics meet politics.  Products are what
happens when all three meet reality.

-----Original Message-----
From: Jeni Tennison [mailto:jeni@j...]
Sent: Sunday, October 06, 2002 1:17 PM
To: uche.ogbuji@f...
Cc: Eric van der Vlist; xml-dev@l...
Subject: Re:  Annotations in XPath-NG? (Re: 
XPath/XSLT 2.0 concerns)


Hi Uche,

> My foirst comment is that it should be generic annotation, not just
> type annotation. My thoughts would be:
>
> Add an "annotation" property to each node. This is a simple
> key/value pair where the key is URI (or is that anathema ;-) ) and
> the value is any XPath 1.0 object (which would even allow
> annotations to be cross-node links).
>
> You can access any particular annotation for any particular XPath
> object with a function lookup(annoitation-key). Of course, some
> facilities, such as optimizers, might use annotations behind the
> scenes, directly.
>
> Does this sound like a good general approach?

Definitely. This is very close to what David Rosenborg and I were
discussing at:

  http://lists.xml.org/archives/xml-dev/200210/msg00212.html

and follow-ups.

Personally I'd use qualified names rather than URIs for the "lookup",
but that's because I envisage getting to annotation information
through an axis rather than through a function and because QNames are
easier to write than URIs. Perhaps a function:

  annotations(node)

that returns a node set, and let the user use XPath mechanisms for
doing the lookup within that node set?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>





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.