Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Writing OCL constraints in a profile
Writing OCL constraints in a profile [message #1281343] Mon, 31 March 2014 18:55 Go to next message
Eclipse UserFriend
Dear all,
I'm trying to create a profile in Papyrus and I would like to add
several constraints, i.e., limiting the range in an integer value.

To do so I need to get access to the value of the properties of my profiles.

If I write in the OCL Interactive view in the console it works:

self.getValue(getAppliedStereotype('Profile::Requirement'), 'id') = 4

Nevertheless, if I create an class and then I apply the stereotype and I
right-click to show the context menu and I click in Validation->Validate
Model I get the following error:

Description Resource Path Location Type
An exception occurred while delegating evaluation of the 'Constraint1'
invariant on 'Requirement -> <<Requirement>> <Class> Class1':
org.eclipse.ocl.common.internal.delegate.OCLDelegateException: Errors in
'self.getValue(getAppliedStereotype('Profile::Requirement'), 'id') = 4
'
1: Unresolved Operation
'Profile::Requirement::getValue(getAppliedStereotype('Profile::Requirement'),
'id')' model2.uml /PruebasOCL_Luna Unknown EMF Problem

Could please someone help me to find a workaround?

Kind regards,

Víctor
Re: Writing OCL constraints in a profile [message #1281359 is a reply to message #1281343] Mon, 31 March 2014 19:34 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6774
Registered: July 2009
Senior Member
Hi

Support for OCL has been steadily improving (and it's not perfect in
Luna M6).

What version are you using?

You should not need to use the Java API. Rather

self.extension_Requirement.id = 4

will avoid loss of types.

Regards

Ed Willink


On 31/03/2014 19:55, "V. López" wrote:
> Dear all,
> I'm trying to create a profile in Papyrus and I would like to add
> several constraints, i.e., limiting the range in an integer value.
>
> To do so I need to get access to the value of the properties of my
> profiles.
>
> If I write in the OCL Interactive view in the console it works:
>
> self.getValue(getAppliedStereotype('Profile::Requirement'), 'id') = 4
>
> Nevertheless, if I create an class and then I apply the stereotype and
> I right-click to show the context menu and I click in
> Validation->Validate Model I get the following error:
>
> Description Resource Path Location Type
> An exception occurred while delegating evaluation of the 'Constraint1'
> invariant on 'Requirement -> <<Requirement>> <Class> Class1':
> org.eclipse.ocl.common.internal.delegate.OCLDelegateException: Errors
> in 'self.getValue(getAppliedStereotype('Profile::Requirement'), 'id') = 4
> '
> 1: Unresolved Operation
> 'Profile::Requirement::getValue(getAppliedStereotype('Profile::Requirement'),
> 'id')' model2.uml /PruebasOCL_Luna Unknown EMF Problem
>
> Could please someone help me to find a workaround?
>
> Kind regards,
>
> Víctor
>
Re: Writing OCL constraints in a profile [message #1281453 is a reply to message #1281359] Mon, 31 March 2014 22:57 Go to previous messageGo to next message
Eclipse UserFriend
Dear Ed,
First, thanks for your quick answer.

I'm using Eclipe Luna M6 and Papyrus 1.0.0v201403121345. Is there a
better combination of tools for OCL support? Should I install something
else?

Writing "self.extension_Requirement.id = 4" doesn't work in the Xtext
OCL console. Moreover, it isn't recognized properly in the editor of the
constraint, extension_Requirement doesn't show in the autocomplete feature.

I have attached a tiny project with a single stereotype and a single
class where this issue appears, in case it helps.

Regards,

Víctor

El 31/03/2014 21:34, Ed Willink escribió:
> Hi
>
> Support for OCL has been steadily improving (and it's not perfect in
> Luna M6).
>
> What version are you using?
>
> You should not need to use the Java API. Rather
>
> self.extension_Requirement.id = 4
>
> will avoid loss of types.
>
> Regards
>
> Ed Willink
>
>
> On 31/03/2014 19:55, "V. López" wrote:
>> Dear all,
>> I'm trying to create a profile in Papyrus and I would like to add
>> several constraints, i.e., limiting the range in an integer value.
>>
>> To do so I need to get access to the value of the properties of my
>> profiles.
>>
>> If I write in the OCL Interactive view in the console it works:
>>
>> self.getValue(getAppliedStereotype('Profile::Requirement'), 'id') = 4
>>
>> Nevertheless, if I create an class and then I apply the stereotype and
>> I right-click to show the context menu and I click in
>> Validation->Validate Model I get the following error:
>>
>> Description Resource Path Location Type
>> An exception occurred while delegating evaluation of the 'Constraint1'
>> invariant on 'Requirement -> <<Requirement>> <Class> Class1':
>> org.eclipse.ocl.common.internal.delegate.OCLDelegateException: Errors
>> in 'self.getValue(getAppliedStereotype('Profile::Requirement'), 'id') = 4
>> '
>> 1: Unresolved Operation
>> 'Profile::Requirement::getValue(getAppliedStereotype('Profile::Requirement'),
>> 'id')' model2.uml /PruebasOCL_Luna Unknown EMF Problem
>>
>> Could please someone help me to find a workaround?
>>
>> Kind regards,
>>
>> Víctor
>>
>
  • Attachment: Test_OCL.zip
    (Size: 6.41KB, Downloaded 83 times)
Re: Writing OCL constraints in a profile [message #1282446 is a reply to message #1281453] Wed, 02 April 2014 10:11 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6774
Registered: July 2009
Senior Member
Hi

This looks rather related to
https://bugs.eclipse.org/bugs/show_bug.cgi?id=431638 where I've
discovered that the UML support is getting very confused as to whether
it is working in the OMG-UML/Eclipse-UML namespace. The console support
seems to have a further confusion by converting to the Pivot model
prematurely.

I hope to have this fixed soon.

Regards

Ed Willink


On 31/03/2014 23:57, "V. López" wrote:
> Dear Ed,
> First, thanks for your quick answer.
>
> I'm using Eclipe Luna M6 and Papyrus 1.0.0v201403121345. Is there a
> better combination of tools for OCL support? Should I install
> something else?
>
> Writing "self.extension_Requirement.id = 4" doesn't work in the Xtext
> OCL console. Moreover, it isn't recognized properly in the editor of
> the constraint, extension_Requirement doesn't show in the autocomplete
> feature.
>
> I have attached a tiny project with a single stereotype and a single
> class where this issue appears, in case it helps.
>
> Regards,
>
> Víctor
>
> El 31/03/2014 21:34, Ed Willink escribió:
>> Hi
>>
>> Support for OCL has been steadily improving (and it's not perfect in
>> Luna M6).
>>
>> What version are you using?
>>
>> You should not need to use the Java API. Rather
>>
>> self.extension_Requirement.id = 4
>>
>> will avoid loss of types.
>>
>> Regards
>>
>> Ed Willink
>>
>>
>> On 31/03/2014 19:55, "V. López" wrote:
>>> Dear all,
>>> I'm trying to create a profile in Papyrus and I would like to add
>>> several constraints, i.e., limiting the range in an integer value.
>>>
>>> To do so I need to get access to the value of the properties of my
>>> profiles.
>>>
>>> If I write in the OCL Interactive view in the console it works:
>>>
>>> self.getValue(getAppliedStereotype('Profile::Requirement'), 'id') = 4
>>>
>>> Nevertheless, if I create an class and then I apply the stereotype and
>>> I right-click to show the context menu and I click in
>>> Validation->Validate Model I get the following error:
>>>
>>> Description Resource Path Location Type
>>> An exception occurred while delegating evaluation of the 'Constraint1'
>>> invariant on 'Requirement -> <<Requirement>> <Class> Class1':
>>> org.eclipse.ocl.common.internal.delegate.OCLDelegateException: Errors
>>> in 'self.getValue(getAppliedStereotype('Profile::Requirement'),
>>> 'id') = 4
>>> '
>>> 1: Unresolved Operation
>>> 'Profile::Requirement::getValue(getAppliedStereotype('Profile::Requirement'),
>>>
>>> 'id')' model2.uml /PruebasOCL_Luna Unknown EMF Problem
>>>
>>> Could please someone help me to find a workaround?
>>>
>>> Kind regards,
>>>
>>> Víctor
>>>
>>
>
Previous Topic:Rebuild Model in a Plug-In
Next Topic:Papyrus & UML Profile for BPMN
Goto Forum:
  


Current Time: Wed Jul 15 06:36:31 GMT 2020

Powered by FUDForum. Page generated in 0.02018 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top