| Validation & OCL [message #33700] | 
Tue, 09 May 2006 04:25   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 #33839 is a reply to message #33771] | 
Wed, 10 May 2006 11:24   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 11:37   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 00:17   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 11:24   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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. 
>
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.24551 seconds