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]

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
_______________________________________________
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