Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Problems parsing ocl query
Problems parsing ocl query [message #879127] Wed, 30 May 2012 11:08 Go to next message
Andreas Burger is currently offline Andreas Burger
Messages: 14
Registered: June 2011
Junior Member
Hi,

i get strange problem with the ocl parser.
I want to parse a query which uses the method getAppliedStereotypes in it. When i parse it with the OCL class i get the following error:
org.eclipse.ocl.SemanticException: Cannot find operation (getAppliedStereotype(String)) for the type ...
The context for this query is a Class so it should have this function.
The other strange thing is, if the query is executed in the interactive ocl console it works fine.

Does anybody know this error and why it raises?

Regards,

Andreas
Re: Problems parsing ocl query [message #879161 is a reply to message #879127] Wed, 30 May 2012 12:21 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4026
Registered: July 2009
Senior Member
Hi

These obscure problems are very difficult to helop with without some detail.

There are at least three relevant "Class" classes that I am aware of.

There are at least three relevant "OCL" classes that I am aware of.

Not knowing what you're doing, I cannot help further.

I suggest a zipped project demonstrating the failure, if you want any
chance of a prompt response.

Regards

Ed Willink

On 30/05/2012 16:08, Andreas Burger wrote:
> Hi,
>
> i get strange problem with the ocl parser.
> I want to parse a query which uses the method getAppliedStereotypes in
> it. When i parse it with the OCL class i get the following error:
> org.eclipse.ocl.SemanticException: Cannot find operation
> (getAppliedStereotype(String)) for the type ...
> The context for this query is a Class so it should have this function.
> The other strange thing is, if the query is executed in the
> interactive ocl console it works fine.
>
> Does anybody know this error and why it raises?
>
> Regards,
>
> Andreas
Re: Problems parsing ocl query [message #879414 is a reply to message #879161] Thu, 31 May 2012 03:26 Go to previous messageGo to next message
Andreas Burger is currently offline Andreas Burger
Messages: 14
Registered: June 2011
Junior Member
Hi,

thank you for your fast respond. I added a zipped eclipse project which demonstrating the error.
It contains an uml model with MARTE and SysML stereotypes in it, a model loader class, a ocl parser class and a test class.
Running the test class the uml model will be loaded and the constraint in the uml model will be parsed.

Thank you for your support.

Regards,

Andreas
  • Attachment: example.zip
    (Size: 891.24KB, Downloaded 129 times)

[Updated on: Thu, 31 May 2012 03:31]

Report message to a moderator

Re: Problems parsing ocl query [message #879634 is a reply to message #879161] Thu, 31 May 2012 10:59 Go to previous messageGo to next message
Carsten Reckord is currently offline Carsten Reckord
Messages: 139
Registered: July 2009
Senior Member
Hi,

I happened to stumble over the exact same problem just now. The issue is the
UML metamodel used by the UML OCL engine, which is loaded from
UMLResource.UML_METAMODEL_URI (pathmap://UML_METAMODELS/UML.metamodel.uml) [1].

Since UML2 4.0.0, this model no longer seems to contain the non-normative
operations like getAppliedStereotypes, hasKeyword, etc.

I was only able to find these in
platform:/plugin/org.eclipse.uml2.uml/model/UML.uml

So my questions would be:
1) Which of these models should be used by the OCL UML plugin or other
consumers of the UML metamodel?
2) If the one currently used (i.e. without those operations) is the right
one, how else can these features be accessed in OCL?
[3) What's the rationale behind removing those operations in the first place?]


Best regards,
Carsten

[1] cf. org.eclipse.ocl.uml.UMLEnvironmentFactory.getUMLMetamodel()

On 30.05.2012 18:21, Ed Willink wrote:
> Hi
>
> These obscure problems are very difficult to helop with without some detail.
>
> There are at least three relevant "Class" classes that I am aware of.
>
> There are at least three relevant "OCL" classes that I am aware of.
>
> Not knowing what you're doing, I cannot help further.
>
> I suggest a zipped project demonstrating the failure, if you want any
> chance of a prompt response.
>
> Regards
>
> Ed Willink
>
> On 30/05/2012 16:08, Andreas Burger wrote:
>> Hi,
>>
>> i get strange problem with the ocl parser.
>> I want to parse a query which uses the method getAppliedStereotypes in
>> it. When i parse it with the OCL class i get the following error:
>> org.eclipse.ocl.SemanticException: Cannot find operation
>> (getAppliedStereotype(String)) for the type ...
>> The context for this query is a Class so it should have this function.
>> The other strange thing is, if the query is executed in the
>> interactive ocl console it works fine.
>>
>> Does anybody know this error and why it raises?
>>
>> Regards,
>>
>> Andreas
>
Re: Problems parsing ocl query [message #879645 is a reply to message #879634] Thu, 31 May 2012 11:19 Go to previous messageGo to next message
Carsten Reckord is currently offline Carsten Reckord
Messages: 139
Registered: July 2009
Senior Member
Minor correction:

On 31.05.2012 16:59, Carsten Reckord wrote:
> I was only able to find these in
> platform:/plugin/org.eclipse.uml2.uml/model/UML.uml

Actually, platform:/plugin/org.eclipse.uml2.uml/model/UML.merged.uml seems
to be an even better choice...
Re: Problems parsing ocl query [message #879697 is a reply to message #879634] Thu, 31 May 2012 12:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4026
Registered: July 2009
Senior Member
Hi

Oh *****! Thanks for diagnosing this.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=381237 raised.

Regards

Ed Willink

On 31/05/2012 15:59, Carsten Reckord wrote:
> Hi,
>
> I happened to stumble over the exact same problem just now. The issue is the
> UML metamodel used by the UML OCL engine, which is loaded from
> UMLResource.UML_METAMODEL_URI (pathmap://UML_METAMODELS/UML.metamodel.uml) [1].
>
> Since UML2 4.0.0, this model no longer seems to contain the non-normative
> operations like getAppliedStereotypes, hasKeyword, etc.
>
> I was only able to find these in
> platform:/plugin/org.eclipse.uml2.uml/model/UML.uml
>
> So my questions would be:
> 1) Which of these models should be used by the OCL UML plugin or other
> consumers of the UML metamodel?
> 2) If the one currently used (i.e. without those operations) is the right
> one, how else can these features be accessed in OCL?
> [3) What's the rationale behind removing those operations in the first place?]
>
>
> Best regards,
> Carsten
>
> [1] cf. org.eclipse.ocl.uml.UMLEnvironmentFactory.getUMLMetamodel()
>
> On 30.05.2012 18:21, Ed Willink wrote:
>> Hi
>>
>> These obscure problems are very difficult to helop with without some detail.
>>
>> There are at least three relevant "Class" classes that I am aware of.
>>
>> There are at least three relevant "OCL" classes that I am aware of.
>>
>> Not knowing what you're doing, I cannot help further.
>>
>> I suggest a zipped project demonstrating the failure, if you want any
>> chance of a prompt response.
>>
>> Regards
>>
>> Ed Willink
>>
>> On 30/05/2012 16:08, Andreas Burger wrote:
>>> Hi,
>>>
>>> i get strange problem with the ocl parser.
>>> I want to parse a query which uses the method getAppliedStereotypes in
>>> it. When i parse it with the OCL class i get the following error:
>>> org.eclipse.ocl.SemanticException: Cannot find operation
>>> (getAppliedStereotype(String)) for the type ...
>>> The context for this query is a Class so it should have this function.
>>> The other strange thing is, if the query is executed in the
>>> interactive ocl console it works fine.
>>>
>>> Does anybody know this error and why it raises?
>>>
>>> Regards,
>>>
>>> Andreas
Re: Problems parsing ocl query [message #879698 is a reply to message #879645] Thu, 31 May 2012 12:59 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4026
Registered: July 2009
Senior Member
HI

Unfortunately org.eclipse.uml2.uml artefacts are private and omitted
from the binary distribution. You have to use GIT to get them.

The public artefacts are in org.eclipse.uml2.uml.resources.

Regards

Ed Willink

On 31/05/2012 16:19, Carsten Reckord wrote:
> Minor correction:
>
> On 31.05.2012 16:59, Carsten Reckord wrote:
>> I was only able to find these in
>> platform:/plugin/org.eclipse.uml2.uml/model/UML.uml
> Actually, platform:/plugin/org.eclipse.uml2.uml/model/UML.merged.uml seems
> to be an even better choice...
Re: Problems parsing ocl query [message #879941 is a reply to message #879698] Fri, 01 June 2012 02:59 Go to previous messageGo to next message
Andreas Burger is currently offline Andreas Burger
Messages: 14
Registered: June 2011
Junior Member
Hi,

so, if i understand correctly, it exists no workaround for this problem?

Regards,

Andreas
Re: Problems parsing ocl query [message #879997 is a reply to message #879941] Fri, 01 June 2012 04:58 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4026
Registered: July 2009
Senior Member
Hi

That is why https://bugs.eclipse.org/bugs/show_bug.cgi?id=381237 has
been raised and there is some urgency to finding a solution.

Carsten's observation suggest that using the file from GIT is a workaround.

Regards

Ed Willink


On 01/06/2012 07:59, Andreas Burger wrote:
> Hi,
>
> so, if i understand correctly, it exists no workaround for this problem?
>
> Regards,
>
> Andreas
Previous Topic:Ocl expressions
Next Topic:OCL + eGenericType
Goto Forum:
  


Current Time: Wed Aug 20 22:37:39 EDT 2014

Powered by FUDForum. Page generated in 0.01778 seconds