# Re: product types in OCL 2.0

From: Herman Balsters (h.balsters@bdk.rug.nl)
Date: Mon 24 Feb 2003 - 13:35:17 GMT

```Gerrit,

I don't think that there is any ambiguity in the definition of

a->prod(b)->prod(c)

The only way that you can read it is

(a->prod(b))->prod(c)  ( = (AxB)xC )

because

a->(prod(b)->prod(c))

is syntactically not correct. Also, if you wish to represent

Ax(BxC)  then this can be done by

a->prod(b->prod(c))

Do you agree?

-herman

On 24 Feb 2003 at 7:38, Gerrit Renker wrote:

> Hi,
> Sorry, the introduction of the Cartesian Product operator has escaped
> me, my printed copy is still V1.5. I picked up a copy of the Version
> 1.6 OCL 2.0 at
> http://cgi.omg.org/cgi-bin/doc?ad/2003-01-07 (hope that this is the
> current one).
>
> I can see a problem with this construct, it is ambiguous how
> k-fold products for k>2 are defined.
>
> For example
> a->product(b) : Set(Tuple{A,B})
>
> is clear, but what about a->product(b)->product(c) ?
> It might be read (1) as the Cartesian Product of three sets,
> in which case the type might be:
> a->product(b)->product(c) : Set(Tuple{A,B,C})
>
> But the same expression can also be interpreted as (2) the product of a
> binary Cartesian Product (AxB) with a set of class C elements:
> a->product(b)->product(c) : Set( Tuple{Tuple{A,B},C} )
>
> If as an example the 'x' operator from maths is used:
> --the first case can be written  as  A x B x C
> --the second case can be written as (A xB) x C
> which is less ambiguous.
>
> Possibly such preference rules could be incorporated into the
> definition?
>
> With kind regards
> Gerrit
>  --- Jos Warmer <J.Warmer@klasse.nl> wrote: > Hi there,
> >
> > In section 6.5.1, page 6-10, the operation 'product()' is defined on
> > Collection, resulting the carthesian product.
> > You can write:
> >
> >
> > collection->product(otherCollection)
> >
>
> =====
> --
> Gerrit Renker                     Research Assistant
> Constraints Group                 Computing Technologies Centre
> The Robert Gordon University      Aberdeen AB25 1HG
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
>
>
> 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
```