Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Validation & OCL
Validation & OCL [message #33700] Tue, 09 May 2006 08:25 Go to next message
Eclipse UserFriend
Originally posted by: asha_rajbhoj.yahoo.com

Hi,

One Constraint from UML 1.3 spec : "No Attributes may have the same name
within a Classifier."

Various model update scenario could be adding attribute for classifier ,
modifying attribute name , deletion of attribute.

When I specify constraint as follows it can address adding attribute
scenario

<constraint lang="OCL" ...>
<target class="Classifier">
<event name="Set">
<feature name="attribute" />
</event>
</target>
self.feature->select ( a | a.oclIsKindOf (Attribute) )->forAll
( p, q |
p.name = q.name implies p = q )
</constraint>


But it does not address modifying of attribute name. How to specify such
indirect event for the target classes using validation framework?

Thanks and Regards,
Asha.
Re: Validation & OCL [message #33738 is a reply to message #33700] Tue, 09 May 2006 15:37 Go to previous messageGo to next message
Chris McGee is currently offline Chris McGeeFriend
Messages: 99
Registered: July 2009
Member
Hello Asha,

It looks like your OCL constraints are live.

Is it possible for you to write a separate constraint that tests the
other event (please excuse my OCL) something like this:

<constraint lang="OCL" ...>
<target class="Attribute">
<event name="Set">
<feature name="name" /> </event>
</target>
self.classifier.feature->select ( a | a.oclIsKindOf
(Attribute))->forAll( p | p.name = self.name implies p = self )
</constraint>

Chris McGee

asha wrote:
> Hi,
>
> One Constraint from UML 1.3 spec : "No Attributes may have the same
> name within a Classifier."
>
> Various model update scenario could be adding attribute for classifier ,
> modifying attribute name , deletion of attribute.
>
> When I specify constraint as follows it can address adding attribute
> scenario
> <constraint lang="OCL" ...>
> <target class="Classifier">
> <event name="Set">
> <feature name="attribute" /> </event>
> </target>
> self.feature->select ( a | a.oclIsKindOf (Attribute) )->forAll
> ( p, q |
> p.name = q.name implies p = q )
> </constraint>
>
>
> But it does not address modifying of attribute name. How to specify such
> indirect event for the target classes using validation framework?
> Thanks and Regards,
> Asha.
>
Re: Validation & OCL [message #33771 is a reply to message #33738] Wed, 10 May 2006 04:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi Chris,

Yes , we can write multiple OCL for such indirect events.

But, semantically constraint is only for Class and not for Attribute. But
we end up in writing constraint even for Attribute to implement Class
level constraint for handling indirect event.

Does Validation framework has some feature to avoid writing such multiple
OCL for indirect event?

Thanks and Regards,
Asha.
Re: Validation & OCL [message #33839 is a reply to message #33771] Wed, 10 May 2006 15:24 Go to previous message
Chris McGee is currently offline Chris McGeeFriend
Messages: 99
Registered: July 2009
Member
Hi Asha,

The way that regular Java live constraints handle this issue is to write
their code to handle the different possible events that could trigger
the constraint as different cases. Unfortunately, this information isn't
provided to OCL constraints.

Is there any way to check the type of the 'self' object and perform
different checks based on the type in the OCL language? I notice that in
your case the two events are coming from different classes so this might
be an acceptable way of differentiating.

Chris

Asha wrote:
> Hi Chris,
>
> Yes , we can write multiple OCL for such indirect events.
>
> But, semantically constraint is only for Class and not for Attribute.
> But we end up in writing constraint even for Attribute to implement
> Class level constraint for handling indirect event.
>
> Does Validation framework has some feature to avoid writing such
> multiple OCL for indirect event?
>
> Thanks and Regards,
> Asha.
>
Re: Validation & OCL [message #577214 is a reply to message #33700] Tue, 09 May 2006 15:37 Go to previous message
Chris McGee is currently offline Chris McGeeFriend
Messages: 99
Registered: July 2009
Member
Hello Asha,

It looks like your OCL constraints are live.

Is it possible for you to write a separate constraint that tests the
other event (please excuse my OCL) something like this:

<constraint lang="OCL" ...>
<target class="Attribute">
<event name="Set">
<feature name="name" /> </event>
</target>
self.classifier.feature->select ( a | a.oclIsKindOf
(Attribute))->forAll( p | p.name = self.name implies p = self )
</constraint>

Chris McGee

asha wrote:
> Hi,
>
> One Constraint from UML 1.3 spec : "No Attributes may have the same
> name within a Classifier."
>
> Various model update scenario could be adding attribute for classifier ,
> modifying attribute name , deletion of attribute.
>
> When I specify constraint as follows it can address adding attribute
> scenario
> <constraint lang="OCL" ...>
> <target class="Classifier">
> <event name="Set">
> <feature name="attribute" /> </event>
> </target>
> self.feature->select ( a | a.oclIsKindOf (Attribute) )->forAll
> ( p, q |
> p.name = q.name implies p = q )
> </constraint>
>
>
> But it does not address modifying of attribute name. How to specify such
> indirect event for the target classes using validation framework?
> Thanks and Regards,
> Asha.
>
Re: Validation & OCL [message #577238 is a reply to message #33738] Wed, 10 May 2006 04:17 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Chris,

Yes , we can write multiple OCL for such indirect events.

But, semantically constraint is only for Class and not for Attribute. But
we end up in writing constraint even for Attribute to implement Class
level constraint for handling indirect event.

Does Validation framework has some feature to avoid writing such multiple
OCL for indirect event?

Thanks and Regards,
Asha.
Re: Validation & OCL [message #577309 is a reply to message #33771] Wed, 10 May 2006 15:24 Go to previous message
Chris McGee is currently offline Chris McGeeFriend
Messages: 99
Registered: July 2009
Member
Hi Asha,

The way that regular Java live constraints handle this issue is to write
their code to handle the different possible events that could trigger
the constraint as different cases. Unfortunately, this information isn't
provided to OCL constraints.

Is there any way to check the type of the 'self' object and perform
different checks based on the type in the OCL language? I notice that in
your case the two events are coming from different classes so this might
be an acceptable way of differentiating.

Chris

Asha wrote:
> Hi Chris,
>
> Yes , we can write multiple OCL for such indirect events.
>
> But, semantically constraint is only for Class and not for Attribute.
> But we end up in writing constraint even for Attribute to implement
> Class level constraint for handling indirect event.
>
> Does Validation framework has some feature to avoid writing such
> multiple OCL for indirect event?
>
> Thanks and Regards,
> Asha.
>
Previous Topic:Validation & OCL
Next Topic:OclInvalid as method argument
Goto Forum:
  


Current Time: Sat Nov 09 02:25:55 GMT 2024

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

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

Back to the top