Skip to main content



      Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Re: OCL constrains
Re: OCL constrains [message #46413] Wed, 23 August 2006 07:42 Go to next message
Eclipse UserFriend
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 #46611 is a reply to message #46413] Thu, 24 August 2006 11:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dzhpingbo.sohu.com

Thank you:)
"Radek Dvorak" <radek.dvorak@borland.com> д
Re: OCL constrains [message #46634 is a reply to message #46413] Thu, 24 August 2006 12:46 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: OCL constrains [message #46882 is a reply to message #46634] Thu, 24 August 2006 20:01 Go to previous messageGo to next message
Eclipse UserFriend
The best way to enforce a constraint like this is directly in your metamodel
by using multiplicity
and unique properties for a reference.
The connection creation should follow such restrictions.

I am not sure I fully understand your use-case at this point as you are not
much specific with respect to the metamodel.
However, If you are able to achieve this with audits, doing so by using link
constraints is just an analogy only
with the following difference:
link constraints are evaluated against nodes before a connection is
established
while audits are checked against the current state.

/Radek


"dzh" <dzhpingbo@sohu.com> wrote in message
news:eckl5i$dkk$1@utils.eclipse.org...
> 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
>
Re: OCL constrains [message #47000 is a reply to message #46882] Fri, 25 August 2006 12:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dzhpingbo.sohu.com

"Radek Dvorak" <radek.dvorak@borland.com> д
  • Attachment: model.JPG
    (Size: 45.26KB, Downloaded 178 times)
  • Attachment: audit Rules.JPG
    (Size: 26.84KB, Downloaded 135 times)
  • Attachment: tmp.JPG
    (Size: 13.09KB, Downloaded 148 times)
Re: OCL constrains [message #47252 is a reply to message #47000] Mon, 28 August 2006 19:53 Go to previous message
Eclipse UserFriend
Hi dzh,

Sorry, for the late response, I somehow overlooked your latest post.
As for your multiple connection constraint,
AFAIU you want to disallow multiple flows connecting to the same Data and
Activity node.
Try the following sourceEnd:
oppositeEnd <> null implies not self.subDiagram.flows->exists(f| f.activity
= self and f.data = oppositeEnd)

/Radek

"dzh" <dzhpingbo@sohu.com> wrote in message
news:ecn9mm$d5f$1@utils.eclipse.org...
>
> "Radek Dvorak" <radek.dvorak@borland.com>
> д
Re: OCL constrains [message #586228 is a reply to message #46413] Thu, 24 August 2006 11:20 Go to previous message
Eclipse UserFriend
Thank you:)
"Radek Dvorak" <radek.dvorak@borland.com> д
Re: OCL constrains [message #586249 is a reply to message #46413] Thu, 24 August 2006 12:46 Go to previous message
Eclipse UserFriend
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
Re: OCL constrains [message #586339 is a reply to message #46634] Thu, 24 August 2006 20:01 Go to previous message
Eclipse UserFriend
The best way to enforce a constraint like this is directly in your metamodel
by using multiplicity
and unique properties for a reference.
The connection creation should follow such restrictions.

I am not sure I fully understand your use-case at this point as you are not
much specific with respect to the metamodel.
However, If you are able to achieve this with audits, doing so by using link
constraints is just an analogy only
with the following difference:
link constraints are evaluated against nodes before a connection is
established
while audits are checked against the current state.

/Radek


"dzh" <dzhpingbo@sohu.com> wrote in message
news:eckl5i$dkk$1@utils.eclipse.org...
> 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
>
Re: OCL constrains [message #586445 is a reply to message #46882] Fri, 25 August 2006 12:49 Go to previous message
Eclipse UserFriend
"Radek Dvorak" <radek.dvorak@borland.com> д
  • Attachment: model.JPG
    (Size: 45.26KB, Downloaded 130 times)
  • Attachment: audit Rules.JPG
    (Size: 26.84KB, Downloaded 123 times)
  • Attachment: tmp.JPG
    (Size: 13.09KB, Downloaded 118 times)
Re: OCL constrains [message #586596 is a reply to message #47000] Mon, 28 August 2006 19:53 Go to previous message
Eclipse UserFriend
Hi dzh,

Sorry, for the late response, I somehow overlooked your latest post.
As for your multiple connection constraint,
AFAIU you want to disallow multiple flows connecting to the same Data and
Activity node.
Try the following sourceEnd:
oppositeEnd <> null implies not self.subDiagram.flows->exists(f| f.activity
= self and f.data = oppositeEnd)

/Radek

"dzh" <dzhpingbo@sohu.com> wrote in message
news:ecn9mm$d5f$1@utils.eclipse.org...
>
> "Radek Dvorak" <radek.dvorak@borland.com>
> д
Previous Topic:'Live' validation in EMF vs EMFT
Next Topic:Live mode constraint not working correctly
Goto Forum:
  


Current Time: Tue Jul 08 18:26:33 EDT 2025

Powered by FUDForum. Page generated in 0.04716 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top