I just look your last answer and it seems you don't create a link between your meta model and your environment.
There is the Java code initializing the environment I think you miss the getOCL method OCLInput document = OCLDocumentUtil.getOCLDocument(inStream); URI mainNsURI = OCLDocumentUtil.getDocumentURI(); EPackage metamodelPackage = EPackage.Registry.INSTANCE.getEPackage(mainNsURI.toString()); ocl = TopcasedOCL.getOCL(metamodelPackage); oclHelper = ocl.createOCLHelper(); Hope this helps Regards Tristan FAURE De : [email protected] [mailto:[email protected]] De la part de Topcased user list where issues are discussed Envoyé : lundi 21 février 2011 16:48 À : [email protected] Objet : [Topcased-users] OCL parse method error solution + another error Hi again, I found my error. In fact I was mixing Topcased OCL Libraries and the Eclipse OCL ones... Indeed, I created my OCL file with the Topcased Wizard which is the one adding the MainModel... line. So I finally found the equivalent of the OCLInput()method in the Topcased library. It's ocl=OCLDocumentUtil.getOCLDocument(F1) which returns a OCLInput object. But now I don't find the equivalent of the parse method org.eclipse.ocl.OCL.parse(OCLInput<http://download.eclipse.org/modeling/mdt/ocl/javadoc/3.0.0/org/eclipse/ocl/OCLInput.html> input)which returns java.util.List<CT<http://download.eclipse.org/modeling/mdt/ocl/javadoc/3.0.0/org/eclipse/ocl/OCL.html>> When I try to implement directly this method it works...The only problem I have is that it doesn't recognize the context: OCL File: context Element [...] Console message: org.eclipse.ocl.SemanticException: org.eclipse.ocl.SemanticException: Unrecognized context: (Element) I can assure you that my model contains "Element". Anybody knows why is this error appearing?? Thank you, Andreu De : [email protected] [mailto:[email protected]] De la part de Topcased user list where issues are discussed Envoyé : lundi 21 février 2011 13:49 À : [email protected] Objet : [Topcased-users] OCL parse method error Hi, I'm trying to open an OCL file beginning with ("..." is my model URI): MainModel : http://... context Operator [...] My Python script code is : resourceSet1 = ResourceSetImpl() uriproj=URI.createURI(URI_String) resproj=resourceSet1.createResource(uriproj) env=EcoreEnvironmentFactory() myocl=OCL(env, resproj) F1=FileInputStream(OCLFile_path) ocl=OCLInput(F1) oclparsed=myocl.parse(ocl) When I execute the script including this code I get the following Error: File "/essaiEx1Jyt/scripts/Example1.py", line 51, in main oclparsed=myocl.parse(ocl) at org.eclipse.ocl.util.OCLUtil.checkForErrors(OCLUtil.java:350) at org.eclipse.ocl.OCL.parse(OCL.java:324) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) org.eclipse.ocl.SyntaxException: org.eclipse.ocl.SyntaxException: 1:1:1:11 "MainModel :" misplaced construct(s) C:/Users/to100966/workspace/essaiEx1Jyt/scripts/Example1.py How can I get a Misplaced construct if the MainModel line is an automatic line putted by the New OCLFile Wizard The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other than the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, please notify Airbus immediately and delete this e-mail. Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately. All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free. This mail has originated outside your organization, either from an external partner or the Global Internet. Keep this in mind if you answer this message. The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other than the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, please notify Airbus immediately and delete this e-mail. Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately. All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free. ________________________________ Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis. This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
_______________________________________________ Topcased-users mailing list [email protected] http://lists.gforge.enseeiht.fr/mailman/listinfo/topcased-users
