Lars Martin wrote:
> 
> On Tue, 22 May 2001 07:39:47 -0700
> Tom Bradford <[EMAIL PROTECTED]> wrote:
> 
> > Lars Martin wrote:
> > > > 2. It's not so easy to understand why Collection.getResources() returns
> > > > a String[] of IDs and XPathQueryService.query() returns a
> > > > ResourceIterator. In both cases it might be good to have both
> > > > possibilities, first to iterate through the resources and second to get
> > > > a list of resource IDs. My priority lies on the ResourceIterator.
> > >
> > > I came across the same. I like the Iterator pattern but I don't know
> > > if it makes sense to return an iterator for each and every method.
> >
> > One of the reasons I can see for 'not' returning a set of IDs from a
> > query is that the results may be synthetically generated, and might not
> > even have IDs.  Returning a set of IDs assumes that the query language
> > is producing a set of results that map to actual collection resources.
> > But what if I executed a query that performed an XSLT transformation or
> > dynamically produced a document fragment that held the current time?
> 
> Exactly.

This is actually the way XPath works in the ref. impl as well as in the
dbXML impl. There are no keys associated with the resources returned
because the result of the query is a node set not a set of documents. 

> 
> > Still, I see the value in having Collection return a ResourceIterator as
> > the set of IDs is likely to change, a ResourceIterator can give you a
> > more up-to-date snapshot of them as you're walking the list.
> 
> Yup, this sounds reasonable to me. What do others think?

This is actually the way the Collection interface worked originally. It
seems like even if you return the ResourceIterator that you would want
it to be a snapshot and not be live. Otherwise you have to specify that
all implementations must make it live which could be very difficult to
do in some cases. Things are much simpler by just returning keys as a
snapshot of the repository and leaving it up to the app to retrieve the
actual resources. 

> 
> Lars
> --
> ______________________________________________________________________
> Lars Martin                                    mailto:[EMAIL PROTECTED]
> SMB GmbH                                        http://www.smb-tec.com
> 
> ----------------------------------------------------------------------
> Post a message:         mailto:[EMAIL PROTECTED]
> Unsubscribe:            mailto:[EMAIL PROTECTED]
> Contact adminstrator:   mailto:[EMAIL PROTECTED]
> Read archived messages: http://archive.xmldb.org/
> ----------------------------------------------------------------------

-- 
Kimbro Staken
The dbXML Project
http://www.dbxml.org/

----------------------------------------------------------------------
Post a message:         mailto:[EMAIL PROTECTED]
Unsubscribe:            mailto:[EMAIL PROTECTED]
Contact adminstrator:   mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------

Reply via email to