Re: THe OverRelational Manifesto (ORM)

From: David Portas <REMOVE_BEFORE_REPLYING_dportas_at_acm.org>
Date: 6 Apr 2006 11:04:12 -0700
Message-ID: <1144346652.333767.195550_at_e56g2000cwe.googlegroups.com>


U-gene wrote:
> It was just entry into my question. The question is much shorter.
>
> With time we have started to sale our goods. So now we have to define
> new type to describe sale events. But every sale is a shipment too, so
> we define type SALE as subtype of SHIPMENT.
>
> CREATE CLASS SALE
> EXTEND SHIPMENT
> {
> ...
> SaleItems SET OF
> {
> Article STRING;
> Pieces INTEGER;
> Price FLOAT;
> }
> }
> GO
>
> //here we have to store information of sale lines
> ALTER CLASS SALE
> IMPLEMENT SaleItems AS STORED;
> GO
>
> Of course, we mustn't forget, that sold quantity of goods have to be
> shipped from warehouse. So we have to re-implement inherited component
> ShipmentItems as calculated on values contained(stored) in component
> SaleItems.
>
> ALTER CLASS SALE
> IMPLEMENT ShippedItems AS
> SELECT Article, Sum(Pieces)
> FROM SaleItems
> GROUP BY Article;
> GO
>
> So in class SALE information about shipped goods is calculated.
>
> And after the definition of new class SALE we have to do NOTHING on
> early defines view ShippedGoods to get information both about real
> shipments and about shipments for sales.
>
> In other words in R-variables the information is collected both from
> components defined as stored and from components defined as calculated.
> A lot of subtypes of type SHIPMENT can exist in system and in each
> subtype the component ShippedItems can be re-implemented in different
> ways - we must know nothing about it but every time we will get
> correct information in early defines view ShippedGoods (of course if
> implementation is correct).
>
> Is it possible in D?
>

I'm not sure if I've understood the problem correctly, but this:

> ALTER CLASS SALE
> IMPLEMENT ShippedItems AS
> SELECT Article, Sum(Pieces)
> FROM SaleItems
> GROUP BY Article;

looks like a derived relation. Specifically something like the following (partly from memory) in Tutorial D:

SUMMARIZE SaleItems PER {Article} ADD SUM(Pieces) AS TotalPieces

If the problem is a parts explosion then you need the TCLOSE operator in there as well (which is something not directly supported by SQL incidentally).

What am I missing?

-- 
David Portas
Received on Thu Apr 06 2006 - 20:04:12 CEST

Original text of this message