Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Single OCL constraint for multiple properties
Single OCL constraint for multiple properties [message #517163] Fri, 26 February 2010 07:49 Go to previous message
Timothy Marc is currently offline Timothy Marc
Messages: 547
Registered: July 2009
Senior Member
Hi all,

i've a question concerning OCL for properties contained in different
classifiers. Let's assume, we have two signals:

Signal A {xyz:Integer}
Signal B {xyz:Integer}

Both properties are restricted by the same kind of constraint. In OCL i
would use the following syntax:

context A
inv: self.xyz > 0

context B
inv: self.xyz > 0

Since we have a lot of Signals, sharing similar properties, it is a
quite annoying and repitive task to define these constraints in each
signal separately. I know, generaliaztion might be the answer, but we
didn't want the signals to be compatible with each other.

In UML it is possible to define a constraint somewhere in the model and
refer to elements which will be constrained by this single constraint.
Is this also possible with OCL? If so, how does the syntax look like?
Would the constraint point to the signals and than just state the
invariant like this:

self.xyz > 0

Cheers and Thanks
Timothy
 
Read Message
Read Message
Read Message
Previous Topic:Operation, Instantiation and post clause: Invalid Class?
Next Topic:How to count associative classes in a UML model
Goto Forum:
  


Current Time: Thu May 23 03:32:12 EDT 2013

Powered by FUDForum. Page generated in 0.02950 seconds