Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » ocl queires/constraints
ocl queires/constraints [message #51061] Mon, 25 February 2008 11:00 Go to next message
Eclipse UserFriend
Originally posted by: nickkirtley.gmail.com

hi,

Ive implemented a system where I can check for certain UML constructs. I
check whether certain ports/connectors/interfaces have been stereotyped
and then through a query check if certain constraints have been met. This
way I find the 'special construct' and check the constraints in one query.

Another approach would be to add M2 level constraints to the profile
somehow and when certain stereotypes are applied it would check the
constraints.

For example:

2 components c1,c2
one component has a connector and connects to c2 through ports. The
connector has been stereotyped by "something".

If "something" has been applied then constraints should be checked. For
example, self.ownedConnector.end->size()=2.

How can I apply something like this to models that have profiles applied
to them (that define the stereotypes and the constraints).

This differs somewhat to examples I've seen of OCL being applied in that I
want to constrain it at M2 level and not M1 level.

regards,
nick
Re: ocl queires/constraints [message #51145 is a reply to message #51061] Mon, 25 February 2008 14:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Nick,

The UML2 component actually supports what you are looking for,
out-of-the-box in its (current) 2.2 release. You can define constraints on
Stereotypes in your Profile, using OpaqueExpressions with OCL language,
exactly as you would define M1 constraints in a UML model. The static
profile generation capability takes advantage of the same support for
generating OCL constraints as does the code-generation from models.

Be sure, when generating your profile to code, to select the option to
generate OCL constraints.

HTH,

Christian


nick wrote:

> hi,
>
> Ive implemented a system where I can check for certain UML constructs. I
> check whether certain ports/connectors/interfaces have been stereotyped
> and then through a query check if certain constraints have been met. This
> way I find the 'special construct' and check the constraints in one query.
>
> Another approach would be to add M2 level constraints to the profile
> somehow and when certain stereotypes are applied it would check the
> constraints.
>
> For example:
>
> 2 components c1,c2
> one component has a connector and connects to c2 through ports. The
> connector has been stereotyped by "something".
>
> If "something" has been applied then constraints should be checked. For
> example, self.ownedConnector.end->size()=2.
>
> How can I apply something like this to models that have profiles applied
> to them (that define the stereotypes and the constraints).
>
> This differs somewhat to examples I've seen of OCL being applied in that I
> want to constrain it at M2 level and not M1 level.
>
> regards,
> nick
Re: ocl queires/constraints [message #51227 is a reply to message #51145] Wed, 27 February 2008 13:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nickkirtley.gmail.com

hi,

I'm just curious to know whether it would have been possible before 2.2?
Using OCL plugin for example? or would it require a lot of adaptation?

regards,
nick
Re: ocl queires/constraints [message #51254 is a reply to message #51227] Wed, 27 February 2008 13:38 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Nick,

Another alternative that I know of is to use the extensible EMF Validation
Framework component to discover, at run-time, the constraints in your
profiles and to evaluate them on your model. You might use the example
dynamic constraint provider in the org.eclipse.emf.validation.examples.ocl
plug-in for guidance (the example provider loads constraints from a *.ocl
document, but I shouldn't think it's a stretch to look for them in applied
profiles).

Other than that, as far as I know, you'd be rolling your own solution using
the OCL API.

Cheers,

Christian


nick wrote:

> hi,
>
> I'm just curious to know whether it would have been possible before 2.2?
> Using OCL plugin for example? or would it require a lot of adaptation?
>
> regards,
> nick
Previous Topic:[Announce] Eclipse/OMG Symposium at EclipseCon 2008
Next Topic:[Announce] MDT OCL 1.2.0 I200802271900 is available
Goto Forum:
  


Current Time: Mon Nov 24 15:25:36 GMT 2014

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

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