Re: OCL constrains [message #46413] |
Wed, 23 August 2006 11:42 |
Radomil Dvorak Messages: 249 Registered: July 2009 |
Senior Member |
|
|
Hi dzh,
Remark: When posting the same question to multiple newsgroups, please use a
single posting so that an answer on any group is an answer on all groups.
At the moment you can't write an OCL expression directly as you intend.
However, you could make use of EMF reflection and slightly reformulate it as
'self.eClass() <> oppositeEnd.eClass() '.
This can be used as soon as
https://bugs.eclipse.org/bugs/show_bug.cgi?id=152003 gets implemented in
EMFT, see
news:ea6mkj$7nh$1@utils.eclipse.org thread on this matter.
1) However, you can still check an instance for its type by
'oclIsTypeOf(OclType)' and write the expression something like
'self.oclIsTypeOf(Activity) implies not
oppositeEnd.oclIsTypeOf(Activity) and ...'
2) If you can modify your meta-model, you could add a nodeType attribute and
check it in your constraint if you wish to make
your constraint simpler.
Regards,
/Radek
"dzh" <dzhpingbo@sohu.com> wrote in message
news:ech4vq$pdq$1@utils.eclipse.org...
>I have a flow which can link with data and activity, the picture shows my
> model.
>
> I want to do such constrains:
> 1, activity can not connect with activity
> 2,data can not connect with data
> in other words, I don't want a node connect with another node with the
> same
> class type.
>
> what does the expression should I write in the "sourceEnd constraint" or
> "targetEnd constraint" in link constraint in gmfmap?
>
> can I get the class type of sourceEnd and targetEnd in ocl expression ?
> self.getClass() <> oppositeEnd.getClass()
>
>
|
|
|
|
Re: OCL constrains [message #46634 is a reply to message #46413] |
Thu, 24 August 2006 16:46 |
Eclipse User |
|
|
|
Originally posted by: dzhpingbo.sohu.com
Thank you for your answers:)
now I can create multiple connections between node A and node B, but I want
to limit user can only create one connection between nodes.
I know I can check this with audit function in gmfmap, but it was used to
show errors when I already create muliple connections between nodes, I want
to prevent user from creating multiple connections between nodes, how can I
implement this function?
best regards,
dzh
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03964 seconds