Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » The class 'VisitableCS' is not a valid classifier(OCL MDT error)
The class 'VisitableCS' is not a valid classifier [message #1000786] Tue, 15 January 2013 07:39 Go to next message
Fi Fi is currently offline Fi Fi
Messages: 133
Registered: March 2010
Senior Member
Hi all,
I try to use to atl query to generate a very simple text form a parsed OCL document
conforms to CompleteOCLCST metamodel proposed by OCL MDT community.

this is the query
query Variable = 
	CompleteMetaModel!CompleteOCLDocumentCS.allInstances()->asSequence()->first()
		.generateText().writeTo('/Users/text.txt');

helper
context CompleteMetaModel!CompleteOCLDocumentCS
def : generateText() : String =
'aa';


An error is gnerated which is
Error loading platform:/resource/CompleteOCL/Test.xmi: The class 'VisitableCS' is not a valid classifier

Can you please help to identify the source of this error
Best regards,
Fy Za

[Updated on: Tue, 15 January 2013 07:49]

Report message to a moderator

Re: The class 'VisitableCS' is not a valid classifier [message #1000798 is a reply to message #1000786] Tue, 15 January 2013 07:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3844
Registered: July 2009
Senior Member
Hi

Did you call CompleteOCLStandaloneSetup.doSetup() ?

Regards

Ed Willink

On 15/01/2013 12:39, Fy Za wrote:
> Hi all,
> I try to use to atl query to generate a very simple text form a parser
> OCL document conforms to CompleteOCLCST metamodel proposed by OCL MDT
> community.
>
> this is the query
>
> query Variable =
> CompleteMetaModel!CompleteOCLDocumentCS.allInstances()->asSequence()->first()
> .generateText().writeTo('/Users/text.txt');
>
> helper
> context CompleteMetaModel!CompleteOCLDocumentCS
> def : generateText() : String =
> 'aa';
>
>
> An error is gnerated which is
> Error loading platform:/resource/CompleteOCL/Test.xmi: The class
> 'VisitableCS' is not a valid classifier
>
> Can you please help to identify the source of this error
> Best regards,
> Fy Za
Re: The class 'VisitableCS' is not a valid classifier [message #1000800 is a reply to message #1000798] Tue, 15 January 2013 07:55 Go to previous messageGo to next message
Fi Fi is currently offline Fi Fi
Messages: 133
Registered: March 2010
Senior Member
I parse the OCL document using save as xmi

Best regards
Fy Za

[Updated on: Tue, 15 January 2013 07:55]

Report message to a moderator

Re: The class 'VisitableCS' is not a valid classifier [message #1001752 is a reply to message #1000800] Thu, 17 January 2013 05:26 Go to previous messageGo to next message
Fi Fi is currently offline Fi Fi
Messages: 133
Registered: March 2010
Senior Member
Hi,

I think that "save as xmi" produce the same output as using CompleteOCLStandaloneSetup.doSetup().
That is right?

Best regards,
Fy Za
Re: The class 'VisitableCS' is not a valid classifier [message #1001760 is a reply to message #1001752] Thu, 17 January 2013 05:29 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3844
Registered: July 2009
Senior Member
Hi

Well if you think that you might as well save time and just write
System.println("This program doesn't work") since that might produce the
same output too.

Why on earth would an initialization routine be the same as a resource save?

Regards

Ed Willink



On 17/01/2013 10:26, Fy Za wrote:
> Hi,
>
> I think that "save as xmi" produce the same output as using
> CompleteOCLStandaloneSetup.doSetup().
> That is right?
>
> Best regards,
> Fy Za
>
Re: The class 'VisitableCS' is not a valid classifier [message #1001769 is a reply to message #1001760] Thu, 17 January 2013 05:47 Go to previous messageGo to next message
Fi Fi is currently offline Fi Fi
Messages: 133
Registered: March 2010
Senior Member
I use the output of this parser
But the same error was generated
package Parser;
import java.io.IOException;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.ocl.examples.pivot.model.OCLstdlib;
import org.eclipse.ocl.examples.xtext.completeocl.CompleteOCLStandaloneSetup;
import org.eclipse.ocl.examples.xtext.oclinecore.OCLinEcoreStandaloneSetup;

public class Parser {

	public static void main(String[] args) throws IOException {

		CompleteOCLStandaloneSetup.doSetup();
		OCLinEcoreStandaloneSetup.doSetup();
		OCLstdlib.install();
		ResourceSet resourceSet = new ResourceSetImpl();
		Resource resource = resourceSet.createResource(URI.createURI(args[0]));
		resource.load(null);
		EcoreUtil.resolveAll(resource);
		Resource resourceAsXmi = resourceSet.createResource(URI.createURI(args[0]+".xmi"));
		resourceAsXmi.getContents().addAll(resource.getContents());
		resourceAsXmi.save(null);

	}
}
Re: The class 'VisitableCS' is not a valid classifier [message #1003309 is a reply to message #1001769] Sun, 20 January 2013 18:34 Go to previous message
Fi Fi is currently offline Fi Fi
Messages: 133
Registered: March 2010
Senior Member
Hi Ed
I am really sorry if you do not like my answer because I confused between AST and CST.
in the parser, I use CompleteOCLStandaloneSetup.doSetup() but the error still persists.

Best regards,
Fy Za
Previous Topic:ATL write to file
Next Topic:How to delete a model element of rule ?
Goto Forum:
  


Current Time: Mon Apr 21 00:38:45 EDT 2014

Powered by FUDForum. Page generated in 0.01855 seconds