OCL Editor [message #1064630] |
Thu, 20 June 2013 10:09  |
Eclipse User |
|
|
|
Hi.
I am looking for a way to model OCL invariants (e.g., for Ecore models) like an ordinary model using the tree-based EMF instance editor. Is there a way to do this? If so, which OCL meta model (which nsURI) do I have to use?
Regards,
Thorsten
|
|
|
|
Re: OCL Editor [message #1065115 is a reply to message #1064688] |
Mon, 24 June 2013 12:19   |
Eclipse User |
|
|
|
Thank you, Adolfo, for the response. But I think this is not the point I am looking for. What I want to do is:
1. Model an OCL expression/invariant for an element (EClass) within an xy.ecore model.
2. Model a transformation from OCL to an other constraints language (constr.ecore) using a model2model-transformation engine like Henshin or ATL.
3. Transform the expression from (1) to an instance of constr.ecore by using the transformation from (2).
Therefore, I need some ways to model the expression in (1) in a more abstract way (the AST) and to use the corresponding nsURI in step (2).
Best regards,
Thorsten
|
|
|
Re: OCL Editor [message #1065165 is a reply to message #1065115] |
Mon, 24 June 2013 14:49   |
Eclipse User |
|
|
|
Hi Throsten,
You have the classic Ecore-binded OCL metamodel at
org.eclipse.ocl.ecore/model
You have the new Pivot-based OCL metamodel at
org.eclipse.ocl.examples.pivot/model
You can import sources from your Eclipse installation or use the GIT
repository [1]
I hope this helps.
Cheers,
Adolfo.
[1] git://git.eclipse.org/gitroot/mdt/org.eclipse.ocl.git
On 24/06/2013 13:19, Thorsten Arendt wrote:
> Thank you, Adolfo, for the response. But I think this is not the point I
> am looking for. What I want to do is:
> 1. Model an OCL expression/invariant for an element (EClass) within an
> xy.ecore model.
> 2. Model a transformation from OCL to an other constraints language
> (constr.ecore) using a model2model-transformation engine like Henshin or
> ATL.
> 3. Transform the expression from (1) to an instance of constr.ecore by
> using the transformation from (2).
>
> Therefore, I need some ways to model the expression in (1) in a more
> abstract way (the AST) and to use the corresponding nsURI in step (2).
>
> Best regards,
> Thorsten
|
|
|
Re: OCL Editor [message #1065175 is a reply to message #1065115] |
Mon, 24 June 2013 15:15   |
Eclipse User |
|
|
|
HI
On 24/06/2013 13:19, Thorsten Arendt wrote:
> Thank you, Adolfo, for the response. But I think this is not the point
> I am looking for. What I want to do is:
> 1. Model an OCL expression/invariant for an element (EClass) within an
> xy.ecore model.
You probably want to do this using the OCLinEcore editor.
> 2. Model a transformation from OCL to an other constraints language
> (constr.ecore) using a model2model-transformation engine like Henshin
> or ATL.
There is currently no direct exposure of a coherent Ecore + OCL AST that
can be loaded directly by another tool,
[Within the OCLinEcore editor there is a SaveAs Pivot option, but I can
just about guarantee that while it may save the result it will not be
loadable; https://bugs.eclipse.org/bugs/show_bug.cgi?id=402780]
.... so you need to load the *.ecore into memory yourself.
As Adolfo mentioned you can use the classic functionality to load the
*.ecore as an Ecore model and perhaps then use some of the
....ecore.delegate to convert each OCL text expression to its AST.
Or you can use the pivot functionality to load the *.ecore as an Ecore
model, perform an OCL.ecore2pivot() conversion for the resource (the OCL
text will be in the form of OpaqueExpression). You can use
PivotUtil.getExpressionInOCL to promote these to AST form.
> 3. Transform the expression from (1) to an instance of constr.ecore by
> using the transformation from (2).
>
> Therefore, I need some ways to model the expression in (1) in a more
> abstract way (the AST) and to use the corresponding nsURI in step (2).
>
> Best regards,
> Thorsten
|
|
|
Re: OCL Editor [message #1065221 is a reply to message #1065175] |
Mon, 24 June 2013 20:36   |
Eclipse User |
|
|
|
Hi Ed.
Nice to hear from you! Do you remember me? I am the EMF Refactor guy that talked to you at ECE2012 in Ludwigsburg.
Thanks for your answers. Here are my comments:
>> 1. Model an OCL expression/invariant for an element (EClass) within an
>> xy.ecore model.
> You probably want to do this using the OCLinEcore editor.
OK. I will do this.
> There is currently no direct exposure of a coherent Ecore + OCL AST that
> can be loaded directly by another tool,
But I can import and use the pivot model within a transformation rule, can't I?
> ... so you need to load the *.ecore into memory yourself.
You mean, I need to load the *.ecore file consisting of the structure model AND the OCL invariants (modeled using the OCLinEcore editor) programmatically as usual in EMF?
> you can use the pivot functionality to load the *.ecore as an Ecore
> model, perform an OCL.ecore2pivot() conversion for the resource (the OCL
> text will be in the form of OpaqueExpression). You can use
> PivotUtil.getExpressionInOCL to promote these to AST form.
Hm. Class 'org.eclipse.ocl.examples.pivot.utilities.PivotUtil' does not have such method 'getExpressionInOCL()'...
Best regards,
Thorsten
|
|
|
Re: OCL Editor [message #1065249 is a reply to message #1065221] |
Tue, 25 June 2013 06:22   |
Eclipse User |
|
|
|
Hi
On 24/06/2013 21:36, Thorsten Arendt wrote:
> Hi Ed.
> Nice to hear from you! Do you remember me? I am the EMF Refactor guy
> that talked to you at ECE2012 in Ludwigsburg.
Oh Yes. How's the integration with Xtext doing? With QVTd progressing,
I'm increasingly interesrting in adding transformatyion-defined
refactorings to editors.
>> There is currently no direct exposure of a coherent Ecore + OCL AST
>> that can be loaded directly by another tool,
>
> But I can import and use the pivot model within a transformation rule,
> can't I?
Pivot.ecore is an ordinary Ecore model, so you can use the Pivot
meta-model as any other Ecore meta-model.
The difference is that the Pivot Model is usually loaded from something
defined against the Ecore or UML meta-models.
>
>> ... so you need to load the *.ecore into memory yourself.
>
> You mean, I need to load the *.ecore file consisting of the structure
> model AND the OCL invariants (modeled using the OCLinEcore editor)
> programmatically as usual in EMF?
Yes. The OCL will be embedded in EAnnotations.
>
>> you can use the pivot functionality to load the *.ecore as an Ecore
>> model, perform an OCL.ecore2pivot() conversion for the resource (the
>> OCL text will be in the form of OpaqueExpression). You can use
>> PivotUtil.getExpressionInOCL to promote these to AST form.
>
> Hm. Class 'org.eclipse.ocl.examples.pivot.utilities.PivotUtil' does
> not have such method 'getExpressionInOCL()'...
It's new in Kepler, making previous delegate/test functionality more
available to the code generator.
Regards
Ed
|
|
|
Re: OCL Editor [message #1065791 is a reply to message #1065249] |
Thu, 27 June 2013 13:35   |
Eclipse User |
|
|
|
Hi Ed.
Quote:How's the integration with Xtext doing? With QVTd progressing,
I'm increasingly interesrting in adding transformatyion-defined
refactorings to editors.
I just presented a preliminary version at EclipseDemoCamp in Bonn last week. The refactoring functionality does what it is supposed to be. But unfortunately I have to cope with problems concerning the layout. If I will have time I try to fix it. Perhaps I present it at EclipseConEurope 2013.
Quote:
> You mean, I need to load the *.ecore file consisting of the structure
> model AND the OCL invariants (modeled using the OCLinEcore editor)
> programmatically as usual in EMF?
Yes. The OCL will be embedded in EAnnotations.
OK. This works...
Quote:
>> you can use the pivot functionality to load the *.ecore as an Ecore
>> model, perform an OCL.ecore2pivot() conversion for the resource (the
>> OCL text will be in the form of OpaqueExpression). You can use
>> PivotUtil.getExpressionInOCL to promote these to AST form.
>
> Hm. Class 'org.eclipse.ocl.examples.pivot.utilities.PivotUtil' does
> not have such method 'getExpressionInOCL()'...
It's new in Kepler, making previous delegate/test functionality more
available to the code generator.
Unfortunately, the OCL.ecore2pivot() conversion raises an exception with the following stack trace:
Exception in thread "main" org.eclipse.ocl.examples.pivot.utilities.IllegalLibraryException: No OCL Standard Library content available
at org.eclipse.ocl.examples.pivot.manager.PivotStandardLibrary.getRequiredLibraryType(PivotStandardLibrary.java:278)
at org.eclipse.ocl.examples.pivot.manager.PivotStandardLibrary.resolveRequiredSimpleType(PivotStandardLibrary.java:377)
at org.eclipse.ocl.examples.pivot.manager.PivotStandardLibrary.getBooleanType(PivotStandardLibrary.java:127)
at org.eclipse.ocl.examples.pivot.ecore.Ecore2Pivot.initializeEcore2PivotMap(Ecore2Pivot.java:482)
at org.eclipse.ocl.examples.pivot.ecore.Ecore2Pivot.getEcore2PivotMap(Ecore2Pivot.java:326)
at org.eclipse.ocl.examples.pivot.ecore.Ecore2Pivot.resolveDataType(Ecore2Pivot.java:612)
at org.eclipse.ocl.examples.pivot.ecore.Ecore2Pivot.resolveType(Ecore2Pivot.java:667)
at org.eclipse.ocl.examples.pivot.ecore.Ecore2Pivot.update(Ecore2Pivot.java:749)
at org.eclipse.ocl.examples.pivot.ecore.Ecore2Pivot.importObjects(Ecore2Pivot.java:467)
at org.eclipse.ocl.examples.pivot.ecore.Ecore2Pivot.getPivotRoot(Ecore2Pivot.java:412)
at org.eclipse.ocl.examples.pivot.OCL.ecore2pivot(OCL.java:385)
Here is also my code. What am I doing wrong?
// Convert resource (OCL text in EAnnotations => OpaqueExpression)
OCL ocl = OCL.newInstance();
ocl.initialize(resourceSet);
try {
ocl.ecore2pivot(petrinetResource);
} catch (ParserException e) {
e.printStackTrace();
}
Regards,
Thorsten
|
|
|
Re: OCL Editor [message #1065836 is a reply to message #1065791] |
Thu, 27 June 2013 16:50   |
Eclipse User |
|
|
|
Hi
On 27/06/2013 14:35, Thorsten Arendt wrote:
> Unfortunately, the OCL.ecore2pivot() conversion raises an exception
> with the following stack trace:
>
> Exception in thread "main"
> org.eclipse.ocl.examples.pivot.utilities.IllegalLibraryException: No
> OCL Standard Library content available
I refreshed the relevant description in the Kepler OCL Documentation.
Search for "No OCL Standard Library content available"
Regards
Ed Willink
|
|
|
Re: OCL Editor [message #1065919 is a reply to message #1065836] |
Fri, 28 June 2013 10:28   |
Eclipse User |
|
|
|
Hi Ed!
Thanks for the docu. Now I can translate a textual description of the OCL invariant within an EAnnotation to (1) a textual description within an OpaqueExpression, and then (2) to the AST representation of an ExpressionInOCL. Afterwards I replace the OpaqueExpression by the ExpressionInOCL. This is exactly what I want. But...
After persisting the resource as a *.pivot, there are problems when opening it both via the sample reflective editor and by API. For each 'ownedType' within a package I get an IllegalValueException:
org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'org.eclipse.ocl.examples.pivot.internal.impl.TypeImpl' is not legal. (platform:/resource/PetriNet/model/PetriNet-converted-changed.pivot, 6, 149)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2671)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2656)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFeatureType(XMLHandler.java:2174)
...
Caused by: java.lang.ArrayStoreException
This really confuses me... any help?
Regards,
Thorsten
|
|
|
Re: OCL Editor [message #1065932 is a reply to message #1065919] |
Fri, 28 June 2013 11:32  |
Eclipse User |
|
|
|
Hi
I raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=402780 to major
in response to a similar query a couple of days ago.
I am currently working on the direct generation of the Pivot meta model
from UML 2.5 and other metamodels. This should lead on to solving the
loadability.
Regards
Ed Willink
On 28/06/2013 11:28, Thorsten Arendt wrote:
> Hi Ed!
>
> Thanks for the docu. Now I can translate a textual description of the
> OCL invariant within an EAnnotation to (1) a textual description
> within an OpaqueExpression, and then (2) to the AST representation of
> an ExpressionInOCL. Afterwards I replace the OpaqueExpression by the
> ExpressionInOCL. This is exactly what I want. But...
>
> After persisting the resource as a *.pivot, there are problems when
> opening it both via the sample reflective editor and by API. For each
> 'ownedType' within a package I get an IllegalValueException:
>
> org.eclipse.emf.ecore.xmi.IllegalValueException: Value
> 'org.eclipse.ocl.examples.pivot.internal.impl.TypeImpl' is not legal.
> (platform:/resource/PetriNet/model/PetriNet-converted-changed.pivot,
> 6, 149)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2671)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2656)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFeatureType(XMLHandler.java:2174)
> ...
> Caused by: java.lang.ArrayStoreException
>
> This really confuses me... any help?
>
> Regards,
> Thorsten
|
|
|
Powered by
FUDForum. Page generated in 0.05926 seconds