Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Transform OCL into some text
Transform OCL into some text [message #1176057] Fri, 08 November 2013 00:06 Go to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Hi!

I have an UML model with OCL constraints. I wrote an Acceleo-transformation from UML model to XML-schema. It works fine, but now I need to transform OCL-constraints into XPath-expressions or schematron.

I think that the simplest solution for me is 1) to parse OCL into Ecore, 2) save it as XMI-file and 3) pass the later one to Acceleo-transformation. But I don't understand how implement the first step. Help me please.

// Offtopic start
Actually I've parsed some abstract OCL stored in text file into Ecore by Dresden OCL. But It lacks documentation, I don't understand how to use it with UML model. I hope I'll have more luck with Eclipse OCL.
// Offtopic end
Re: Transform OCL into some text [message #1177132 is a reply to message #1176057] Fri, 08 November 2013 15:00 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
I wrote something:
ResourceSet rs = new ResourceSetImpl();
org.eclipse.ocl.uml.OCL.initialize(rs);
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());

Resource model = rs.createResource(URI.createFileURI("model/OclTest.uml"));
model.load(null);

EObject person = model.getEObject("//@packagedElement[name='Package1']/@packagedElement[name='Person']");

Resource res = rs.createResource(URI.createFileURI("myOcl.xmi"));
org.eclipse.ocl.OCL<EPackage, EClassifier, EOperation, EStructuralFeature, EEnumLiteral, EParameter, EObject, CallOperationAction, SendSignalAction, Constraint, EClass, EObject> ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE, res);

OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = ocl.createOCLHelper();

// I don't understand how to bind constraint to Person class instead of uml:Class
helper.setInstanceContext(person);

// It creates constraint for uml:Class
Constraint inv = helper.createInvariant("self.name.size() > 0");

// It throws an exception: org.eclipse.ocl.SemanticException: Unrecognized variable: (age)
//Constraint inv = helper.createInvariant("self.age > 0");

EList<EObject> c = res.getContents();

res.save(null);
res.unload();


I don't understand two things:

  1. How to set Person (instead of uml:Class) context for my invariant
  2. How to parse OCL-constraints contained in model/OclTest.uml
Re: Transform OCL into some text [message #1178637 is a reply to message #1177132] Sat, 09 November 2013 15:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

Eclipse OCL supports usgae with Ecore:
e.g. OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint>
or UML
e.g. org.eclipse.ocl.uml.OCL.initialize

You are mixing the two which is a guaranteed disaster.

If you use UML exclusively, it should work.

Alternatively you might prefer to use the neutral pivot binding that
prototypes resolution of the non-interchangeability of OMG's OCL XMI.
This is available once you use install the OCL Examples and Editors
using e.g. org.eclipse.ocl.examples.pivot.OCL.

OCL is deceptively simple, but once you start considering subtleties
such as invalid you may find it a bit harder and might benefit from the
normalisations and optimisations underway in the OCL to Java code
generator in org.eclipse.ocl.examples.codegen.

Sorry you may not be satisfied by the documentation quality.

If you care to make an OCL to something translator available other users
may benefit too.

Regards

Ed Willink


On 08/11/2013 21:00, Denis Nikiforov wrote:
> I wrote something:
> ResourceSet rs = new ResourceSetImpl();
> org.eclipse.ocl.uml.OCL.initialize(rs);
> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi",
> new XMIResourceFactoryImpl());
>
> Resource model =
> rs.createResource(URI.createFileURI("model/OclTest.uml"));
> model.load(null);
>
> EObject person =
> model.getEObject("//@packagedElement[name='Package1']/@packagedElement[name='Person']");
>
> Resource res = rs.createResource(URI.createFileURI("myOcl.xmi"));
> org.eclipse.ocl.OCL<EPackage, EClassifier, EOperation,
> EStructuralFeature, EEnumLiteral, EParameter, EObject,
> CallOperationAction, SendSignalAction, Constraint, EClass, EObject>
> ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE, res);
>
> OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint>
> helper = ocl.createOCLHelper();
>
> // I don't understand how to bind constraint to Person class instead
> of uml:Class
> helper.setInstanceContext(person);
>
> // It creates constraint for uml:Class
> Constraint inv = helper.createInvariant("self.name.size() > 0");
>
> // It throws an exception: org.eclipse.ocl.SemanticException:
> Unrecognized variable: (age)
> //Constraint inv = helper.createInvariant("self.age > 0");
>
> EList<EObject> c = res.getContents();
>
> res.save(null);
> res.unload();
>
> I don't understand two things:
>
> How to set Person (instead of uml:Class) context for my invariant
> How to parse OCL-constraints contained in model/OclTest.uml
>
Re: Transform OCL into some text [message #1195731 is a reply to message #1178637] Mon, 18 November 2013 23:36 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Thanks for answer!

I took some code from this topic: http://www.eclipse.org/forums/index.php/mv/msg/505128/1100745/#msg_1100745

Here is a new version:
https://github.com/AresEkb/OclToXmi

It can read OCL-constraints contained in a model. But it couldn't parse them into ExpressionInOCL. It throws an exception:
Exception in thread "main" org.eclipse.ocl.examples.pivot.SemanticException: Errors in 'age >= 0'
1: Unresolved Property '::age'
	at org.eclipse.ocl.examples.pivot.utilities.PivotUtil.checkResourceErrors(PivotUtil.java:176)
	at org.eclipse.ocl.examples.pivot.context.AbstractParserContext.parse(AbstractParserContext.java:120)
	at org.eclipse.ocl.examples.pivot.helper.OCLHelperImpl.createInvariant(OCLHelperImpl.java:94)
	at Main.main(Main.java:67)
I understand that the problem is with this line:
oclHelper.setInstanceContext(ce);
Because it sets uml:Class context instead of Person. And uml:Class doesn't have age property. But I don't understand how to fix it.


Actually I want to create a transformation from OCL to XPath. I wrote XPath parser/printer: https://github.com/AresEkb/EMFTextXPath2 All that's left is to create an OCL-parser and the transformation Smile

[Updated on: Tue, 19 November 2013 01:46]

Report message to a moderator

Re: Transform OCL into some text [message #1195920 is a reply to message #1195731] Tue, 19 November 2013 01:45 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Sorry for flood. I replaced all references to org.eclipse.uml2.uml by org.eclipse.ocl.examples.pivot. And everithing works much better now! But it couldn't parse a following rule: self.driver->forAll(p|p.age >= 18)
The exception is:
org.eclipse.ocl.examples.pivot.SemanticException: Errors in 'self.driver->forAll(p|p.age >= 18)'
1: Unresolved Property 'Metaclass(OclTest::Package1::Car)::driver'
1: Unresolved Property 'OclInvalid::age'
	at org.eclipse.ocl.examples.pivot.utilities.PivotUtil.checkResourceErrors(PivotUtil.java:176)
	at org.eclipse.ocl.examples.pivot.context.AbstractParserContext.parse(AbstractParserContext.java:120)
	at org.eclipse.ocl.examples.pivot.helper.OCLHelperImpl.createInvariant(OCLHelperImpl.java:94)
	at Main.main(Main.java:64)


And also I don't understand the meaning of the following URLs in a result XMI-file:
http://www.eclipse.org/ocl/3.1.0/orphanage#//@ownedType.816
model/OclTest.uml.oclas#//@nestedPackage.0/@nestedPackage.0/@ownedType.1/@ownedAttribute.3

Where I can get http://www.eclipse.org/ocl/3.1.0/orphanage and model/OclTest.uml.oclas?

[Updated on: Tue, 19 November 2013 01:52]

Report message to a moderator

Re: Transform OCL into some text [message #1196074 is a reply to message #1195920] Tue, 19 November 2013 03:26 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

That looks suspiciously like self is not defined to be what you intended.

Regards

Ed Willink


On 19/11/2013 06:45, Denis Nikiforov wrote:
> Sorry for flood. I replaced all references to org.eclipse.uml2.uml by
> org.eclipse.ocl.examples.pivot. And everithing works much better now!
> But it couldn't parse a following rule: self.driver->forAll(p|p.age >=
> 18)
> The exception is:
> org.eclipse.ocl.examples.pivot.SemanticException: Errors in
> 'self.driver->forAll(p|p.age >= 18)'
> 1: Unresolved Property 'Metaclass(OclTest::Package1::Car)::driver'
> 1: Unresolved Property 'OclInvalid::age'
> at
> org.eclipse.ocl.examples.pivot.utilities.PivotUtil.checkResourceErrors(PivotUtil.java:176)
> at
> org.eclipse.ocl.examples.pivot.context.AbstractParserContext.parse(AbstractParserContext.java:120)
> at
> org.eclipse.ocl.examples.pivot.helper.OCLHelperImpl.createInvariant(OCLHelperImpl.java:94)
> at Main.main(Main.java:64)
Re: Transform OCL into some text [message #1196152 is a reply to message #1196074] Tue, 19 November 2013 04:17 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Hi

I've got it. It works without self. But a following rule works only with self:
self.name <> null and self.name.size() > 0

If I'll remove self, I'll get an exception:
org.eclipse.ocl.examples.pivot.SemanticException: Errors in 'name <> null and self.name.size() > 0'
1: Ambiguous resolution:
	Property : NamedElement.name
	Property : OclTest::Package1::Person.name
	at org.eclipse.ocl.examples.pivot.utilities.PivotUtil.checkResourceErrors(PivotUtil.java:176)
	at org.eclipse.ocl.examples.pivot.context.AbstractParserContext.parse(AbstractParserContext.java:120)
	at org.eclipse.ocl.examples.pivot.helper.OCLHelperImpl.createInvariant(OCLHelperImpl.java:94)
	at Main.main(Main.java:64)
But I think, that it must work without self too. Is it a bug somewhere?
Re: Transform OCL into some text [message #1196163 is a reply to message #1196152] Tue, 19 November 2013 04:22 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
And also I don't understand the meaning of the following URLs in a result XMI-file:
http://www.eclipse.org/ocl/3.1.0/orphanage#//@ownedType.816
model/OclTest.uml.oclas#//@nestedPackage.0/@nestedPackage.0/@ownedType.1/@ownedAttribute.3

Where I can get http://www.eclipse.org/ocl/3.1.0/orphanage and model/OclTest.uml.oclas?
Re: Transform OCL into some text [message #1196451 is a reply to message #1196163] Tue, 19 November 2013 07:23 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

http://www.eclipse.org/ocl/3.1.0/orphanage is the nested package in
which all synthesized types such as Tuples and Collection
specializations are defined.

*.uml.oclas is the pivot serialization of the *.uml model. It is created
automatically.

Regards

Ed Willink

On 19/11/2013 09:22, Denis Nikiforov wrote:
> And also I don't understand the meaning of the following URLs in a
> result XMI-file:
> http://www.eclipse.org/ocl/3.1.0/orphanage#//@ownedType.816
> model/OclTest.uml.oclas#//@nestedPackage.0/@nestedPackage.0/@ownedType.1/@ownedAttribute.3
>
>
> Where I can get http://www.eclipse.org/ocl/3.1.0/orphanage and
> model/OclTest.uml.oclas?
Re: Transform OCL into some text [message #1210928 is a reply to message #1196451] Tue, 26 November 2013 02:10 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Hi

When I open generated Ecore-file (with parsed OCL-expressions) in Sample Ecore Model Editor or Sample Reflective Ecore Model Editor it throws an exceptions:
1) java.io.FileNotFoundException: http://www.eclipse.org/ocl/3.1.0/orphanage
2) Resource '/OclToXmi/model/OclTest.uml.oclas' does not exists

How to register http://www.eclipse.org/ocl/3.1.0/orphanage in Eclipse? Are Ecore-editors able to atomatically generate oclas-files?


Also I tried to transform generated Ecore-file (with parsed OCL-expressions) by QVTo. When I'm trying to add a metamodel mapping (in project settings) for my Ecore-file, it shows me an error:
Failed to load metamodel from 'platform:/resource/OclToXmi/output/parsedOcl.ecore'

It seems that it couldn't resolve http://www.eclipse.org/ocl/3.1.0/orphanage and *.oclas too.

How to use parsed OCL serialized in Ecore-file as input to QVTo-transformation?

Thanks!
Re: Transform OCL into some text [message #1210943 is a reply to message #1210928] Tue, 26 November 2013 02:17 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Oops Smile I should use http://www.eclipse.org/ocl/3.1.0/Pivot as a metamodel Smile
Re: Transform OCL into some text [message #1211241 is a reply to message #1210943] Tue, 26 November 2013 05:32 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Sorry for flood. Actually my main purpose is to write a QVTo-transformation. And QVTo supports my Pivot-model like a charm. I think I need to dive deeper into the problem to ask a more concrete questions.
Re: Transform OCL into some text [message #1213817 is a reply to message #1176057] Wed, 27 November 2013 07:04 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Hi

Neither Eclipse Ecore Editors, nor QVTo interpreter can resolve http://www.eclipse.org/ocl/3.1.0/orphanage or automatically create oclas-files ;(

Here is an example of input model for my QVTo-script:
https://github.com/AresEkb/OclToXmi/blob/master/parsedOcl.ecore
It processed without exceptions, but all references to orphanage and oclas are null.

Could you point me out how to make QVTo-scripts aware of http://www.eclipse.org/ocl/3.1.0/orphanage and oclas?
Re: Transform OCL into some text [message #1213879 is a reply to message #1213817] Wed, 27 November 2013 07:37 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
The URIs like this http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib.oclas#o.ocl.Real.%60%%62%..ocl.OclSelf couldn't be resolved too...
Re: Transform OCL into some text [message #1213904 is a reply to message #1213879] Wed, 27 November 2013 07:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
http://wiki.eclipse.org/OCL/ForumNetiquette

On 27/11/2013 12:37, Denis Nikiforov wrote:
> The URIs like this
> http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib.oclas#o.ocl.Real.%60%%62%..ocl.OclSelf
> couldn't be resolved too...
Re: Transform OCL into some text [message #1214418 is a reply to message #1176057] Wed, 27 November 2013 12:45 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Hi

Excuse me for noninformative messages. Here is a sample project. I run NewTransformation.qvto from Eclipse with a following input:
platform:/resource/TransformOcl/transforms/parsedOcl.ecore
and fake output:
platform:/resource/TransformOcl/transforms/result.ecore

Here is a log of the script execution:

Converting driver->size() <= 2
  OperationCallExp found:
    referredOperation: null() : "<null>"
  OperationCallExp found:
    referredOperation: null() : "<null>"
  PropertyCallExp found:
    referredProperty: OclTest::Package1::Car.driver
    referredProperty.type: Set(OclTest::Package1::Person)[+]
  VariableExp found:
    referredVariable: self : org.eclipse.ocl.examples.pivot.internal.impl.TypeImpl
  UnlimitedNaturalLiteralExp found:
    unlimitedNaturalSymbol: 2
Converting age >= 0
  OperationCallExp found:
    referredOperation: null() : "<null>"
  PropertyCallExp found:
    referredProperty: OclTest::Package1::Person.age
    referredProperty.type: org.eclipse.ocl.examples.pivot.internal.impl.TypeImpl
  VariableExp found:
    referredVariable: self : org.eclipse.ocl.examples.pivot.internal.impl.TypeImpl
  UnlimitedNaturalLiteralExp found:
    unlimitedNaturalSymbol: 0


As one can see the transformation doesn't resolve referredOperations, age property type and self variable type. Because they points to unknown resources:
http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib.oclas#o.ocl.Real.%60%%61%..ocl.OclSelf
http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib.oclas#o.ocl.Collection.size
pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml.oclas#T.PrimitiveTypes.Integer
http://www.eclipse.org/ocl/3.1.0/orphanage#//@ownedType.816
Re: Transform OCL into some text [message #1215710 is a reply to message #1176057] Thu, 28 November 2013 01:42 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Hi

Here is another test project:
https://github.com/AresEkb/OclToXPath
(also you need https://github.com/AresEkb/EMFTextXPath2)

In a standalone mode it gets all OCL rules from model/OclTest.uml and transforms them into corresponding XPath expressions stored in result.ecore and result.xpath2. And everithing works fine! You can see 'Real.>=(OclSelf) : Boolean' in a result file. References to oclstdlib are resolved.

But If you run transforms/OclToXpath.qvto from Eclipse with output/parsedOcl.ecore as input model and with result2.ecore as output model, you will see that the later one contains 'null() : &quot;&lt;null>&quot;'. It's unable to resolve oclstdlib references.

I will use the transformation in a standalone mode, but I need to debug it in Eclipse during development. Is it possible to make it work in Eclipse?
Re: Transform OCL into some text [message #1216703 is a reply to message #1215710] Thu, 28 November 2013 10:44 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
HI

A significant problem is that you are lying about the file content.

parsedOcl.ecore says I am an http://www.eclipse.org/emf/2002/Ecore file,
when it contains http://www.eclipse.org/ocl/3.1.0/Pivot content.

If you change the name to parsedOcl.ecore.oclas the transformation runs,
but does not resolve because as you observe some the references are
suspicious:
http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib.oclas#o.ocl.Real.%60%%61%..ocl.OclSelf.
However looking at
/org.eclipse.ocl.examples.library/model-gen/OCL-2.5.oclas there is a

<ownedOperation xmi:id="o.ocl.Real.%60%%61%..ocl.OclSelf"
name="&lt;=" type="#Boolean"
implementationClass="org.eclipse.ocl.examples.library.numeric.NumericLessThanEqualOperation"
precedence="#Z.RELATIONAL">

so the problem may be in the encoding. EMF does not waste time encoding
xmi:id's since application code is expected to get them right. I
certainly did not intend to have % values so I need to revisit the
xmi:id generator. https://bugs.eclipse.org/bugs/show_bug.cgi?id=422777
raised.

(Until recently serialisation of the OCLAS was a much greater disaster.)

Regards

Ed Willink




On 28/11/2013 06:42, Denis Nikiforov wrote:
> Hi
>
> Here is another test project:
> https://github.com/AresEkb/OclToXPath
> (also you need https://github.com/AresEkb/EMFTextXPath2)
>
> In a standalone mode it gets all OCL rules from model/OclTest.uml and
> transforms them into corresponding XPath expressions stored in
> result.ecore and result.xpath2. And everithing works fine! You can see
> 'Real.>=(OclSelf) : Boolean' in a result file. References to oclstdlib
> are resolved.
>
> But If you run transforms/OclToXpath.qvto from Eclipse with
> output/parsedOcl.ecore as input model and with result2.ecore as output
> model, you will see that the later one contains 'null() : "<null>"'.
> It's unable to resolve oclstdlib references.
>
> I will use the transformation in a standalone mode, but I need to
> debug it in Eclipse during development. Is it possible to make it work
> in Eclipse?
Re: Transform OCL into some text [message #1216835 is a reply to message #1216703] Thu, 28 November 2013 11:56 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
On 28/11/2013 15:44, Ed Willink wrote:
> A significant problem is that you are lying about the file content.
>
> parsedOcl.ecore says I am an http://www.eclipse.org/emf/2002/Ecore
> file, when it contains http://www.eclipse.org/ocl/3.1.0/Pivot content.
except that it is totally ill-structured.

OCLAS files ghave a single Root, and when necessary a
http://www.eclipse.org/ocl/3.1.0/orphanage Package to localize all
specializations. You have non local references.

I suspect that there is a problem, but it is hard to see it in amongst
so much illegal content.

Regards

Ed Willink
Re: Transform OCL into some text [message #1218201 is a reply to message #1216835] Fri, 29 November 2013 01:53 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Thanks!

I fixed the code and now it serializes OCL into output/parsedOcl.ecore.oclas.
Also I added a transforms/Test.qvto to simplify testing.
https://github.com/AresEkb/OclToXPath

The strange thing is that it resolves operations only during first run! If you'll run it again, it won't resolve operations until you restart Eclipse. Maybe this problem is specific for my Eclipse installation only...

And also it doesn't resolve properties and variables:
../model/OclTest.uml.oclas#//@nestedPackage.0/@nestedPackage.0/@ownedType.1/@ownedAttribute.1
Re: Transform OCL into some text [message #1218520 is a reply to message #1218201] Fri, 29 November 2013 05:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

I don't have EMFtext.

I don't have plugins ion C:/Work. If you configure your project as an
Eclipse plugibn, it will sort everything out for you in the MANIFEST.mf.

First run only sounds like someone unloaded the library after the first
run and so emptied it. Shared Java-defined resources should not be put
into ResourceSets that unload when done.

Regards

Ed Willink


On 29/11/2013 06:53, Denis Nikiforov wrote:
> Thanks!
>
> I fixed the code and now it serializes OCL into
> output/parsedOcl.ecore.oclas.
> Also I added a transforms/Test.qvto to simplify testing.
> https://github.com/AresEkb/OclToXPath
>
> The strange thing is that it resolves operations only during first
> run! If you'll run it again, it won't resolve operations until you
> restart Eclipse. Maybe this problem is specific for my Eclipse
> installation only...
>
> And also it doesn't resolve properties and variables:
> ../model/OclTest.uml.oclas#//@nestedPackage.0/@nestedPackage.0/@ownedType.1/@ownedAttribute.1
>
Re: Transform OCL into some text [message #1218570 is a reply to message #1218520] Fri, 29 November 2013 05:34 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
I apologize for the inaccuracy. You can run transforms/Test.qvto from Eclipse with output/parsedOcl.ecore.oclas as input model.

Here is an output fragment for a first run:
Converting driver->size() <= 2
  OperationCallExp found:
    referredOperation: Real.<=(OclSelf) : Boolean
  OperationCallExp found:
    referredOperation: Collection(T).size() : Integer
  PropertyCallExp found:
    referredProperty: null
<Invalid>
  VariableExp found:
    referredVariable: self : org.eclipse.ocl.examples.pivot.internal.impl.TypeImpl
  UnlimitedNaturalLiteralExp found:
    unlimitedNaturalSymbol: 2

And here is an output fragment for a second run:
Converting driver->size() <= 2
  OperationCallExp found:
    referredOperation: null() : "<null>"
  OperationCallExp found:
    referredOperation: null() : "<null>"
  PropertyCallExp found:
    referredProperty: null
<Invalid>
  VariableExp found:
    referredVariable: self : org.eclipse.ocl.examples.pivot.internal.impl.TypeImpl
  UnlimitedNaturalLiteralExp found:
    unlimitedNaturalSymbol: 2

Also, as you can see, it doesn't resolve referredProperty and self variable type.
Re: Transform OCL into some text [message #1219212 is a reply to message #1218570] Mon, 02 December 2013 11:18 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

Since I do not have EMFText I cannot see any of this.

Regards

Ed Willink


On 29/11/2013 10:34, Denis Nikiforov wrote:
> I apologize for the inaccuracy. You can run transforms/Test.qvto from
> Eclipse with output/parsedOcl.ecore.oclas as input model.
>
> Here is an output fragment for a first run:
> Converting driver->size() <= 2
> OperationCallExp found:
> referredOperation: Real.<=(OclSelf) : Boolean
> OperationCallExp found:
> referredOperation: Collection(T).size() : Integer
> PropertyCallExp found:
> referredProperty: null
> <Invalid>
> VariableExp found:
> referredVariable: self :
> org.eclipse.ocl.examples.pivot.internal.impl.TypeImpl
> UnlimitedNaturalLiteralExp found:
> unlimitedNaturalSymbol: 2
> And here is an output fragment for a second run:
> Converting driver->size() <= 2
> OperationCallExp found:
> referredOperation: null() : "<null>"
> OperationCallExp found:
> referredOperation: null() : "<null>"
> PropertyCallExp found:
> referredProperty: null
> <Invalid>
> VariableExp found:
> referredVariable: self :
> org.eclipse.ocl.examples.pivot.internal.impl.TypeImpl
> UnlimitedNaturalLiteralExp found:
> unlimitedNaturalSymbol: 2
> Also, as you can see, it doesn't resolve referredProperty and self
> variable type.
Re: Transform OCL into some text [message #1222313 is a reply to message #1176057] Fri, 20 December 2013 00:57 Go to previous message
Denis Nikiforov is currently offline Denis Nikiforov
Messages: 58
Registered: August 2013
Member
Hi

I've finished my transformation:
https://github.com/AresEkb/uml2xsd

Actually it transforms UML into XML Schema 1.1. xs:assert elements are generated from OCL constraints.

Thanks a lot for help!
Previous Topic:OCL Set Function to Java Code
Next Topic:oclxmi with ocl:///-URLs fails to load
Goto Forum:
  


Current Time: Fri Jul 25 06:48:25 EDT 2014

Powered by FUDForum. Page generated in 0.06726 seconds