Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Loading oclxmi files
Loading oclxmi files [message #1749445] Tue, 06 December 2016 19:41 Go to next message
Edouard R. Batot is currently offline Edouard R. BatotFriend
Messages: 100
Registered: March 2015
Senior Member
I'm currently working on a generic piece of software dealing with OCL abstract trees (ASTs). Generic means that models, metamodels, OCL files etc. are provided as input, they cannot be loaded, registered or what so ever by any clic. I don't use GUI nor any Eclipse plugin dependancy (standalone fever).

Context : I load a metamodel (which is registered properly) and models on the fly without problems. To do so, I use the EMF and EMF-OCL librari(es). I manipulate OCL constraints (their AST) programmatically.

My problem is this one : how to load a set of constraints from a XMI for OCL file (usual extension is .oclxmi) ? I do load ocl (.ocl) files, no problem, but XMI ocl, I can't. (And, of course, the constraints I intend to use are encoded in XMI...)

When I try to do the lines from the tutos,
Resource res = Metamodel.resourceSet.getResource(
URI.createPlatformResourceURI(f1.getAbsolutePath(), true), true   );


A Runtime exception is thrown : The resource cannot be created because "a registered resource factory is needed". Needless to say the this resourceSet (provided by the Metamodel class) is used to instanciate the conforming models. Am I wrong when I try to use the same resource set ?

Any hint of hope will be appreciated.

Thank you very much for your attention.
Edouard

PS : it is all made programmatically, with basic Java.
(PPS : note that links in the manual (From the OCL Examples page) are not working :
http://help.eclipse.org/luna/topic/org.eclipse.ocl.doc/help/CompleteOCLTutorial
http://help.eclipse.org/luna/topic/org.eclipse.ocl.doc/help/OCLinEcoreTutorial
(they are easily found via search engines) )

[Updated on: Tue, 06 December 2016 19:56]

Report message to a moderator

Re: Loading oclxmi files [message #1749471 is a reply to message #1749445] Wed, 07 December 2016 07:23 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I hope that you use "EMF-OCL" loosely. The org.eclipse.emf.ocl plugins moved to org.eclipse.ocl 10 years ago.

XMI is a major problem for OMG OCL; the specification is just not adequate.

Classic Eclipse OCL has a proprietary OCL serialization that is used by Acceleo and Eclipse QVTo, but it doesn't solve the problem. IIRC *.oclxmi was a slightly accidental aspiration.

The Pivot Eclipse OCL prototypes solutions to the problems. The XMI serialization is *.oclas. It extends to e.g. *.qvtcas and *.qvtras. (OCL->Save Abstract Syntax in an OCL or QVTd editor).

e.g. The Pivot model itself: GIT\org.eclipse.ocl\plugins\org.eclipse.ocl.pivot\model-gen\Pivot.oclas
The OCL standard library: GIT\org.eclipse.ocl\plugins\org.eclipse.ocl.pivot\model-gen\OCL-2.5.oclas

*.oclas corresponds to a standard EMF Resource. Just load and save.

If you already have a ResourceSet just newInstance an org.eclipse.ocl.pivot.utilities.OCL to exploit it.

GIT\org.eclipse.ocl\tests\org.eclipse.ocl.examples.xtext.tests\src\org\eclipse\ocl\examples\test\xtext\OCLstdlibTests.java testOCLstdlib_AS() may provide some clues.

The Pivot 1.x model is fairly stable, but will go through one rationalization for 2.x and OMG specification update.

Regards

Ed Willink
Re: Loading oclxmi files [message #1749518 is a reply to message #1749471] Wed, 07 December 2016 17:05 Go to previous messageGo to next message
Edouard R. Batot is currently offline Edouard R. BatotFriend
Messages: 100
Registered: March 2015
Senior Member
Hi Ed, thanks for your expertise.

Quote:
XMI is a major problem for OMG OCL; the specification is just not adequate.

That is what I realized in the last days. I'm (half) surprised that most of the OCL I found in modellers repositories (made by academics) is yet serialized in XMI (oclxmi I mean).

I'll have a close look to the Pivot Eclipse OCL. I am myself in the academia and I don't really mind a version change (not too much) as you could see in my "loose" vocabulary about plugins and libraries. I actually use org.eclipse.ocl plugins (and it took me to investigate the ''dummy'' files to understand the other (.emf.) one was out of date !)

Thanks Ed,
Have a good day.
Edouard

Re: Loading oclxmi files [message #1749521 is a reply to message #1749518] Wed, 07 December 2016 17:25 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Quote:
I'm (half) surprised that most of the OCL I found in modellers repositories (made by academics) is yet serialized in XMI (oclxmi I mean).


I think you missed a negative. Fortunately the OCL concrete syntax is fairly obvious and so OCL survives the specification inadequacy. However you will find that rectifying the missing 'import' is a bit magic across tools.

Quote:
I actually use org.eclipse.ocl plugins


Use org.eclipse.ocl.pivot for the newer Pivot model.

Section 6 of http://www.omg.org/cgi-bin/doc?ad/2014-03-05 provides a fairly comprehensive summary of OCL 2.x problems pitched as requirements on OCL 2.5 (or whatever the next real version turns out to be.)

Regards

Ed Willink
Re: Loading oclxmi files [message #1749634 is a reply to message #1749521] Thu, 08 December 2016 19:22 Go to previous messageGo to next message
Edouard R. Batot is currently offline Edouard R. BatotFriend
Messages: 100
Registered: March 2015
Senior Member
Ed,
I don't want to make it neverending, but I would just add that I apologize for my sometimes very superficial considerations of the comments scattered among the web.

This is what I found somewhere in the modellers' repositories :

index.php/fa/27811/0/

Thanks for your advices.

Have a good one,
Edouard
  • Attachment: Capture.PNG
    (Size: 7.84KB, Downloaded 446 times)
Re: Loading oclxmi files [message #1749635 is a reply to message #1749634] Thu, 08 December 2016 19:36 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I am totally confused by your not-neverending comment. Do you think that you are quoting a contradiction/confirmation/.... ?

Regards

Ed Willink
Re: Loading oclxmi files [message #1749636 is a reply to message #1749635] Thu, 08 December 2016 19:46 Go to previous message
Edouard R. Batot is currently offline Edouard R. BatotFriend
Messages: 100
Registered: March 2015
Senior Member
Non non non, I'm just confused I found today a comment from you about the source of the artefacts I'm supposed to use - which is a fair and clear warning.
I'm confused I found it after questionning you about the OCL/XMI relation.
The precisions you added here (emf / Pivot / OCL2.x) were very usefull though. Thanks.

The not-never-not-ending comment (french people uses negation way too much, sorry 'bout that) is just that I wanted to mention I didn't want to waste your and others' time.

Have a good day,
Edouard
Previous Topic:pre and post conditions in OCL metamodel
Next Topic:OCL in Ecore metamodel
Goto Forum:
  


Current Time: Thu Apr 18 15:16:25 GMT 2024

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

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

Back to the top