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.

_______________________________________________
Topcased-users mailing list
[email protected]
http://lists.gforge.enseeiht.fr/mailman/listinfo/topcased-users
  • [Topcased-users] OCL parse m... Topcased user list where issues are discussed

Reply via email to