OCL Errors in StandAlone QVTo [message #1220749] |
Fri, 13 December 2013 06:43  |
Eclipse User |
|
|
|
Hello,
I'm trying to run qvto in a standalone application, but every time I try to execute the transformation, I get compiler errors. Most errors I get look like one of these:
Cannot find operation (+(String)) for the type (String) (at:21)
Cannot find operation (selectByType(InterfaceModel)) neither for the type (OrderedSet(Model)) nor for its element type (Model) (at:27)
Unrecognized variable: (interfaces) (at:27)
Based on that, I get the idea OCL is not initialised properly somehow? I tried following the steps for the OCL pivot standalone, but that didn't help. Hw do I fix this?
Is there a full guide somewhere to running OCL standalone? Most of what I can find seems to be partial or is dead.
Regards,
Arjan van der Meer
|
|
|
|
Re: OCL Errors in StandAlone QVTo [message #1220760 is a reply to message #1220752] |
Fri, 13 December 2013 08:02   |
Eclipse User |
|
|
|
HI
QVTo does not (yet) use the Pivot version of OCL, so using pivot
installatiion is at best a waste of time and at worst a source of problem.
I would expect QVTo to pretty much just work, perhaps with some help on
the UML registrations; look for an example to copy.
Regards
Ed Willink
On 13/12/2013 11:54, Denis Nikiforov wrote:
> Hi
>
> Here is my standalone QVTo transformation:
> https://github.com/AresEkb/OclToXPath
>
> Here is a package registration:
> Xpath2Package.eINSTANCE.getEFactoryInstance();
> EPackage.Registry.INSTANCE.put("http://www.eclipse.org/xsd/2002/XSD",
> SchemaPackageImpl.eINSTANCE);
> and a transformation part:
> TransformationExecutor executor = new
> TransformationExecutor(transformation);
> ExecutionContextImpl context = new ExecutionContextImpl();
> context.setConfigProperty("keepModeling", true);
> context.setLog(new WriterLog(new OutputStreamWriter(System.out)));
> ModelExtent input = new BasicModelExtent(source);
> ModelExtent output = new BasicModelExtent();
> ExecutionDiagnostic result = executor.execute(context, input,
> output);
> if(result.getSeverity() == Diagnostic.OK) {
> return output.getContents();
> } else {
> IStatus status = BasicDiagnostic.toIStatus(result);
> throw new Exception(status.getMessage());
> }
> I'm not sure, but maybe OCL must be initalized too:
> org.eclipse.ocl.examples.pivot.OCL.initialize(rs);
> org.eclipse.ocl.examples.pivot.uml.UML2Pivot.initialize(rs);
> org.eclipse.ocl.examples.pivot.model.OCLstdlib.install();
> org.eclipse.ocl.examples.pivot.delegate.OCLDelegateDomain.initialize(rs);
> org.eclipse.ocl.examples.xtext.completeocl.CompleteOCLStandaloneSetup.doSetup();
> org.eclipse.ocl.examples.xtext.oclinecore.OCLinEcoreStandaloneSetup.doSetup();
> org.eclipse.ocl.examples.xtext.oclstdlib.OCLstdlibStandaloneSetup.doSetup();
> org.eclipse.ocl.examples.domain.utilities.StandaloneProjectMap.getAdapter(rs);
> Actually I'm new to Eclipse and Java, I apologize if my suggestions
> will mislead you.
|
|
|
|
Re: OCL Errors in StandAlone QVTo [message #1220793 is a reply to message #1220784] |
Fri, 13 December 2013 10:36  |
Eclipse User |
|
|
|
Hi
String::'+' has always been in QVT and so QVTo.
Promotion of String::'+' to OCL and so Eclipse OCL cam e more recently,
but it should be in Juno and c ertainly Kepler.
selectByType is new in Kepler (and will be in OCL 2.4 as soon as the OMG
rubber stamp is applied). It was backported to the classic OPCL and so
should be in QVTo too.
[You almost never want selectByType or oclIsTypeOf; use selectByKind and
oclIsKindOf].
Regards
Ed Willink
On 13/12/2013 14:57, Arjan van der Meer wrote:
> Hello,
>
> Thanks for the example, it did make things clearer, but unfortunately
> it didn't resolve the problem.
>
> That code seems essentially the same as what I use. I dynamically load
> the relevant packages but that should make no difference.
> The reason that I mentioned Pivot OCL is that some of the errors go
> away if I replace 'string' + 'string' with 'string'.concat('string').
> That led me to suspect I had the wrong OCL implementation, or that my
> OCL was somehow incomplete. I seem to recall that both the + for
> strings and selectByType are (technically) OCL extensions. Do I need
> to do something special for those?
|
|
|
Powered by
FUDForum. Page generated in 0.37732 seconds