Re: product types in OCL 2.0



Date view Thread view Subject view Author view Attachment view

From: Herman Balsters (h.balsters@bdk.rug.nl)
Date: Thu 20 Feb 2003 - 15:45:56 GMT


Thomas,

I think your solution might be problematic.

(1) Uniqueness: How do you model the Cartesian product of a class A 
with itself (i.e. A x A)? Is there a  (generic) way to distinguish between 
the left and right hand sides?

(2) Uniqueness and Totality:  In your solution I think that ProdAB = 
ProdBA. Symmetry, in general,  is not a property of Cartesian 
products.

-Herman 

On 20 Feb 2003 at 9:40, Thomas Baar wrote:

> Hello!
> 
> Gerrit Renker wrote:
> 
> >Dear Herman,
> >
> >there is no Cartesian Product type in OCL. All there is is the Tuple
> >type. That means, in effect  modelling cartesian Products remains a
> >complex endeavour (see my mail earlier on this list).
> >
> A very simple possibility to model the Cartesian Product is the following:
> 
> Suppose you want to model the product of objects of classes A and B.
> This can be done by introduction of a new class ProdAB a s follows:
> 
>   -----                              -----
>   - A  -                               - B  -
>   -----                              -----
>      | 1                                       |1
>      |                                          |
>      |              --------          |
>      ------|  ProdAB |-----
>                * -------- *
> 
> constraints:
> 
> --  uniqueness
>     ProdAB.allInstances->forall(p1,p2| p1.a = p2.a and p1.b = p2.b 
> implies p1 = p2)
> 
> -- totality
>    A.allInstances->forAll(a1| B.allInstances->forAll(b1|
>         ProdAB->exists(p| p.a = a1 and p.b = b1)))
> 
> 
> >As a consequence, mathematical relations (subsets of Cartesian
> >Products) remain hard to model, too.
> >  
> >
> In order to model a relation, just omit the last constraint (totality).
> 
> Best regards,
> 
> Thomas
> 
> 
> 
> -- 
> 
> Thomas Baar
> University of Karlsruhe
> http://i11www.ira.uka.de/~baar
> 
> 
> 
> 
> 
> 
> To remove yourself from this list please mail puml-list-request@cs.york.ac.uk
> with a message containing the word "unsubscribe".
> 

dr. H. Balsters
Faculty of Business Science
University of Groningen
The Netherlands

Date view Thread view Subject view Author view Attachment view