Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » UML profile with OCL constraints on stereotypes
UML profile with OCL constraints on stereotypes [message #661357] Thu, 24 March 2011 10:59 Go to next message
Eclipse UserFriend
Originally posted by: ss.thinkersfoot.net

Hey all,

Some background on my story can be found in a posting to the OCL newsgroup:

http://www.eclipse.org/forums/index.php?t=msg&th=206549& amp;start=0&S=6ff55f4ec2c4798b7b81aa06d74bf461

My task: In Helios (3.6.2 M20110210-1200), to have a UML profile
equipped with OCL constraints and have models applying the profile being
validated against the profile's constraints (OCL constraints written in
the context of the stereotypes).

By now, I am aware that there /might/ different approaches to this
problem (leaving aside the plans for Indigo), I took a step back and
tried the most obvious one to me; attaching constraints + opaque
behaviour (OCL + body) to the profile's stereotypes:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=105199

What I got: a UML profile, wrapped up with an EPackage stereotype
(explicitly set NS Uri!). from there, I saw two alternative paths to
take: 1) "dynamic" constraint evaluation or 2) "static" constraint
evaluation.

ad 1): By "defining" the Profile (UML Editor > Profile > Define) and
processing the "body invariants", I get an embedded ecore model of my
profile, with constraint-implementing operations (named after the
constraints).

However, as can be learnt from
https://bugs.eclipse.org/bugs/show_bug.cgi?id=105199 (last posting):

> Support for dynamically evaluating stereotype (or other) constraints will not
> be provided (at least not in UML2) since this would introduce a circular build
> dependency on MDT OCL. Besides, this a tool-level capability that would be more
> appropriately provided by the UML2 Tools component of MDT (seeing as it already
> depends on both UML2 and OCL).

So, even though, the constraints are reflected in the ecore model, they
are not put to any use. Farewell ...

ad 2) Left with static evaluation, I did the following: turned my
*.profile.uml into a *.genmodel and generated the model code. I verified
that there is not only a standalone ecore model now (with
constraint-implementing operations), but also that the
stereotype-representing Java classes have constraint-checking methods
(and dependencies on OCL packages etc.)

I then built the model code, fired up a Eclipse application, create a
UML model, apply the profile to the model (causing the EPackage and its
class set to be initialised/loaded based on the NSUri lookup), setting
the stereotype to the permissive model element. However, applying the
stereotype fails, with the base_XXX attribute not being set (in the XMI
perspective), the stereotype not showing up in the UML editor view as
"<<...>>" tag to the extended element but as dangling, alien element.

When using approach 1), applying the stereotype works. However, using
1), I don't get constraint evaluation!

So I feel trapped now ... can anybody help me out here?!

//stefan
Re: UML profile with OCL constraints on stereotypes [message #661395 is a reply to message #661357] Thu, 24 March 2011 13:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4189
Registered: July 2009
Senior Member
Hi Stefan

> However, as can be learnt from
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=105199 (last posting):
>
>> Support for dynamically evaluating stereotype (or other) constraints
>> will not
>> be provided (at least not in UML2) since this would introduce a
>> circular build
>> dependency on MDT OCL. Besides, this a tool-level capability that
>> would be more
>> appropriately provided by the UML2 Tools component of MDT (seeing as
>> it already
>> depends on both UML2 and OCL).
Circularly dependency is a very reasonable excuse for not solving in UML2.
I'm not convinced that UML2 Tools is the solution.

OCL already has a UML2 dependency. OCL supports delegated evaluation for
Ecore models.
Why doesn't OCL support UML2 evaluation?
https://bugs.eclipse.org/bugs/show_bug.cgi?id=340853 raised.

Regards

Ed Willink
Re: UML profile with OCL constraints on stereotypes [message #661573 is a reply to message #661357] Fri, 25 March 2011 12:33 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
Profile is complex but trying to add constraints on existing profile is very very hard job. Rolling Eyes

What some of Omondo EclipseUML users do is to add a stereotype on an model element and then add a constraints on the same element. It means that in the xmi you get stereotype and constraints information live synchronized with the diagram.
They parse the xmi at every 30 seconds and depending on conditions execute a predefined task if they parser find the stereotype + constraints.
It works well and really easy to put in place but I am not sure it could help you because we add the constraints and stereotype directly and manually in the metamodel without any transformation therefore you can not add transformation rules because you have no transformation.
Hope this is understandable Embarrassed

Vlad,
Re: UML profile with OCL constraints on stereotypes [message #662051 is a reply to message #661573] Tue, 29 March 2011 06:33 Go to previous messageGo to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi all,

did I get it right? It is not possible to add constraints to a profile
definition and to validate the UML model after applying the constrainted
profile with the EMF Validation Framework?

I never tried it, but I thought this would not be a problem? Actually, I
planned to use OCL exactly this way in a future project.

Thanks a lot for any remark.

Timothy

"Vlad Varnica" schrieb im Newsbeitrag news:imi1l1$fsf$1@news.eclipse.org...

Profile is complex but trying to add constraints on existing profile is very
very hard job. :roll:

What some of Omondo EclipseUML users do is to add a stereotype on an model
element and then add a constraints on the same element. It means that in
the xmi you get stereotype and constraints information live synchronized
with the diagram.
They parse the xmi at every 30 seconds and depending on conditions execute a
predefined task if they parser find the stereotype + constraints.
It works well and really easy to put in place but I am not sure it could
help you because we add the constraints and stereotype directly and manually
in the metamodel without any transformation therefore you can not add
transformation rules because you have no transformation.
Hope this is understandable :blush:

Vlad,
Re: UML profile with OCL constraints on stereotypes [message #662063 is a reply to message #662051] Tue, 29 March 2011 07:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4189
Registered: July 2009
Senior Member
Hi Timothy

Today, probably it doesn't work.

After Indigo, I hope it will, but you'll only need EMF + UML + OCL; no
need for the EMF Validation framework.

Regards

Ed Willink


On 29/03/2011 07:33, Timothy Marc wrote:
> Hi all,
>
> did I get it right? It is not possible to add constraints to a profile
> definition and to validate the UML model after applying the
> constrainted profile with the EMF Validation Framework?
>
> I never tried it, but I thought this would not be a problem? Actually,
> I planned to use OCL exactly this way in a future project.
>
> Thanks a lot for any remark.
>
> Timothy
>
> "Vlad Varnica" schrieb im Newsbeitrag
> news:imi1l1$fsf$1@news.eclipse.org...
>
> Profile is complex but trying to add constraints on existing profile
> is very very hard job. :roll:
>
> What some of Omondo EclipseUML users do is to add a stereotype on an
> model element and then add a constraints on the same element. It
> means that in the xmi you get stereotype and constraints information
> live synchronized with the diagram.
> They parse the xmi at every 30 seconds and depending on conditions
> execute a predefined task if they parser find the stereotype +
> constraints.
> It works well and really easy to put in place but I am not sure it
> could help you because we add the constraints and stereotype directly
> and manually in the metamodel without any transformation therefore you
> can not add transformation rules because you have no transformation.
> Hope this is understandable :blush:
>
> Vlad,
Re: UML profile with OCL constraints on stereotypes [message #1064770 is a reply to message #662063] Thu, 20 June 2013 23:12 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 15
Registered: July 2009
Junior Member
So what on earth happened? It is now mid 2013 and Papyrus does not seem to even have a constraints tab to add OCL constraints, even though such a tab is mentioned and indeed documented (with pictures) on the papyrus uml website circa 2008!!
Is papyrus dead in the water and never likely to get these features that it appeared to once have? It would appear so, and yet it is still part of Kepler release plan with milestones in place (although constantly slipping). OCL constraints now promised for M7 in July, but I seriously doubt that will happen.....
I've been debating whether to use UML + profiling for a DSL, or go instead with my own Ecore based meta-model, and write my own editor using Graffiti or GMF etc. I was hoping to try both approaches and make substantial use of OCL. However, using OCLinEcore is fraught with problems regarding Dynamic dispatch and Pivot vs LPG issues.
Anyway it seems that progress is painfully slow and troublesome in these areas, and I am curious as to why? Has the participation dried up, and if so why? Are there better or more fashionable ways of specifying DSL's with working constraints etc.?
Forgive my ignorance. I am fairly new to mainstream (OMG ) MDA having written the majority of an entirely different generic modelling framework in a previous job that I recently left. I have to say that I am surprised and disapointed with what mainstream (OMG standards etc.) modelling through Eclipse has to offer in 2013, especially as I attended an MDA conference around 2005, and it really doesn't seem to have moved on much since, except to have sprouted many projects trying to achieve the same goals.I would say it has spread sideways rather than moving forwards!
Sorry for the rant, but I'm just frustrated that nothing is quite working well enough for my needs....
Re: UML profile with OCL constraints on stereotypes [message #1064913 is a reply to message #1064770] Fri, 21 June 2013 15:36 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4189
Registered: July 2009
Senior Member
Hi

You should try the Kepler release, officially rel;eased next week, RC4
available to enthusiasts/

OCL in Profiles is supported with a rich editor. OCL in class diagrams
can generate Java code.

There is a section on editing OCL in Papyrus in the Kepler OCL
documentation.

The Papyrus constraint UI is not quite perfect; hopefully that will
improve for Luna.

Eclipse is of course free and much of the OCL support is unfunded, so
I'm sorry if you want more; there is a lot to do.

Regards

Ed Willink

On 21/06/2013 00:12, Darren Hurt wrote:
> So what on earth happened? It is now mid 2013 and Papyrus does not
> seem to even have a constraints tab to add OCL constraints, even
> though such a tab is mentioned and indeed documented (with pictures)
> on the papyrus uml website circa 2008!!
> Is papyrus dead in the water and never likely to get these features
> that it appeared to once have? It would appear so, and yet it is still
> part of Kepler release plan with milestones in place (although
> constantly slipping). OCL constraints now promised for M7 in July, but
> I seriously doubt that will happen.....
> I've been debating whether to use UML + profiling for a DSL, or go
> instead with my own Ecore based meta-model, and write my own editor
> using Graffiti or GMF etc. I was hoping to try both approaches and
> make substantial use of OCL. However, using OCLinEcore is fraught with
> problems regarding Dynamic dispatch and Pivot vs LPG issues. Anyway it
> seems that progress is painfully slow and troublesome in these areas,
> and I am curious as to why? Has the participation dried up, and if so
> why? Are there better or more fashionable ways of specifying DSL's
> with working constraints etc.?
> Forgive my ignorance. I am fairly new to mainstream (OMG ) MDA having
> written the majority of an entirely different generic modelling
> framework in a previous job that I recently left. I have to say that I
> am surprised and disapointed with what mainstream (OMG standards etc.)
> modelling through Eclipse has to offer in 2013, especially as I
> attended an MDA conference around 2005, and it really doesn't seem to
> have moved on much since, except to have sprouted many projects trying
> to achieve the same goals.I would say it has spread sideways rather
> than moving forwards!
> Sorry for the rant, but I'm just frustrated that nothing is quite
> working well enough for my needs....
>
Re: UML profile with OCL constraints on stereotypes [message #1064943 is a reply to message #1064913] Fri, 21 June 2013 19:03 Go to previous message
Darren Hurt is currently offline Darren HurtFriend
Messages: 15
Registered: July 2009
Junior Member
Thanks Ed,
Sorry for my rant. I know everyone is doing the best they can, and funding for open source tooling must be difficult.
I always had a bit of a trouble making the bean counters understand the need and enormous benefits of the more abstract parts of modelling (e.g. defining validation of models through a tailored language in it's meta-model) in my last job.
I know I should try and get involved if anything.
Thanks for your patience and for looking into the dispatching bug I raised with OCL Pivot (and suggested workaround).

Darren


Previous Topic:Opening UML meta-model using oclInEcore editor
Next Topic:How to get "tagged values" from an attribute of class in UML2.0
Goto Forum:
  


Current Time: Tue Dec 23 02:32:45 GMT 2014

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

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