Home » Modeling » EMF » Xcore and OCL
| |
Re: Xcore and OCL [message #1041570 is a reply to message #1041549] |
Mon, 15 April 2013 09:04 |
David Michonneau Messages: 85 Registered: July 2009 |
Member |
|
|
Thanks for the reply. Actually I didn't try to use the OCLinEcoreEditor since it's bound to ecore, but I'm looking now at the CompleteOCLEditor
(http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.ocl.doc%2Fhelp%2FCompleteOCLTutorial.html) ,
and the example of Validation Constraint extension to EMF to plug an OCL contraint in EMF validator framework. http://wiki.eclipse.org/EMF-QTV_1.1_New_and_Noteworthy#New_Validation_Constraint_Provider_Example
So the problem now is that this OCL editor expects either an ecore file as import input (I tried with xcore with no success) or a namespace of my model. I'm trying to get this namespace import to work, probably something like:
import mymodel 'http://mymodelURI/#'
It seems to me it should work regardless of ecore/xcore, since it goes through the namespaces to find the model definition. But I still struggle to get this parsed, I get "Unresolved import 'http://myproduct/#' : Invalid signature for
a binary EMF serialization", and I don't even know if it will find my model while editing, since no extension is loaded while I'm in the OCL editor. If anybody managed to have this working, any tip would be helpful.
Otherwise I will give up on OCL and use annotations with EMF constraints, but it's a pity, as it pollutes the model interfaces with new methods (it took me a while to understand how to implement them in xcore, but I finally managed to do it, although there is a bit of circular compilation problem, that has been reported as bug and fixed, although it still happens on Juno SR2 for me: https://bugs.eclipse.org/bugs/show_bug.cgi?id=387015).
Thanks,
David
|
|
|
Re: Xcore and OCL [message #1041597 is a reply to message #1041570] |
Mon, 15 April 2013 09:40 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
You should spend some more time with the examples, since your problems
all look to be very novice. The editors work for Ecore or UML and if
Xcore looks like Ecore then for Xcore as well.
"use annotations with EMF constraints" is meaningless.
If you intend to handwrite OCL in EMF constraints then sort out your
problems with the new OCL tooling.
If you mean to use Java implemented EMF constraints, then learn to use
Xcore properly.
Regards
Ed Willink
On 15/04/2013 10:04, David Michonneau wrote:
> Thanks for the reply. Actually I didn't try to use the
> OCLinEcoreEditor since it's bound to ecore, but I'm looking now at the
> CompleteOCLEditor
> (http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.ocl.doc%2Fhelp%2FCompleteOCLTutorial.html)
> ,
> and the example of Validation Constraint extension to EMF to plug an
> OCL contraint in EMF validator framework.
> http://wiki.eclipse.org/EMF-QTV_1.1_New_and_Noteworthy#New_Validation_Constraint_Provider_Example
>
> So the problem now is that this OCL editor expects either an ecore
> file as import input (I tried with xcore with no success) or a
> namespace of my model. I'm trying to get this namespace import to
> work, probably something like:
>
> import mymodel 'http://mymodelURI/#'
>
> It seems to me it should work regardless of ecore/xcore, since it goes
> through the namespaces to find the model definition. But I still
> struggle to get this parsed, I get "Unresolved import
> 'http://myproduct/#' : Invalid signature for
> a binary EMF serialization", and I don't even know if it will find
> my model while editing, since no extension is loaded while I'm in the
> OCL editor. If anybody managed to have this working, any tip would be
> helpful.
>
> Otherwise I will give up on OCL and use annotations with EMF
> constraints, but it's a pity, as it pollutes the model interfaces with
> new methods (it took me a while to understand how to implement them in
> xcore, but I finally managed to do it, although there is a bit of
> circular compilation problem, that has been reported as bug and fixed,
> although it still happens on Juno SR2 for me:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=387015).
>
> Thanks,
>
> David
|
|
|
Re: Xcore and OCL [message #1041608 is a reply to message #1041597] |
Mon, 15 April 2013 10:10 |
David Michonneau Messages: 85 Registered: July 2009 |
Member |
|
|
Ed,
I don't know what editors you mention that work with both ecore and xcore. I haven't managed to make any OCL editor work with my xcore model so far, and that is basically my question. There is no OCL examples based on xcore, or I haven't found them.
When I mention "use annotations with EMF constraints", I am referring to ecore constraints annotations (as mentioned in chapter 18 of the EMF book, Validation framework). I succeeded to make them work, but I would rather not use this, because they create new operations in my xcore model, and I prefer declarative OCL constraints anyway. I guess that is what you mean by "use Java Implemented EMF constraints".
I don't either intend to handwrite OCL in EMF constraints, because as you mention there would be no OCL syntax checking as the OCLinEcoreEditor doesn't work with xcore.
So, the only lead that is left to me is to use the completeocl editor, and refer to my model within it. I see I can do some import, but it does not support importing an xcore, even through a URI that is registered in the OCL model registry of my project. Or at least I didn't succeed. I have spent a full day on the examples, with no success to get anything working yet with an xcore model. I would greatly appreciate any help in this direction.
Thanks,
David
|
|
|
Re: Xcore and OCL [message #1041632 is a reply to message #1041608] |
Mon, 15 April 2013 10:51 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
Xcore is a new better integrated technology for those who aspiration is
limited to Java. It hides the original *.ecore and *.genmodel files.
If you want to work with OCL then most of the extra Java-related
functionality of Xcore is counterproductive and you should use a
traditional *.ecore file. I presume that Xcore has an export to Ecore
capability.
Regards
Ed Willink
On 15/04/2013 11:10, David Michonneau wrote:
> Ed,
>
> I don't know what editors you mention that work with both ecore and
> xcore. I haven't managed to make any OCL editor work with my xcore
> model so far, and that is basically my question. There is no OCL
> examples based on xcore, or I haven't found them.
>
> When I mention "use annotations with EMF constraints", I am referring
> to ecore constraints annotations (as mentioned in chapter 18 of the
> EMF book, Validation framework). I succeeded to make them work, but I
> would rather not use this, because they create new operations in my
> xcore model, and I prefer declarative OCL constraints anyway. I guess
> that is what you mean by "use Java Implemented EMF constraints".
>
> I don't either intend to handwrite OCL in EMF constraints, because as
> you mention there would be no OCL syntax checking as the
> OCLinEcoreEditor doesn't work with xcore.
>
> So, the only lead that is left to me is to use the completeocl editor,
> and refer to my model within it. I see I can do some import, but it
> does not support importing an xcore, even through a URI that is
> registered in the OCL model registry of my project. Or at least I
> didn't succeed. I have spent a full day on the examples, with no
> success to get anything working yet with an xcore model. I would
> greatly appreciate any help in this direction.
>
> Thanks,
>
> David
>
>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 08:49:04 GMT 2024
Powered by FUDForum. Page generated in 0.04646 seconds
|