Re: OCL question



Re: OCL question

From: octavian patrascoiu <opatrascoiu_at_yahoo.com>
Date: Mon, 25 Feb 2008 08:51:33 -0800 (PST)
Message-ID: <665064.71761.qm@web30404.mail.mud.yahoo.com>
You can use the solution suggested by Anneke and
filter    the classifier with IsTypeOf or isKindOf
according to what you want.

Octavian
--- Humberto Castejon <beconico@gmail.com> wrote:

> Hi Anneke,
> 
> Thanks for your comments. I still have some doubts.
> Please, find below my comments.
> 
> > I do not know a lot about collaborations, but I
> would say that your problem 
> > could be specified very simply:
> > 
> > context Sale
> > inv: buyer <> seller
> > 
> > Because a collaboration is a classifier, it can be
> used as context, and because 
> > collaboration roles are a subset of (classifier)
> roles, they can be used in the 
> > same manner as associations.
> 
> You might be right. However, I have two concerns:
> 
> 1- In the collaboration the roles are not bound to
> any classifier. It is the collaboration use that
> defines such binding. When you say 
> "buyer<>seller", should this be interpreted as "the
> object to which the seller role will be bound should
> be different of the object to 
> which the buyer role will be bound"? Note that I say
> "will be bound", because that binding does not exist
> in the context of the 
> collaboration.
> 
> 2- Would not such constraint affect all uses of the
> Sale collaboration? What if I just want to impose
> "buyer<>seller" in the case the 
> collaboration is bound to a Person classifier? So,
> for example, we could still have buyer=seller if
> Sale is bound to a e.g. Machine 
> classifier.
> 
> This is why I was trying to impose the constraint in
> the context of the collaboration use. I guess,
> anyway, that I cannot use the 
> collaboration use as context, since it is just a
> NamedElement.
> 
> > 
> > By the way, your use of roleBinding is incorrect,
> because you mix the metamodel 
> > with the model.
> 
> Thanks for your correction. This is actually my
> first attempt at using OCL and I have still some
> problems using it.
> Since the role bindings are UML Dependencies and not
> associations, how can we navigate through them with
> OCL?
> 
> Cheers,
> Humberto
> 
> > 
> > Kind regards, Anneke Kleppe
> > 
> > Humberto Castejon wrote:
> >> Hi again!
> >>
> >> I attach a diagram that may help to better
> understand my question.
> >>
> >> Cheers,
> >> Humberto
> >>
> >> Humberto Castejon wrote:
> >>> Hi!
> >>>
> >>> I have some problems using OCL together with
> collaborations and collaboration 
> >>> uses. I would be very grateful if you oculd help
> me with the following.
> >>>
> >>> Imagine we have a Sale collaboration with two
> roles: buyer and seller. Now, 
> >>> by means of a collaboration use, we bind both
> roles to the same classifier, 
> >>> namely Person. An instance of Person may then
> behave either as a seller or as 
> >>> a buyer in a Sale collaboration. However, we do
> not want the same instance of 
> >>> Person to play both the seller and the buyer
> roles in the same occurrence of 
> >>> a Sale collaboration (i.e. we do not want a
> person to sell to herself).
> >>>
> >>> Would the following OCL invariant, specified in
> the context of the 
> >>> collaboration use, be correct?
> >>>
> >>> Context s:Sale
> >>> inv s.roleBinding->forAll(b1, b2 |
> b1.client.allInstances->forall(Person p1 | 
> >>> b2.client.allInstances->forall(Person p2 | p1 <>
> p2)))
> >>>
> >>> Thanks for you help!
> >>>
> >>> Cheers,
> >>> Humberto
> >>>
> >>
> >>
> >>
>
--------------------------------------------------------------------------------
> >>
> 
> 
> 
> 
> To remove yourself from this list please mail
> puml-list-request@cs.york.ac.uk
> with a message containing the word "unsubscribe".
> 
> 



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Received on Mon 25 Feb 2008 - 16:52:18 GMT