Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » transform completeocl resource
transform completeocl resource [message #1016247] Tue, 05 March 2013 16:01 Go to next message
Fernando Ayata is currently offline Fernando AyataFriend
Messages: 12
Registered: February 2013
Junior Member
dear All,
I try to use the completeocl editor to define ocl constraints transformed after into another local language.
So I try to generate the xmi for completeocl used after by M2M technologies to generate my output file.
I don't know how to generate xmi file.
I find this important message http://www.eclipse.org/forums/index.php/mv/msg/442759/993174/#msg_993174
I try to test this method
public void testCompleteOCLRoundTrip_Names()
but I dont find where is the generated xmi file
and I dont know which is the appropriate resource pivotResource1, pivotResource2, or pivotResource3

please help me
thanks
Re: transform completeocl resource [message #1016277 is a reply to message #1016247] Tue, 05 March 2013 19:16 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The generated files are all at the equivalent position in the bin folder.

The tests generate resources in different ways and check that they are
the same. You can use whichever way is convenient for you.

Regards

Ed Willink


On 05/03/2013 16:01, Fernando Ayata wrote:
> dear All,
> I try to use the completeocl editor to define ocl constraints
> transformed after into another local language.
> So I try to generate the xmi for completeocl used after by M2M
> technologies to generate my output file.
> I don't know how to generate xmi file.
> I find this important message
> http://www.eclipse.org/forums/index.php/mv/msg/442759/993174/#msg_993174
> I try to test this method
> public void testCompleteOCLRoundTrip_Names()
> but I dont find where is the generated xmi file
> and I dont know which is the appropriate resource pivotResource1,
> pivotResource2, or pivotResource3
>
> please help me
> thanks
Re: transform completeocl resource [message #1016376 is a reply to message #1016247] Wed, 06 March 2013 09:51 Go to previous messageGo to next message
Fernando Ayata is currently offline Fernando AyataFriend
Messages: 12
Registered: February 2013
Junior Member
Dear Ed,
Thank you very much for your reply!!
I find the bin folder and when I run RoundTripTests,
a Names.regenerated.ocl is generated
BUT, I would like to find the XMI intermediate file.
If I understand correctly your code of doRoundTripFromCompleteOCL method,
I should save the pivot resource, that is right?
which one?
pivotResource1? or pivotResource2?

I am sorry for these multiple questions. I am a new user of EMF Xtext and EMF technologies Sad

Thanks
Re: transform completeocl resource [message #1016563 is a reply to message #1016376] Wed, 06 March 2013 22:48 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

BaseCSResource xtextResource1 =
createXtextFromURI(metaModelManager1, inputURI);
PivotResource pivotResource1 =
createPivotFromXtext(metaModelManager1, xtextResource1, 1);

should be enough to complete the transformation from text file to pivot
model.

Seve should just work, but if you end up with danging references call
PivotUtil.localizeSpecializations first.

Regards

Ed Willink

On 06/03/2013 09:51, Fernando Ayata wrote:
> Dear Ed,
> Thank you very much for your reply!!
> I find the bin folder and when I run RoundTripTests,
> a Names.regenerated.ocl is generated
> BUT, I would like to find the XMI intermediate file.
> If I understand correctly your code of doRoundTripFromCompleteOCL method,
> I should save the pivot resource, that is right?
> which one?
> pivotResource1? or pivotResource2?
>
> I am sorry for these multiple questions. I am a new user of EMF Xtext
> and EMF technologies :(
>
> Thanks
>
Re: transform completeocl resource [message #1016598 is a reply to message #1016563] Thu, 07 March 2013 05:41 Go to previous messageGo to next message
Fernando Ayata is currently offline Fernando AyataFriend
Messages: 12
Registered: February 2013
Junior Member
Dear Ed,
thank you for your reply.
I would like just to verify if I take the good way.
I add required code for dangling references and to save the pivot resource.
Is it correct, Please?
public void doRoundTripFromCompleteOCL(URI inputURI) throws IOException, InterruptedException {
		        .....
			.....
			BaseCSResource xtextResource1 = createXtextFromURI(metaModelManager1, inputURI);
			
			PivotResource pivotResource1 = createPivotFromXtext(metaModelManager1, xtextResource1, 1);

                        //revsolve dangling references
			PivotUtil.localizeSpecializations(pivotResource1);
			
                        //save pivot resource 
			Resource resourceAsXmi = resourceSet.createResource(URI.createURI(xtextResource1.getURI().toString()+".pivot"));
			resourceAsXmi.getContents().addAll(pivotResource1.getContents());
			resourceAsXmi.save(null);
                        .....
                        .....

Re: transform completeocl resource [message #1016765 is a reply to message #1016598] Thu, 07 March 2013 15:45 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Quite possibly. But if you expect me to test your code for you we had
better start discussing consultancy fees.

Regards

Ed Willink

On 07/03/2013 05:41, Fernando Ayata wrote:
> Dear Ed,
> thank you for your reply.
> I would like just to verify if I take the good way.
> I add required code for dangling references and to save the pivot
> resource.
> Is it correct, Please?
> public void doRoundTripFromCompleteOCL(URI inputURI) throws
> IOException, InterruptedException {
> .....
> .....
> BaseCSResource xtextResource1 =
> createXtextFromURI(metaModelManager1, inputURI);
>
> PivotResource pivotResource1 =
> createPivotFromXtext(metaModelManager1, xtextResource1, 1);
>
> //revsolve dangling references
> PivotUtil.localizeSpecializations(pivotResource1);
>
> //save pivot resource Resource
> resourceAsXmi =
> resourceSet.createResource(URI.createURI(xtextResource1.getURI().toString()+".pivot"));
>
> resourceAsXmi.getContents().addAll(pivotResource1.getContents());
> resourceAsXmi.save(null);
> .....
> .....
>
>
Re: transform completeocl resource [message #1016776 is a reply to message #1016765] Thu, 07 March 2013 16:43 Go to previous messageGo to next message
Fernando Ayata is currently offline Fernando AyataFriend
Messages: 12
Registered: February 2013
Junior Member
Dear Ed,
Thank you for reply
I test it, and I had the pivot model.
I just asked if my added code is correct or not Smile
So, for the Names.ocl, the output is the following.
Is it the expected model?
I mean that this model can be used by M2M transformation (ATL, QVT)?


<?xml version="1.0" encoding="ASCII"?>
<pivot:Root xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pivot="http://www.eclipse.org/ocl/3.1.0/Pivot" name="Names.ocl" externalURI="file:/Users/ayata/Modeling/workspace_juno_06032013/ocl/tests/org.eclipse.ocl.examples.xtext.tests/bin/org/eclipse/ocl/examples/test/xtext/models/Names.ocl">
  <nestedPackage name="names" nsURI="http://names">
    <ownedType xsi:type="pivot:Class" name="Named">
      <ownedAttribute name="r">
        <ownedRule constrainedElement="//@nestedPackage.0/@ownedType.0/@ownedAttribute.0" stereotype="initial">
          <specification xsi:type="pivot:ExpressionInOCL">
            <type href="http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib#//@nestedPackage.1/@ownedType.20"/>
            <body xsi:nil="true"/>
            <language>OCL</language>
            <message xsi:nil="true"/>
            <bodyExpression xsi:type="pivot:RealLiteralExp" realSymbol="0.0">
              <type href="http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib#//@nestedPackage.1/@ownedType.20"/>
            </bodyExpression>
            <contextVariable name="self">
              <type href="pivot:/file/Users/ayata/Modeling/workspace_juno_06032013/ocl/tests/org.eclipse.ocl.examples.xtext.tests/bin/org/eclipse/ocl/examples/test/xtext/models/Names.ecore#//@nestedPackage.0/@ownedType.0"/>
            </contextVariable>
          </specification>
        </ownedRule>
        <type href="pivot://www.eclipse.org/http/emf/2002/Ecore#//@nestedPackage.0/@ownedType.31"/>
      </ownedAttribute>
      <ownedAttribute name="s">
        <ownedRule constrainedElement="//@nestedPackage.0/@ownedType.0/@ownedAttribute.1" stereotype="derivation">
          <specification xsi:type="pivot:ExpressionInOCL">
            <type href="http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib#//@nestedPackage.1/@ownedType.21"/>
            <body xsi:nil="true"/>
            <language>OCL</language>
            <message xsi:nil="true"/>
            <bodyExpression xsi:type="pivot:StringLiteralExp" stringSymbol="">
              <type href="http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib#//@nestedPackage.1/@ownedType.21"/>
            </bodyExpression>
            <contextVariable name="self">
              <type href="pivot:/file/Users/ayata/Modeling/workspace_juno_06032013/ocl/tests/org.eclipse.ocl.examples.xtext.tests/bin/org/eclipse/ocl/examples/test/xtext/models/Names.ecore#//@nestedPackage.0/@ownedType.0"/>
            </contextVariable>
          </specification>
        </ownedRule>
        <type href="http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib#//@nestedPackage.1/@ownedType.21"/>
      </ownedAttribute>
    </ownedType>
  </nestedPackage>
</pivot:Root>
Re: transform completeocl resource [message #1016783 is a reply to message #1016776] Thu, 07 March 2013 16:45 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Quite possibly. But if you expect me to test your code for you we had
better start discussing consultancy fees. I will not reply to similar
requests again.

Regards

Ed Willink


On 07/03/2013 16:43, Fernando Ayata wrote:
> Dear Ed,
> Thank you for reply I test it, and I had the pivot model.
> I just asked if my added code is correct or not :)
> So, for the Names.ocl, the output is the following.
> Is it the expected model? I mean that this model can be used by M2M
> transformation (ATL, QVT)?
>
>
>
> <?xml version="1.0" encoding="ASCII"?>
> <pivot:Root xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:pivot="http://www.eclipse.org/ocl/3.1.0/Pivot" name="Names.ocl"
> externalURI="file:/Users/ayata/Modeling/workspace_juno_06032013/ocl/tests/org.eclipse.ocl.examples.xtext.tests/bin/org/eclipse/ocl/examples/test/xtext/models/Names.ocl">
> <nestedPackage name="names" nsURI="http://names">
> <ownedType xsi:type="pivot:Class" name="Named">
> <ownedAttribute name="r">
> <ownedRule
> constrainedElement="//@nestedPackage.0/@ownedType.0/@ownedAttribute.0"
> stereotype="initial">
> <specification xsi:type="pivot:ExpressionInOCL">
> <type
> href="http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib#//@nestedPackage.1/@ownedType.20"/>
> <body xsi:nil="true"/>
> <language>OCL</language>
> <message xsi:nil="true"/>
> <bodyExpression xsi:type="pivot:RealLiteralExp" realSymbol="0.0">
> <type
> href="http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib#//@nestedPackage.1/@ownedType.20"/>
> </bodyExpression>
> <contextVariable name="self">
> <type
> href="pivot:/file/Users/ayata/Modeling/workspace_juno_06032013/ocl/tests/org.eclipse.ocl.examples.xtext.tests/bin/org/eclipse/ocl/examples/test/xtext/models/Names.ecore#//@nestedPackage.0/@ownedType.0"/>
> </contextVariable>
> </specification>
> </ownedRule>
> <type
> href="pivot://www.eclipse.org/http/emf/2002/Ecore#//@nestedPackage.0/@ownedType.31"/>
> </ownedAttribute>
> <ownedAttribute name="s">
> <ownedRule
> constrainedElement="//@nestedPackage.0/@ownedType.0/@ownedAttribute.1"
> stereotype="derivation">
> <specification xsi:type="pivot:ExpressionInOCL">
> <type
> href="http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib#//@nestedPackage.1/@ownedType.21"/>
> <body xsi:nil="true"/>
> <language>OCL</language>
> <message xsi:nil="true"/>
> <bodyExpression xsi:type="pivot:StringLiteralExp" stringSymbol="">
> <type
> href="http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib#//@nestedPackage.1/@ownedType.21"/>
> </bodyExpression>
> <contextVariable name="self">
> <type
> href="pivot:/file/Users/ayata/Modeling/workspace_juno_06032013/ocl/tests/org.eclipse.ocl.examples.xtext.tests/bin/org/eclipse/ocl/examples/test/xtext/models/Names.ecore#//@nestedPackage.0/@ownedType.0"/>
> </contextVariable>
> </specification>
> </ownedRule>
> <type
> href="http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib#//@nestedPackage.1/@ownedType.21"/>
> </ownedAttribute>
> </ownedType>
> </nestedPackage>
> </pivot:Root>
>
Re: transform completeocl resource [message #1016788 is a reply to message #1016783] Thu, 07 March 2013 17:04 Go to previous messageGo to next message
Fernando Ayata is currently offline Fernando AyataFriend
Messages: 12
Registered: February 2013
Junior Member
Hi,
I ask these questions because when I try to test a small identity transformation of the pivot model
with a very small ATL transformation
-- @path pivotMetaModel=/org.eclipse.ocl.examples.pivot/model/Pivot.ecore
-- @path copyMetaModel=/org.eclipse.ocl.examples.pivot/model/CopyPivot.ecore


module pivot2copy;
create copyModel : copyMetaModel from pivotModel : pivotMetaModel ;

rule Root2Root{
	from
		ins_Root: pivotMetaModel!Root
		(ins_Root.oclIsTypeOf(pivotMetaModel!Root))
	to
		link_Root: copyMetaModel!Root(

		)
}


I has this error
Error loading platform:/resource/IdentityTransformation/Names.ocl.pivot: The class 'Visitable' is not a valid classifier
I dont understand which is the source of the error!!!
Re: transform completeocl resource [message #1017066 is a reply to message #1016788] Fri, 08 March 2013 19:25 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I don;t really understand where your particular error comes from, but in
general a save of the pivot model has so far just been for debugging.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=402780 identifies some
problesm that need addressing to make a puivot model fully loadable.

[Normally the pivot model is created in memory by co-operative code for
on-the-fly usage.]

Regards

Ed Willink


On 07/03/2013 17:04, Fernando Ayata wrote:
> Hi,
> I ask these questions because when I try to test a small identity
> transformation of the pivot model
> with a very small ATL transformation
> -- @path pivotMetaModel=/org.eclipse.ocl.examples.pivot/model/Pivot.ecore
> -- @path
> copyMetaModel=/org.eclipse.ocl.examples.pivot/model/CopyPivot.ecore
>
>
> module pivot2copy;
> create copyModel : copyMetaModel from pivotModel : pivotMetaModel ;
>
> rule Root2Root{
> from
> ins_Root: pivotMetaModel!Root
> (ins_Root.oclIsTypeOf(pivotMetaModel!Root))
> to
> link_Root: copyMetaModel!Root(
>
> )
> }
>
>
> I has this error
> Error loading
> platform:/resource/IdentityTransformation/Names.ocl.pivot: The class
> 'Visitable' is not a valid classifier
> I dont understand which is the source of the error!!!
>
Re: transform completeocl resource [message #1017168 is a reply to message #1017066] Sun, 10 March 2013 12:05 Go to previous messageGo to next message
Fernando Ayata is currently offline Fernando AyataFriend
Messages: 12
Registered: February 2013
Junior Member
Dear Ed,
thank you for reply.
If I understand correctly, the Pivot Metamodel corresponds to the AST.
In this topic http://www.eclipse.org/forums/index.php/t/286882/,
The user try to save the AST also, but he doesn't encounter a similar problem
(That is why I asked you previously whether my added code is correct or not).
If he doesn't encounter a problem when he uses Acceleo, that means that my saved XMI is incorrect.
I try to modify the abstract attribute for Visitable meta-class in Pivot.ecore (true -> false), but I new problem appears which is
Error loading file://Users/ayata/Modeling/workspace_juno_06032013/ocl/tests/org.eclipse.ocl.examples.xtext.tests/bin/org/eclipse/ocl/examples/test/xtext/models/Names.ocl.pivot: org.eclipse.emf.ecore.xmi.IllegalValueException: Value '0.0' is not legal. (file://Users/ayata/Modeling/workspace_juno_06032013/ocl/tests/org.eclipse.ocl.examples.xtext.tests/bin/org/eclipse/ocl/examples/test/xtext/models/Names.ocl.pivot, 12, 78)


Do you have some ideas about using an completeocl resource by M2M technologies?
Re: transform completeocl resource [message #1017170 is a reply to message #1017168] Sun, 10 March 2013 12:32 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I'm not convinced that the thread you refer to led to a satisfactory
conclusion for the user.

It was over a year ago and I had forgotten about the associated Bugzilla
371018. The problem of making a Complete OCL XMI document loadable is
much harder than I thought.

See my reply an hour and a half ago on this newsgroup concerning sharing
Complete OCL in other tools.

Can you please post your Names.ocl.pivot and explain how you produced it
so that I can better understand your use case?

Regards

Ed Willink


On 10/03/2013 12:05, Fernando Ayata wrote:
> Dear Ed,
> thank you for reply.
> If I understand correctly, the Pivot Metamodel corresponds to the AST.
> In this topic http://www.eclipse.org/forums/index.php/t/286882/, The
> user try to save the AST also, but he doesn't encounter a similar problem
> (That is why I asked you previously whether my added code is correct
> or not).
> If he doesn't encounter a problem when he uses Acceleo, that means
> that my saved XMI is incorrect.
> I try to modify the abstract attribute for Visitable meta-class in
> Pivot.ecore (true -> false), but I new problem appears which is Error
> loading
> file://Users/ayata/Modeling/workspace_juno_06032013/ocl/tests/org.eclipse.ocl.examples.xtext.tests/bin/org/eclipse/ocl/examples/test/xtext/models/Names.ocl.pivot:
> org.eclipse.emf.ecore.xmi.IllegalValueException: Value '0.0' is not
> legal.
> (file://Users/ayata/Modeling/workspace_juno_06032013/ocl/tests/org.eclipse.ocl.examples.xtext.tests/bin/org/eclipse/ocl/examples/test/xtext/models/Names.ocl.pivot,
> 12, 78)
>
>
> Do you have some ideas about using an completeocl resource by M2M
> technologies?
Previous Topic:Sharing OCL operation definitions in Acceleo/QVTo
Next Topic:CompleteOCL to XMI
Goto Forum:
  


Current Time: Fri Mar 29 12:01:37 GMT 2024

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

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

Back to the top