Subject Re: [Firebird-Architect] transient data sets and procedures
Author Alexandre Benson Smith
Nando Dessena wrote:

>Alexandre,
>
>ABS> Zim uses the E-R model instead of the Relational Model.
>
>>From your description I think that ZIM does use the relational
>model and has support for table variables, much like Dataphor and,
>perhaps one day, Firebird.
>
>Ciao
>
>
Zim uses the Entity Relantionship model.

you have declared relationship between tables (not like FK's, because
it's not a constraint, IIRC you could insert orphans) I will try to
remember:

you add some fields to the ZIM's system tables and then does a "create
entity" to really create it

For example I could create two Entities (Costumer, PurchaseOrder)
then you create a relationship between it

to create a 1:n relationship you just declare the relation ship with a
name "has" (for example) and the Relation Condition as
'Costumer.CostumerID = PurcahesOrder.CostumerID'

then to "join" the tables you use the relationship name (has in our case)

find all Customer has PurchaesOrder where Customer.City like 'Sao Paulo'

this could be translated to SQL as
select * from Customer join PurchaseOrder on (Costumer.CostumerId =
PurchaseOrder.CostumerID)

you could not make relationships (joins) between entities (tables)
without a declarative relationship between the entities.

the same "table" relationship could hold data to make a n:m relationship
between entities

Supose I have an Entity named "Parts"

I declare a role "SubParts" for entity Parts

and decalre a relationship "built-with" on entity Parts and role
SubParts with the relation condition as "Parts.Code =
built-with.PartCode and SubParts.Code = Built-With.SubPartCode" then I
could search for the parts and the components that built it with
something as:

find all Parts built-with SubParts where Parts.Code = "001-01"

In this case the Relationship Built-With will hold Data, the
relantionship has coluns like a table, and has the relationship
condition like a common relatonship.
The structure os the relationship "Built-With" are liek this:
PartCode varchar(10)
SubPartCode varchar(10)
Quantity numeric(10,3)
MeasureUnity integer

When you populate the relationship, the relation of the entity Parts and
his role SubParts will be made.

But what I wish to know is if someone has worked with ZIM so could
explain better than me how the ZIM set's works in the context of TDS.

see you !


--

Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br