[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Object query language?
Hi,
It is not clear to me that Ozone should provide special indexing
functionality. Sure, you could have Ozone index objects according to some
attribute, but you'd then have to specify what attributes to index by, and
would have to choose an indexing data structure, etc.
This is exactly the reason the ODMG bindings include collection classes
(although they are currently incomplete in Ozone). You are supposed to be
able to build and use your own indicies very easily.
In your case, why don't you put the objects into a Map indexed by their
name? That map might be a hashtable or a tree or whatever you think will
suit you best.
Of course, this model for indexing means that either you have to make the
name another Ozone object (and use an ozone object as the key in a
hashtable, which doesn't work currently), Or you have to store the name
twice (once in the object and once in the key you are hashing by), Or you
roll your own hashtable class specifically for this index (yuk!). ODMG
seems to prefer the first option - everything in the DB is a proxied object
and can be used everywhere a normal object might be.
later,
\x/ill :-}
--On Friday, March 17, 2000 5:50 PM +0000 Phillip Rhodes
<phillip@rhoderunner.com> wrote:
> Is there any query facility in ozone?
>
> For example, if I have a List of objects of class type Product, how would
> I return the subset of all products that might have a certain attribute
> value?
>
> class Product{
> public String name;
> }
>
> //return arraylist of products that have "wood" as a substring in the
> name or description
> List list = ProductFactory.getInstance().findProducts("wood");
>
> //would return list of products
>
> name="Wood Chair"
> name="Hickory Wood Pipe"
>
> I know I can loop through an Iterator and do the search, but that would
> be a time killer. Any other ideas?
>
> Thanks,
> Phillip
>