Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » "OCL Error" posting lost in space?
"OCL Error" posting lost in space? [message #41717] Thu, 27 July 2006 13:00 Go to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Chris Lenz,

You appear (to my news reader) to have posted a 14-line question about an
OCL error, but the body of your message is unavailable. I don't see any
evidence of it in the web interface.

Would you mind posting again?

Thanks,

Christian
Re: "OCL Error" posting lost in space? [message #41748 is a reply to message #41717] Thu, 27 July 2006 13:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

A helpful soul who managed to download this article before it apparently
disappeared forwarded it to me:

<quote>
IOCLHelper helper = HelperUtil.createOCLHelper();
helper.setContext(org);
helper.define("getSubroles(r : Role) : Set(Role) = " +
"r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole) ");
System.out.println(helper.evaluate(org.getRoles().get(3),
"getSubroles(self)"));

Can anyone see the error in the method definition??

---
Exception in thread "main"
org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
signature: (getSubroles(Role))
</quote>

Chris,

What is the type of "org"? Is it Role? I suspect not, from the
"org.getRoles()" in the evaluation statement. Your context in the
operation definition should the the Role EClass.

HTH,

Christian

Christian W. Damus wrote:

>
> Hi, Chris Lenz,
>
> You appear (to my news reader) to have posted a 14-line question about an
> OCL error, but the body of your message is unavailable. I don't see any
> evidence of it in the web interface.
>
> Would you mind posting again?
>
> Thanks,
>
> Christian
Re: "OCL Error" posting lost in space? [message #41807 is a reply to message #41717] Thu, 27 July 2006 15:11 Go to previous messageGo to next message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
Sorry it was a stupid thing:
I post a new question nearly the same:

IOCLHelper helper = HelperUtil.createOCLHelper();
helper.setContext(RoleprocessuserPackage.eINSTANCE.getRole() );
helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
: Role | Bag{x,x} )");

->This works<-
but:
helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
: Role | getSubroles(x) )");
->does not work
->Exception in thread "main"
->org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
->signature: (getSubroles(Role))

Also if I set the context to Organization
helper.setContext(RoleprocessuserPackage.eINSTANCE.getOrgani zation());
helper.define("getSubroles(r : Role) : Bag(Role) =
r.subrole->collect(x : Role | Bag{x,x} )");

I get the error:
Exception in thread "main"
org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
signature: (getSubroles(Organization))

I'll tested all the expressions via OCLE tool, their they work.
So I suppose there is an error in recursive definitions, and also in the
context evaluation of defines.
Chris


Christian W. Damus schrieb:
> Hi, Chris Lenz,
>
> You appear (to my news reader) to have posted a 14-line question about an
> OCL error, but the body of your message is unavailable. I don't see any
> evidence of it in the web interface.
>
> Would you mind posting again?
>
> Thanks,
>
> Christian
Re: "OCL Error" posting lost in space? [message #41838 is a reply to message #41748] Thu, 27 July 2006 15:14 Go to previous messageGo to next message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
Please read also my new posting:
I am not sure if the ocl definition means this with context:
context sets allways the context of self see the following:

context User
def: let getSubroles(r: Role) : Set(Role) =
r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole)

inv testingRoles:
-- collects all subroles of a role in the context
getSubroles(self.role)
->includesAll(self.role.subrole)

context is user, but the definition also works.
Christian W. Damus schrieb:
> A helpful soul who managed to download this article before it apparently
> disappeared forwarded it to me:
>
> <quote>
> IOCLHelper helper = HelperUtil.createOCLHelper();
> helper.setContext(org);
> helper.define("getSubroles(r : Role) : Set(Role) = " +
> "r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole) ");
> System.out.println(helper.evaluate(org.getRoles().get(3),
> "getSubroles(self)"));
>
> Can anyone see the error in the method definition??
>
> ---
> Exception in thread "main"
> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
> signature: (getSubroles(Role))
> </quote>
>
> Chris,
>
> What is the type of "org"? Is it Role? I suspect not, from the
> "org.getRoles()" in the evaluation statement. Your context in the
> operation definition should the the Role EClass.
>
> HTH,
>
> Christian
>
> Christian W. Damus wrote:
>
>> Hi, Chris Lenz,
>>
>> You appear (to my news reader) to have posted a 14-line question about an
>> OCL error, but the body of your message is unavailable. I don't see any
>> evidence of it in the web interface.
>>
>> Would you mind posting again?
>>
>> Thanks,
>>
>> Christian
>
Re: "OCL Error" posting lost in space? [message #41870 is a reply to message #41838] Thu, 27 July 2006 15:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Chris,

I'm not sure that I follow, but your original operation definition was
successfully parsed in the context of User only because it did not actually
reference any of the features of the context type. It only operates on the
parameter "r".

Given that definition of the operation, it must be evaluated on instances of
User, not Role.

HTH,

Christian


Chris Lenz wrote:

> Please read also my new posting:
> I am not sure if the ocl definition means this with context:
> context sets allways the context of self see the following:
>
> context User
> def: let getSubroles(r: Role) : Set(Role) =
> r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole)
>
> inv testingRoles:
> -- collects all subroles of a role in the context
> getSubroles(self.role)
> ->includesAll(self.role.subrole)
>
> context is user, but the definition also works.
> Christian W. Damus schrieb:
>> A helpful soul who managed to download this article before it apparently
>> disappeared forwarded it to me:
>>
>> <quote>
>> IOCLHelper helper = HelperUtil.createOCLHelper();
>> helper.setContext(org);
>> helper.define("getSubroles(r : Role) : Set(Role) = " +
>> "r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole) ");
>> System.out.println(helper.evaluate(org.getRoles().get(3),
>> "getSubroles(self)"));
>>
>> Can anyone see the error in the method definition??
>>
>> ---
>> Exception in thread "main"
>> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
>> signature: (getSubroles(Role))
>> </quote>
>>
>> Chris,
>>
>> What is the type of "org"? Is it Role? I suspect not, from the
>> "org.getRoles()" in the evaluation statement. Your context in the
>> operation definition should the the Role EClass.
>>
>> HTH,
>>
>> Christian
>>
>> Christian W. Damus wrote:
>>
>>> Hi, Chris Lenz,
>>>
>>> You appear (to my news reader) to have posted a 14-line question about
>>> an
>>> OCL error, but the body of your message is unavailable. I don't see any
>>> evidence of it in the web interface.
>>>
>>> Would you mind posting again?
>>>
>>> Thanks,
>>>
>>> Christian
>>
Re: "OCL Error" posting lost in space? [message #41901 is a reply to message #41870] Thu, 27 July 2006 15:32 Go to previous messageGo to next message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
Ok: Please read also the other post of mine in the same discussion.

The problem is, that the statement:
helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
: Role | Bag{x,x} )");
only compiles in context of Role not in context of user --> error look
to the other post.

I think that is not correct?? Maybe I am wrong?

I am not sure what is the context in the definition of a method, is this
also self?

The second thing is that the original statment (recursion) also does not
compile. error -> also in the other post.

Chris


Christian W. Damus schrieb:
> Hi, Chris,
>
> I'm not sure that I follow, but your original operation definition was
> successfully parsed in the context of User only because it did not actually
> reference any of the features of the context type. It only operates on the
> parameter "r".
>
> Given that definition of the operation, it must be evaluated on instances of
> User, not Role.
>
> HTH,
>
> Christian
>
>
> Chris Lenz wrote:
>
>> Please read also my new posting:
>> I am not sure if the ocl definition means this with context:
>> context sets allways the context of self see the following:
>>
>> context User
>> def: let getSubroles(r: Role) : Set(Role) =
>> r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole)
>>
>> inv testingRoles:
>> -- collects all subroles of a role in the context
>> getSubroles(self.role)
>> ->includesAll(self.role.subrole)
>>
>> context is user, but the definition also works.
>> Christian W. Damus schrieb:
>>> A helpful soul who managed to download this article before it apparently
>>> disappeared forwarded it to me:
>>>
>>> <quote>
>>> IOCLHelper helper = HelperUtil.createOCLHelper();
>>> helper.setContext(org);
>>> helper.define("getSubroles(r : Role) : Set(Role) = " +
>>> "r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole) ");
>>> System.out.println(helper.evaluate(org.getRoles().get(3),
>>> "getSubroles(self)"));
>>>
>>> Can anyone see the error in the method definition??
>>>
>>> ---
>>> Exception in thread "main"
>>> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
>>> signature: (getSubroles(Role))
>>> </quote>
>>>
>>> Chris,
>>>
>>> What is the type of "org"? Is it Role? I suspect not, from the
>>> "org.getRoles()" in the evaluation statement. Your context in the
>>> operation definition should the the Role EClass.
>>>
>>> HTH,
>>>
>>> Christian
>>>
>>> Christian W. Damus wrote:
>>>
>>>> Hi, Chris Lenz,
>>>>
>>>> You appear (to my news reader) to have posted a 14-line question about
>>>> an
>>>> OCL error, but the body of your message is unavailable. I don't see any
>>>> evidence of it in the web interface.
>>>>
>>>> Would you mind posting again?
>>>>
>>>> Thanks,
>>>>
>>>> Christian
>
Re: "OCL Error" posting lost in space? [message #41967 is a reply to message #41807] Thu, 27 July 2006 15:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Chris,

See some responses, in-line, below.

Cheers,

Christian


Chris Lenz wrote:

> Sorry it was a stupid thing:
> I post a new question nearly the same:
>
> IOCLHelper helper = HelperUtil.createOCLHelper();
> helper.setContext(RoleprocessuserPackage.eINSTANCE.getRole() );
> helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
> : Role | Bag{x,x} )");
>
> ->This works<-
> but:
> helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
> : Role | getSubroles(x) )");
> ->does not work
> ->Exception in thread "main"
> ->org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
> ->signature: (getSubroles(Role))

This looks like a bug. The getSubroles call in the collect body resolves
first against the iterator variable x, then against the context (self)
type. If Role (type of x) is not the context type, then getSubroles should
still resolve against the context (whatever it is). I suspect that the
problem is that, when parsing the operation definition, getSubroles isn't
yet available to the OCL parser because it's in the middle of defining.
Could you please raise a bug for this? These recursive definitions need to
be supported.

>
> Also if I set the context to Organization
> helper.setContext(RoleprocessuserPackage.eINSTANCE.getOrgani zation());
> helper.define("getSubroles(r : Role) : Bag(Role) =
> r.subrole->collect(x : Role | Bag{x,x} )");
>
> I get the error:
> Exception in thread "main"
> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
> signature: (getSubroles(Organization))

I don't see any invocation here of getSubroles with an Organization
argument. Did you miss something in your copy/paste?

>
> I'll tested all the expressions via OCLE tool, their they work.
> So I suppose there is an error in recursive definitions, and also in the
> context evaluation of defines.
> Chris
>
>
> Christian W. Damus schrieb:
>> Hi, Chris Lenz,
>>
>> You appear (to my news reader) to have posted a 14-line question about an
>> OCL error, but the body of your message is unavailable. I don't see any
>> evidence of it in the web interface.
>>
>> Would you mind posting again?
>>
>> Thanks,
>>
>> Christian
Re: "OCL Error" posting lost in space? [message #42028 is a reply to message #41967] Thu, 27 July 2006 15:58 Go to previous messageGo to next message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
Please see inline
Christian W. Damus schrieb:
> Hi, Chris,
>
> See some responses, in-line, below.
>
> Cheers,
>
> Christian
>
>
> Chris Lenz wrote:
>
>> Sorry it was a stupid thing:
>> I post a new question nearly the same:
>>
>> IOCLHelper helper = HelperUtil.createOCLHelper();
>> helper.setContext(RoleprocessuserPackage.eINSTANCE.getRole() );
>> helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
>> : Role | Bag{x,x} )");
>>
>> ->This works<-
>> but:
>> helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
>> : Role | getSubroles(x) )");
>> ->does not work
>> ->Exception in thread "main"
>> ->org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
>> ->signature: (getSubroles(Role))
>
> This looks like a bug. The getSubroles call in the collect body resolves
> first against the iterator variable x, then against the context (self)
> type. If Role (type of x) is not the context type, then getSubroles should
> still resolve against the context (whatever it is). I suspect that the
> problem is that, when parsing the operation definition, getSubroles isn't
> yet available to the OCL parser because it's in the middle of defining.
> Could you please raise a bug for this? These recursive definitions need to
> be supported.
>

ok

>> Also if I set the context to Organization
>> helper.setContext(RoleprocessuserPackage.eINSTANCE.getOrgani zation());
>> helper.define("getSubroles(r : Role) : Bag(Role) =
>> r.subrole->collect(x : Role | Bag{x,x} )");
>>
>> I get the error:
>> Exception in thread "main"
>> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
>> signature: (getSubroles(Organization))
>
> I don't see any invocation here of getSubroles with an Organization
> argument. Did you miss something in your copy/paste?
>
The point is not the invocation, I set the context (first line) to
Organization, and if come to the define call, I get an Excetpion of
OCLParsion!
>> I'll tested all the expressions via OCLE tool, their they work.
>> So I suppose there is an error in recursive definitions, and also in the
>> context evaluation of defines.
>> Chris
>>
>>
>> Christian W. Damus schrieb:
>>> Hi, Chris Lenz,
>>>
>>> You appear (to my news reader) to have posted a 14-line question about an
>>> OCL error, but the body of your message is unavailable. I don't see any
>>> evidence of it in the web interface.
>>>
>>> Would you mind posting again?
>>>
>>> Thanks,
>>>
>>> Christian
>
Re: "OCL Error" posting lost in space? [message #42243 is a reply to message #42028] Fri, 28 July 2006 15:48 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Chris Lenz wrote:

<snip>

>>> Also if I set the context to Organization
>>> helper.setContext(RoleprocessuserPackage.eINSTANCE.getOrgani zation());
>>> helper.define("getSubroles(r : Role) : Bag(Role) =
>>> r.subrole->collect(x : Role | Bag{x,x} )");
>>>
>>> I get the error:
>>> Exception in thread "main"
>>> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
>>> signature: (getSubroles(Organization))
>>
>> I don't see any invocation here of getSubroles with an Organization
>> argument. Did you miss something in your copy/paste?
>>
> The point is not the invocation, I set the context (first line) to
> Organization, and if come to the define call, I get an Excetpion of
> OCLParsion!

<snip>

Hi, Chris,

What I meant was, that I didn't see in the operation definition expression
any call to getSubroles() in which an Organization (such as self) was being
passed. So, either I'm not seeing something, or this is a particularly
strange bug because the parser is fabricating operation call expressions!

Cheers,

Christian
Re: "OCL Error" posting lost in space? [message #583564 is a reply to message #41717] Thu, 27 July 2006 13:26 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

A helpful soul who managed to download this article before it apparently
disappeared forwarded it to me:

<quote>
IOCLHelper helper = HelperUtil.createOCLHelper();
helper.setContext(org);
helper.define("getSubroles(r : Role) : Set(Role) = " +
"r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole) ");
System.out.println(helper.evaluate(org.getRoles().get(3),
"getSubroles(self)"));

Can anyone see the error in the method definition??

---
Exception in thread "main"
org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
signature: (getSubroles(Role))
</quote>

Chris,

What is the type of "org"? Is it Role? I suspect not, from the
"org.getRoles()" in the evaluation statement. Your context in the
operation definition should the the Role EClass.

HTH,

Christian

Christian W. Damus wrote:

>
> Hi, Chris Lenz,
>
> You appear (to my news reader) to have posted a 14-line question about an
> OCL error, but the body of your message is unavailable. I don't see any
> evidence of it in the web interface.
>
> Would you mind posting again?
>
> Thanks,
>
> Christian
Re: "OCL Error" posting lost in space? [message #583604 is a reply to message #41717] Thu, 27 July 2006 15:11 Go to previous message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
Sorry it was a stupid thing:
I post a new question nearly the same:

IOCLHelper helper = HelperUtil.createOCLHelper();
helper.setContext(RoleprocessuserPackage.eINSTANCE.getRole() );
helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
: Role | Bag{x,x} )");

->This works<-
but:
helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
: Role | getSubroles(x) )");
->does not work
->Exception in thread "main"
->org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
->signature: (getSubroles(Role))

Also if I set the context to Organization
helper.setContext(RoleprocessuserPackage.eINSTANCE.getOrgani zation());
helper.define("getSubroles(r : Role) : Bag(Role) =
r.subrole->collect(x : Role | Bag{x,x} )");

I get the error:
Exception in thread "main"
org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
signature: (getSubroles(Organization))

I'll tested all the expressions via OCLE tool, their they work.
So I suppose there is an error in recursive definitions, and also in the
context evaluation of defines.
Chris


Christian W. Damus schrieb:
> Hi, Chris Lenz,
>
> You appear (to my news reader) to have posted a 14-line question about an
> OCL error, but the body of your message is unavailable. I don't see any
> evidence of it in the web interface.
>
> Would you mind posting again?
>
> Thanks,
>
> Christian
Re: "OCL Error" posting lost in space? [message #583609 is a reply to message #41748] Thu, 27 July 2006 15:14 Go to previous message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
Please read also my new posting:
I am not sure if the ocl definition means this with context:
context sets allways the context of self see the following:

context User
def: let getSubroles(r: Role) : Set(Role) =
r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole)

inv testingRoles:
-- collects all subroles of a role in the context
getSubroles(self.role)
->includesAll(self.role.subrole)

context is user, but the definition also works.
Christian W. Damus schrieb:
> A helpful soul who managed to download this article before it apparently
> disappeared forwarded it to me:
>
> <quote>
> IOCLHelper helper = HelperUtil.createOCLHelper();
> helper.setContext(org);
> helper.define("getSubroles(r : Role) : Set(Role) = " +
> "r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole) ");
> System.out.println(helper.evaluate(org.getRoles().get(3),
> "getSubroles(self)"));
>
> Can anyone see the error in the method definition??
>
> ---
> Exception in thread "main"
> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
> signature: (getSubroles(Role))
> </quote>
>
> Chris,
>
> What is the type of "org"? Is it Role? I suspect not, from the
> "org.getRoles()" in the evaluation statement. Your context in the
> operation definition should the the Role EClass.
>
> HTH,
>
> Christian
>
> Christian W. Damus wrote:
>
>> Hi, Chris Lenz,
>>
>> You appear (to my news reader) to have posted a 14-line question about an
>> OCL error, but the body of your message is unavailable. I don't see any
>> evidence of it in the web interface.
>>
>> Would you mind posting again?
>>
>> Thanks,
>>
>> Christian
>
Re: "OCL Error" posting lost in space? [message #583627 is a reply to message #41838] Thu, 27 July 2006 15:26 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Chris,

I'm not sure that I follow, but your original operation definition was
successfully parsed in the context of User only because it did not actually
reference any of the features of the context type. It only operates on the
parameter "r".

Given that definition of the operation, it must be evaluated on instances of
User, not Role.

HTH,

Christian


Chris Lenz wrote:

> Please read also my new posting:
> I am not sure if the ocl definition means this with context:
> context sets allways the context of self see the following:
>
> context User
> def: let getSubroles(r: Role) : Set(Role) =
> r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole)
>
> inv testingRoles:
> -- collects all subroles of a role in the context
> getSubroles(self.role)
> ->includesAll(self.role.subrole)
>
> context is user, but the definition also works.
> Christian W. Damus schrieb:
>> A helpful soul who managed to download this article before it apparently
>> disappeared forwarded it to me:
>>
>> <quote>
>> IOCLHelper helper = HelperUtil.createOCLHelper();
>> helper.setContext(org);
>> helper.define("getSubroles(r : Role) : Set(Role) = " +
>> "r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole) ");
>> System.out.println(helper.evaluate(org.getRoles().get(3),
>> "getSubroles(self)"));
>>
>> Can anyone see the error in the method definition??
>>
>> ---
>> Exception in thread "main"
>> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
>> signature: (getSubroles(Role))
>> </quote>
>>
>> Chris,
>>
>> What is the type of "org"? Is it Role? I suspect not, from the
>> "org.getRoles()" in the evaluation statement. Your context in the
>> operation definition should the the Role EClass.
>>
>> HTH,
>>
>> Christian
>>
>> Christian W. Damus wrote:
>>
>>> Hi, Chris Lenz,
>>>
>>> You appear (to my news reader) to have posted a 14-line question about
>>> an
>>> OCL error, but the body of your message is unavailable. I don't see any
>>> evidence of it in the web interface.
>>>
>>> Would you mind posting again?
>>>
>>> Thanks,
>>>
>>> Christian
>>
Re: "OCL Error" posting lost in space? [message #583634 is a reply to message #41870] Thu, 27 July 2006 15:32 Go to previous message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
Ok: Please read also the other post of mine in the same discussion.

The problem is, that the statement:
helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
: Role | Bag{x,x} )");
only compiles in context of Role not in context of user --> error look
to the other post.

I think that is not correct?? Maybe I am wrong?

I am not sure what is the context in the definition of a method, is this
also self?

The second thing is that the original statment (recursion) also does not
compile. error -> also in the other post.

Chris


Christian W. Damus schrieb:
> Hi, Chris,
>
> I'm not sure that I follow, but your original operation definition was
> successfully parsed in the context of User only because it did not actually
> reference any of the features of the context type. It only operates on the
> parameter "r".
>
> Given that definition of the operation, it must be evaluated on instances of
> User, not Role.
>
> HTH,
>
> Christian
>
>
> Chris Lenz wrote:
>
>> Please read also my new posting:
>> I am not sure if the ocl definition means this with context:
>> context sets allways the context of self see the following:
>>
>> context User
>> def: let getSubroles(r: Role) : Set(Role) =
>> r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole)
>>
>> inv testingRoles:
>> -- collects all subroles of a role in the context
>> getSubroles(self.role)
>> ->includesAll(self.role.subrole)
>>
>> context is user, but the definition also works.
>> Christian W. Damus schrieb:
>>> A helpful soul who managed to download this article before it apparently
>>> disappeared forwarded it to me:
>>>
>>> <quote>
>>> IOCLHelper helper = HelperUtil.createOCLHelper();
>>> helper.setContext(org);
>>> helper.define("getSubroles(r : Role) : Set(Role) = " +
>>> "r.subrole->collect(x|getSubroles(x))->asSet()->union(r.subrole) ");
>>> System.out.println(helper.evaluate(org.getRoles().get(3),
>>> "getSubroles(self)"));
>>>
>>> Can anyone see the error in the method definition??
>>>
>>> ---
>>> Exception in thread "main"
>>> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
>>> signature: (getSubroles(Role))
>>> </quote>
>>>
>>> Chris,
>>>
>>> What is the type of "org"? Is it Role? I suspect not, from the
>>> "org.getRoles()" in the evaluation statement. Your context in the
>>> operation definition should the the Role EClass.
>>>
>>> HTH,
>>>
>>> Christian
>>>
>>> Christian W. Damus wrote:
>>>
>>>> Hi, Chris Lenz,
>>>>
>>>> You appear (to my news reader) to have posted a 14-line question about
>>>> an
>>>> OCL error, but the body of your message is unavailable. I don't see any
>>>> evidence of it in the web interface.
>>>>
>>>> Would you mind posting again?
>>>>
>>>> Thanks,
>>>>
>>>> Christian
>
Re: "OCL Error" posting lost in space? [message #583661 is a reply to message #41807] Thu, 27 July 2006 15:41 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Chris,

See some responses, in-line, below.

Cheers,

Christian


Chris Lenz wrote:

> Sorry it was a stupid thing:
> I post a new question nearly the same:
>
> IOCLHelper helper = HelperUtil.createOCLHelper();
> helper.setContext(RoleprocessuserPackage.eINSTANCE.getRole() );
> helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
> : Role | Bag{x,x} )");
>
> ->This works<-
> but:
> helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
> : Role | getSubroles(x) )");
> ->does not work
> ->Exception in thread "main"
> ->org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
> ->signature: (getSubroles(Role))

This looks like a bug. The getSubroles call in the collect body resolves
first against the iterator variable x, then against the context (self)
type. If Role (type of x) is not the context type, then getSubroles should
still resolve against the context (whatever it is). I suspect that the
problem is that, when parsing the operation definition, getSubroles isn't
yet available to the OCL parser because it's in the middle of defining.
Could you please raise a bug for this? These recursive definitions need to
be supported.

>
> Also if I set the context to Organization
> helper.setContext(RoleprocessuserPackage.eINSTANCE.getOrgani zation());
> helper.define("getSubroles(r : Role) : Bag(Role) =
> r.subrole->collect(x : Role | Bag{x,x} )");
>
> I get the error:
> Exception in thread "main"
> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
> signature: (getSubroles(Organization))

I don't see any invocation here of getSubroles with an Organization
argument. Did you miss something in your copy/paste?

>
> I'll tested all the expressions via OCLE tool, their they work.
> So I suppose there is an error in recursive definitions, and also in the
> context evaluation of defines.
> Chris
>
>
> Christian W. Damus schrieb:
>> Hi, Chris Lenz,
>>
>> You appear (to my news reader) to have posted a 14-line question about an
>> OCL error, but the body of your message is unavailable. I don't see any
>> evidence of it in the web interface.
>>
>> Would you mind posting again?
>>
>> Thanks,
>>
>> Christian
Re: "OCL Error" posting lost in space? [message #583681 is a reply to message #41967] Thu, 27 July 2006 15:58 Go to previous message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
Please see inline
Christian W. Damus schrieb:
> Hi, Chris,
>
> See some responses, in-line, below.
>
> Cheers,
>
> Christian
>
>
> Chris Lenz wrote:
>
>> Sorry it was a stupid thing:
>> I post a new question nearly the same:
>>
>> IOCLHelper helper = HelperUtil.createOCLHelper();
>> helper.setContext(RoleprocessuserPackage.eINSTANCE.getRole() );
>> helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
>> : Role | Bag{x,x} )");
>>
>> ->This works<-
>> but:
>> helper.define("getSubroles(r : Role) : Bag(Role) = r.subrole->collect(x
>> : Role | getSubroles(x) )");
>> ->does not work
>> ->Exception in thread "main"
>> ->org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
>> ->signature: (getSubroles(Role))
>
> This looks like a bug. The getSubroles call in the collect body resolves
> first against the iterator variable x, then against the context (self)
> type. If Role (type of x) is not the context type, then getSubroles should
> still resolve against the context (whatever it is). I suspect that the
> problem is that, when parsing the operation definition, getSubroles isn't
> yet available to the OCL parser because it's in the middle of defining.
> Could you please raise a bug for this? These recursive definitions need to
> be supported.
>

ok

>> Also if I set the context to Organization
>> helper.setContext(RoleprocessuserPackage.eINSTANCE.getOrgani zation());
>> helper.define("getSubroles(r : Role) : Bag(Role) =
>> r.subrole->collect(x : Role | Bag{x,x} )");
>>
>> I get the error:
>> Exception in thread "main"
>> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
>> signature: (getSubroles(Organization))
>
> I don't see any invocation here of getSubroles with an Organization
> argument. Did you miss something in your copy/paste?
>
The point is not the invocation, I set the context (first line) to
Organization, and if come to the define call, I get an Excetpion of
OCLParsion!
>> I'll tested all the expressions via OCLE tool, their they work.
>> So I suppose there is an error in recursive definitions, and also in the
>> context evaluation of defines.
>> Chris
>>
>>
>> Christian W. Damus schrieb:
>>> Hi, Chris Lenz,
>>>
>>> You appear (to my news reader) to have posted a 14-line question about an
>>> OCL error, but the body of your message is unavailable. I don't see any
>>> evidence of it in the web interface.
>>>
>>> Would you mind posting again?
>>>
>>> Thanks,
>>>
>>> Christian
>
Re: "OCL Error" posting lost in space? [message #583797 is a reply to message #42028] Fri, 28 July 2006 15:48 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Chris Lenz wrote:

<snip>

>>> Also if I set the context to Organization
>>> helper.setContext(RoleprocessuserPackage.eINSTANCE.getOrgani zation());
>>> helper.define("getSubroles(r : Role) : Bag(Role) =
>>> r.subrole->collect(x : Role | Bag{x,x} )");
>>>
>>> I get the error:
>>> Exception in thread "main"
>>> org.eclipse.emf.ocl.helper.OCLParsingException: illegal operation
>>> signature: (getSubroles(Organization))
>>
>> I don't see any invocation here of getSubroles with an Organization
>> argument. Did you miss something in your copy/paste?
>>
> The point is not the invocation, I set the context (first line) to
> Organization, and if come to the define call, I get an Excetpion of
> OCLParsion!

<snip>

Hi, Chris,

What I meant was, that I didn't see in the operation definition expression
any call to getSubroles() in which an Organization (such as self) was being
passed. So, either I'm not seeing something, or this is a particularly
strange bug because the parser is fabricating operation call expressions!

Cheers,

Christian
Previous Topic:CDO ResourceManager lifecycle
Next Topic:Complex OCL console
Goto Forum:
  


Current Time: Thu Mar 28 10:49:12 GMT 2024

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

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

Back to the top