Re: S.O.D.A. database Query API - call for comments

From: mikito Harakiri <nospam_at_newsranger.com>
Date: Tue, 08 May 2001 22:22:07 GMT
Message-ID: <jk_J6.6868$vg1.552623_at_www.newsranger.com>


In article <9d9i7n$3j4$03$1_at_news.t-online.com>, Carl Rosenberger says...
>
>mikito Harakiri wrote:
>> Ok, let object Car contain Wheel (4 fields, actually:-). How exactly would
 I
>> find a Car given a Wheel; what indexes would I use? (Note that sql folks
 are
>> eager to provide exact sql statements -- I would like to see the code for
>> objects either:-)
>
>This is the "right-way-around" in a declarative query to an object database.
>Note that declarative queries and object navigation are beautifully
>complementary:
>- navigation in the programming language finds members of objects
>- declarative queries constrain objects by their members
>
>Code according to the current S.O.D.A. spec:
>
>// your class model
>class Wheel{
>}
>
>class Car{
> Wheel[] wheels;
>}
>
>ObjectContainer db;
>Wheel myWheel;
>
>Query carNode = db.query();
>carNode.constrain(new Car());
>carNode.getSubNode("wheels").constrain(myWheel).identity();
>ObjectSet res = carNode.execute();

Hmm, not bad... I mean, at least, that's something to discuss. Minor stylistic suggestion:

carNode.constrain(Car.class);

How about finding all red cars with alloy wheels?

class Car{
Wheel[] wheels;
Color color;
}

class Wheel {
boolean isAlloy;
}

Query carNode = db.query();

carNode.constrain(new Car());
carNode.getSubNode("color").constrain(new Color("red"));
carNode.getSubNode("wheels")

getSubNode("isAlloy").constrain(new Boolean(true)); ObjectSet res = carNode.execute();

I somehow feel that this type of query has a lower abstraction level (it looks similar to a plan for sql execution) but I don't seem to be able to prove my position. Hope that relational folks would be able to criticise it more specifically (apart from usual "codasyl/no pointers allowed" cliche)

>Your question "what indexes would I use?" only needs to be answered for
>relational databases. We are using objects. There is no need for keys to
>join objects.

Actually, indexes could be hidden in so called "self-tuned" relational database, so that user don't even have to be aware of them. In your approach you probably will use indexes behind the scene when Cars pool grows significantly, therefore, there is not much differences there. Received on Wed May 09 2001 - 00:22:07 CEST

Original text of this message