You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Timothy Dean <td...@gr.com> on 2002/01/22 18:34:09 UTC

Creating nested collections

I am trying to create a nested set of collections from within a Xindice
application. Specifically, I have a collection called "db/addressBooks" which
contains a collection called "tdean". I have a CollectionManagementService
instance that is associated with the top-level (db/addressBooks) collection.
I want to create several collections within the nested collection
(db/addressBooks/tdean). For example, I need to create collections
"db/addressBooks/tdean/Personal" and "db/addressBooks/tdean/Work".

I would like to create the collections directly from my service that is
associated with the "db/addressBooks" class. I want to do something like:

    service.createCollection("tdean/Personal");
    service.createCollection("tdean/Work");

When I first tried this, it was unclear to me if this approach is supposed to
work. The XML:DB API specs are unclear on specifics, and the API use cases
shed no light on this scenario. The specs do say that the new collection is
created *relative* to the associated collection, which implies to me that
nested collection creation is supported: However, it doesn't say
specifically, so please correct my assumptions if this approach is not
supported.

What I found when I tried the above code: The new collections are created
within the "tdean" collection, so it appears that the above syntax is being
handled as I expected. However, rather than creating a collection called
"Personal" within the "tdean" package, the new collection is called
"tdean/Personal" (within the "tdean" collection). It appears that the Xindice
implementation has a bug here, but I wanted to check to see if I was
understanding the desired behavior correctly.

Does anyone have any comments on how this is supposed to work? I can dig into
the Xindice source and see if I can find the problem, but I want to be sure
this really is a bug before wasting my time.

For the time being, I can work around the problem by explicitly retrieving a
collection service that is associated with the lower-level collection and
creating a non-nested collection from it. It will be tedious for me to work
around though, so I'd like to get this behavior changed if possible so I can
avoid this hack...

- Tim

Re: Creating nested collections

Posted by Kimbro Staken <ks...@dbxmlgroup.com>.
On Tuesday, January 22, 2002, at 10:34 AM, Timothy Dean wrote:

> I am trying to create a nested set of collections from within a Xindice
> application. Specifically, I have a collection called "db/addressBooks" 
> which
> contains a collection called "tdean". I have a CollectionManagementService
> instance that is associated with the top-level (db/addressBooks) 
> collection.
> I want to create several collections within the nested collection
> (db/addressBooks/tdean). For example, I need to create collections
> "db/addressBooks/tdean/Personal" and "db/addressBooks/tdean/Work".
>
> I would like to create the collections directly from my service that is
> associated with the "db/addressBooks" class. I want to do something like:
>
>     service.createCollection("tdean/Personal");
>     service.createCollection("tdean/Work");
>
> When I first tried this, it was unclear to me if this approach is 
> supposed to
> work. The XML:DB API specs are unclear on specifics, and the API use cases
> shed no light on this scenario. The specs do say that the new collection 
> is
> created *relative* to the associated collection, which implies to me that
> nested collection creation is supported: However, it doesn't say
> specifically, so please correct my assumptions if this approach is not
> supported.

It wasn't intended for you to be able to do that. You would have to walk 
the collection hierarchy to create the collections. I admit that's 
probably not  the way it should be.

>
> What I found when I tried the above code: The new collections are created
> within the "tdean" collection, so it appears that the above syntax is 
> being
> handled as I expected. However, rather than creating a collection called
> "Personal" within the "tdean" package, the new collection is called
> "tdean/Personal" (within the "tdean" collection). It appears that the 
> Xindice
> implementation has a bug here, but I wanted to check to see if I was
> understanding the desired behavior correctly.
>

Yeah this is a bug, we shouldn't accept a collection name with a / in it.

> Does anyone have any comments on how this is supposed to work? I can dig 
> into
> the Xindice source and see if I can find the problem, but I want to be 
> sure
> this really is a bug before wasting my time.
>
> For the time being, I can work around the problem by explicitly 
> retrieving a
> collection service that is associated with the lower-level collection and
> creating a non-nested collection from it. It will be tedious for me to 
> work
> around though, so I'd like to get this behavior changed if possible so I 
> can
> avoid this hack...
>
> - Tim
>
>
Kimbro Staken
XML Database Software, Consulting and Writing
http://www.xmldatabases.org/