Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mdt-papyrus.dev] OCL and operation generation with opaque behavior written with OCL

HI Francois

I am sorry, but I do not respond to instructions on how to emulate what you do.

Long experience shows that
- what you write may be wrong, incomplete or at least ambiguous
- what I retype may be wrong
and I end up debugging a different problem.

See: https://wiki.eclipse.org/OCL/ForumNetiquette

You need to provide a zipped project that I can add to an identified standard installation, such as Papyrus RC1.

NB tests such as org.eclipse.ocl.examples.test.xtext.UML25LoadTests.testLoad_UML_2_5_Final_UML conform that UML 2.5's OCL is loadable.

    Regards

        Ed Willink

On 17/05/2016 14:01, LE FEVRE FRANCOIS wrote:

Hi Ed,

 

If it is merely possible that my problems come from a miss used of Papyrus. Let me give you additional elements:

 

I am using the SysML Papyrus project [1]. I have taken the official SysML 1.4 norm from OMG, from this document I have extracted all paragraph/elements related to constraint and operation written in English or in OCL. At the end of the process, I have a file such as [0]. My goal is to edit manually the SysML profile to add the maximum of these OCL elements.

 

In Eclipse Mars with Modeling version and papyrus installed, I have edited the SysML profile localized here [2] to integrate a basic OCL constraint and a basic operation written with as an opaque behavior and OCL.

I have submitted a gerrit patch (not integrable at this time) [3], just to show you the elements.

 

For instance, I have added for requirement the following constraint:

[1] The property “ownedOperation” must be empty.

 

And I have also tried to add the following operation getSatisfiedBy2() with the following OCL

Satisfy.allInstances()->select(base_class.supplier=self).base_Abstraction.client

 

To do so, I have created an opaqueBehavior inside Requirement,

Then I have created an operation in Requirement stereotype, that is referencing the opaquebehavior with the language OCL and its associated text.

 

But whatever I do the OCL is not saved [6].

You can see them inside the Requirement package on the Diagram Requirements.

 

When regenerating the ecore, and model, I have not trace of the OCL for the operation (due to the unsaved status?)

In RequirementImpl.java [4], I have noticed the following code:

 

 

                /**

                * <!-- begin-user-doc -->

                * <!-- end-user-doc -->

                * @generated

                */

                public EList<NamedElement> getSatisfiedBy2() {

                               // TODO: implement this method

                               // Ensure that you remove @generated or mark it @generated NOT

                               throw new UnsupportedOperationException();

                }

 

For the constraint, I have:

 

                /**

                * <!-- begin-user-doc -->

                * <!-- end-user-doc -->

                * @generated

                */

                public boolean Constraint1(DiagnosticChain diagnostics, Map<Object, Object> context) {

                               // TODO: implement this method

                               // -> specify the condition that violates the invariant

                               // -> verify the details of the diagnostic, including severity and message

                               // Ensure that you remove @generated or mark it @generated NOT

                               if (false) {

                                               if (diagnostics != null) {

                                                               diagnostics.add

                                                                              (new BasicDiagnostic

                                                                                              (Diagnostic.ERROR,

                                                                                              RequirementsValidator.DIAGNOSTIC_SOURCE,

                                                                                              RequirementsValidator.REQUIREMENT__CONSTRAINT1,

                                                                                              EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "Constraint1", EObjectValidator.getObjectLabel(this, context) }), //$NON-NLS-1$ //$NON-NLS-2$

                                                                                              new Object [] { this }));

                                               }

                                               return false;

                               }

                               return true;

                }

 

I have opened a bug to trace the difficulty with the OCL here [5].

 

Thanks for your feedback.

 

 

Francois

 

[0] https://bugs.eclipse.org/bugs/attachment.cgi?id=256993

[1] git: https://git.eclipse.org/c/papyrus/org.eclipse.papyrus-sysml.git/

[2] /org.eclipse.papyrus.sysml14/resources/profile/SysML.profile.uml

[3] https://git.eclipse.org/r/#/c/72912/

[4], /org.eclipse.papyrus.sysml14/src-gen/org/eclipse/papyrus/sysml14/requirements/internal/impl/RequirementImpl.java

[5] https://bugs.eclipse.org/bugs/show_bug.cgi?id=493799

[6]

 

De : mdt-papyrus.dev-bounces@xxxxxxxxxxx [mailto:mdt-papyrus.dev-bounces@xxxxxxxxxxx] De la part de Ed Willink
Envoyé : mardi 17 mai 2016 10:50
À : mdt-papyrus.dev@xxxxxxxxxxx
Objet : Re: [mdt-papyrus.dev] OCL and operation generation with opaque behavior written with OCL

 

Hi

I am sorry, but your coments are very vague and so difficult to answer.

a) you provide no 'repro' to demonstrate what you have/have not achieved.

b) you give no steps to follow. "What is the 'OCL editor'"? far too many alternatives.

What is the "omg norm"?

What is "extracted" from what and "integrated" in what?

The OCL project distributes Java code generated from OCL with/accompanying UML, so it is possible. But your comments suggest that at least your initial problems are in your use of Papyrus.

    Regards

        Ed Willink

On 17/05/2016 07:40, LE FEVRE FRANCOIS wrote:

Dear all,

 

I am trying to integrate ocl operations extracted from the omg norm.

I am not able to generate the code. And I would like to know if you have any advice for that puprpiose.

 

I am following the process:

·         Extraction of all OCL constraint and operation [1]

·         For Requirement [2]

·         Creation of an operation with an associated opaque behavior written in OCL

o   getSatisfiedBy

o   Satisfy.allInstances()->select(base_class.supplier=self).base_Abstraction.client

 

My first concern is the the OCL editor for the opaque behavior.

It seems not to have any OCL completion

>> Any idea why?

 

Secundly, it seems that the OCL is not record… If I double click on my method associated with the operation, I am not able to see the OCL I have just written.

>>How can I confirm the OCL is not store in my profile?

 

Thirdly, when I reload the UML profil to ecore and regenerate the Model/Edit code, I am able to see the operation but I am not able to see any OCL implementation.

>>Any idea?

 

Thanks for your help.

 

Francois

 

 

[1]: https://bugs.eclipse.org/bugs/attachment.cgi?id=256993

[2]: Requirement

 

16.3.2.4 Requirement

Constraints

[1] The property “ownedOperation” must be empty.

[2] The property “ownedAttribute” must be empty.

[3] Classes stereotyped by  «requirement» may not participate in associations.

[4] Classes stereotyped by  «requirement» may not participate in generalizations.

[5] A nested classifier of a class stereotyped by «requirement» must also be stereotyped by «requirement».

[6] Classes stereotyped by «requirement» may not be used to type any other model element.

Operations

[1] Requirement::getSatisfiedBy : Set(NamedElement)

getSatisfiedBy = Satisfy.allInstances()->select(base_class.supplier=self).

  base_Abstraction.client

[2] Requirement::getVerifiedBy : Set(NamedElement)

getVerifiedBy = Verify.allInstances()->select(base_Abstraction.supplier=self).

  base_class.client

[3] Requirement::getTracedTo() : Set(NamedElement)

getTracedTo =Trace.allInstances()->select(base_Abstraction.client=self).

  base_class.supplier

[4] Requirement::getDerived() : Set(Requirement)

getDerived = DeriveReqt.allInstances()->select(base_Abstraction.supplier=self).

  base_class.client

[5] Requirement::getDerivedFrom() : Set(Requirement)

getDerivedFrom = DeriveReqt.allInstances()->select(base_Abstraction.client=self).

  base_class.supplier

[6] Requirement::getRefinedBy: Set(NamedElement)

getRefinedBy = Refine.allInstances()->select(base_Abstraction.supplier=self).

  base_class.client

[7] Requirement::getMaster() : Requirement

getMaster = Copy.allInstances()->select(base_Abstraction.client=self).base_class.supplier

 

cid:part1.06060709.08040600@ericsson.com

mailbox:///C:/Users/Edward/AppData/Roaming/Thunderbird/Profiles/x6nb8pes.default/Mail/mail.plus.net/Inbox?number=64052047&header=quotebody&part=1.1.1.3&filename=image002.jpg

Francois LE FEVRE

Research Engineer

Commission for Atomic Energy and Alternative Energies (CEA)

Model-driven Engineering for Embedded Systems Laboratory (LISE)

Projet: Papyrus: https://www.eclipse.org/papyrus/

cid:part5.02030405.05090707@ericsson.com

Commissariat à l’énergie atomique et aux énergies alternatives (CEA)

Paris-Saclay Campus - Nano-INNOV | Bât. 862-PC1087 | F-91191 Gif-sur-Yvette Cedex

T. +33 (0)1 69 08 49 86  |  F. +33 (0)1 69 08 83 95  |

francois.le-fevre@xxxxxx   |  Blog: http://biocamp.blogspot.fr/

 

 




_______________________________________________
mdt-papyrus.dev mailing list
mdt-papyrus.dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mdt-papyrus.dev

 



_______________________________________________
mdt-papyrus.dev mailing list
mdt-papyrus.dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mdt-papyrus.dev


Back to the top