Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Use of operation parameters and @pre in ocl constraints
Use of operation parameters and @pre in ocl constraints [message #33367] |
Fri, 05 May 2006 14:00 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: sebastien.xxxxx.com
Hello,
I'm working with EMFT OCL and I have some problems :
- When I write constraints on an operation the parameters aren't recognize
when they are used. By example :
context ClassName::operationName(param::Integer)
pre : param > 0
the error is : org.eclipse.emf.ocl.parser.SemanticException: ERROR in
(variableExpCS): (Unrecognized variable: (param))
- When I use @pre in ocl constraints : this keyword seems to not be
recognize : The errors are :
org.eclipse.emf.ocl.parser.ParserException: 1:11:1:11 token "@ is invalid"
and org.eclipse.emf.ocl.parser.ParserException: 1:1:1:3 token "pre is
invalid"
Do you know theses problems ? and if yes are they planned to be resolved ?
Regards
|
|
|
Re: Use of operation parameters and @pre in ocl constraints [message #33401 is a reply to message #33367] |
Fri, 05 May 2006 15:22 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Sebastien,
In the first case, you are declaring a parameter named "param::Integer".
You only want one colon (":"). I think this should have been caught as a
syntax error :-) In any case, with only one colon, it should work.
I suspect that your @pre problem is due to attempting to use it in an
invalid context; it is only recognized on feature call expressions
(operation calls, property navigation). If you provide an example as you
did for the parameter problem, I could help you to identify the cause.
HTH,
Christian
Sebastien wrote:
> Hello,
>
> I'm working with EMFT OCL and I have some problems :
>
> - When I write constraints on an operation the parameters aren't recognize
> when they are used. By example :
>
> context ClassName::operationName(param::Integer)
> pre : param > 0
>
> the error is : org.eclipse.emf.ocl.parser.SemanticException: ERROR in
> (variableExpCS): (Unrecognized variable: (param))
>
>
> - When I use @pre in ocl constraints : this keyword seems to not be
> recognize : The errors are :
> org.eclipse.emf.ocl.parser.ParserException: 1:11:1:11 token "@ is invalid"
> and org.eclipse.emf.ocl.parser.ParserException: 1:1:1:3 token "pre is
> invalid"
>
>
> Do you know theses problems ? and if yes are they planned to be resolved ?
>
> Regards
|
|
|
Re: Use of operation parameters and @pre in ocl constraints [message #33432 is a reply to message #33401] |
Fri, 05 May 2006 15:35 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: sebastien.xxxxx.com
Hi,
Sorry for my mistake in my post but I use ":" in my OCL constraint and not
"::". The problem doesn't come from that.
For the @pre I use it like that :
context ClassName::operationName(param:Integer)
pre : param > 0
post : classParam = classParam@pre + param
Thanks for your answer
Sebastien
Christian W. Damus wrote:
> Hi, Sebastien,
> In the first case, you are declaring a parameter named "param::Integer".
> You only want one colon (":"). I think this should have been caught as a
> syntax error :-) In any case, with only one colon, it should work.
> I suspect that your @pre problem is due to attempting to use it in an
> invalid context; it is only recognized on feature call expressions
> (operation calls, property navigation). If you provide an example as you
> did for the parameter problem, I could help you to identify the cause.
> HTH,
> Christian
> Sebastien wrote:
>> Hello,
>>
>> I'm working with EMFT OCL and I have some problems :
>>
>> - When I write constraints on an operation the parameters aren't recognize
>> when they are used. By example :
>>
>> context ClassName::operationName(param::Integer)
>> pre : param > 0
>>
>> the error is : org.eclipse.emf.ocl.parser.SemanticException: ERROR in
>> (variableExpCS): (Unrecognized variable: (param))
>>
>>
>> - When I use @pre in ocl constraints : this keyword seems to not be
>> recognize : The errors are :
>> org.eclipse.emf.ocl.parser.ParserException: 1:11:1:11 token "@ is invalid"
>> and org.eclipse.emf.ocl.parser.ParserException: 1:1:1:3 token "pre is
>> invalid"
>>
>>
>> Do you know theses problems ? and if yes are they planned to be resolved ?
>>
>> Regards
|
|
|
Re: Use of operation parameters and @pre in ocl constraints [message #33465 is a reply to message #33432] |
Fri, 05 May 2006 20:02 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Sebastien,
What is 'classParam'? Is that a property of the 'ClassName' classifier?
Ah ... I think I see it now. You need a ":" after the context operation
declaration, even if it has no result type. So, this should read
context ClassName::operationName(param:Integer) :
pre : param > 0
post : classParam = classParam@pre + param
HTH,
Christian
Sebastien wrote:
> Hi,
>
> Sorry for my mistake in my post but I use ":" in my OCL constraint and not
> "::". The problem doesn't come from that.
>
> For the @pre I use it like that :
> context ClassName::operationName(param:Integer)
> pre : param > 0
> post : classParam = classParam@pre + param
>
> Thanks for your answer
>
> Sebastien
>
> Christian W. Damus wrote:
<snip>
|
|
|
Re: Use of operation parameters and @pre in ocl constraints [message #33499 is a reply to message #33465] |
Fri, 05 May 2006 20:14 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Just to clarify: the requirement of the ':' in the operation context
declaration is a quirk of the OCL 2.0 specification and is, IMO, an error.
Looking at operationContextDeclCS (section 12.13.8), it includes operationCS
(12.13.10) which in both the [A] and [B] forms requires the ':' despite the
typeCS being optional.
The attrOrContextCS (12.13.3) does not have this problem because the typeCS
is mandatory for property context, and the classifierContextDeclCS
(12.13.5) also doesn't have a trailing ':'.
The reason why I think this is an error in the spec is that the examples of
operation constraints in section 7.5.14 do not show a ':'.
Perhaps you could raise a bugzilla requesting that the ':' be optional when
the operation has no result type? I would like to still support the ':'
for compatibility, but the OCL is cleaner without it.
Cheers,
Christian
Christian W. Damus wrote:
>
> Hi, Sebastien,
>
> What is 'classParam'? Is that a property of the 'ClassName' classifier?
>
> Ah ... I think I see it now. You need a ":" after the context operation
> declaration, even if it has no result type. So, this should read
>
> context ClassName::operationName(param:Integer) :
> pre : param > 0
> post : classParam = classParam@pre + param
>
> HTH,
>
> Christian
>
>
> Sebastien wrote:
>
>> Hi,
>>
>> Sorry for my mistake in my post but I use ":" in my OCL constraint and
>> not "::". The problem doesn't come from that.
>>
>> For the @pre I use it like that :
>> context ClassName::operationName(param:Integer)
>> pre : param > 0
>> post : classParam = classParam@pre + param
>>
>> Thanks for your answer
>>
>> Sebastien
>>
>> Christian W. Damus wrote:
>
> <snip>
|
|
| |
Re: Use of operation parameters and @pre in ocl constraints [message #576936 is a reply to message #33367] |
Fri, 05 May 2006 15:22 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Sebastien,
In the first case, you are declaring a parameter named "param::Integer".
You only want one colon (":"). I think this should have been caught as a
syntax error :-) In any case, with only one colon, it should work.
I suspect that your @pre problem is due to attempting to use it in an
invalid context; it is only recognized on feature call expressions
(operation calls, property navigation). If you provide an example as you
did for the parameter problem, I could help you to identify the cause.
HTH,
Christian
Sebastien wrote:
> Hello,
>
> I'm working with EMFT OCL and I have some problems :
>
> - When I write constraints on an operation the parameters aren't recognize
> when they are used. By example :
>
> context ClassName::operationName(param::Integer)
> pre : param > 0
>
> the error is : org.eclipse.emf.ocl.parser.SemanticException: ERROR in
> (variableExpCS): (Unrecognized variable: (param))
>
>
> - When I use @pre in ocl constraints : this keyword seems to not be
> recognize : The errors are :
> org.eclipse.emf.ocl.parser.ParserException: 1:11:1:11 token "@ is invalid"
> and org.eclipse.emf.ocl.parser.ParserException: 1:1:1:3 token "pre is
> invalid"
>
>
> Do you know theses problems ? and if yes are they planned to be resolved ?
>
> Regards
|
|
|
Re: Use of operation parameters and @pre in ocl constraints [message #576948 is a reply to message #33401] |
Fri, 05 May 2006 15:35 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Sebastien![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=dorey_s%40laposte.net) Messages: 20 Registered: July 2009 |
Junior Member |
|
|
Hi,
Sorry for my mistake in my post but I use ":" in my OCL constraint and not
"::". The problem doesn't come from that.
For the @pre I use it like that :
context ClassName::operationName(param:Integer)
pre : param > 0
post : classParam = classParam@pre + param
Thanks for your answer
Sebastien
Christian W. Damus wrote:
> Hi, Sebastien,
> In the first case, you are declaring a parameter named "param::Integer".
> You only want one colon (":"). I think this should have been caught as a
> syntax error :-) In any case, with only one colon, it should work.
> I suspect that your @pre problem is due to attempting to use it in an
> invalid context; it is only recognized on feature call expressions
> (operation calls, property navigation). If you provide an example as you
> did for the parameter problem, I could help you to identify the cause.
> HTH,
> Christian
> Sebastien wrote:
>> Hello,
>>
>> I'm working with EMFT OCL and I have some problems :
>>
>> - When I write constraints on an operation the parameters aren't recognize
>> when they are used. By example :
>>
>> context ClassName::operationName(param::Integer)
>> pre : param > 0
>>
>> the error is : org.eclipse.emf.ocl.parser.SemanticException: ERROR in
>> (variableExpCS): (Unrecognized variable: (param))
>>
>>
>> - When I use @pre in ocl constraints : this keyword seems to not be
>> recognize : The errors are :
>> org.eclipse.emf.ocl.parser.ParserException: 1:11:1:11 token "@ is invalid"
>> and org.eclipse.emf.ocl.parser.ParserException: 1:1:1:3 token "pre is
>> invalid"
>>
>>
>> Do you know theses problems ? and if yes are they planned to be resolved ?
>>
>> Regards
|
|
|
Re: Use of operation parameters and @pre in ocl constraints [message #576973 is a reply to message #33432] |
Fri, 05 May 2006 20:02 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Sebastien,
What is 'classParam'? Is that a property of the 'ClassName' classifier?
Ah ... I think I see it now. You need a ":" after the context operation
declaration, even if it has no result type. So, this should read
context ClassName::operationName(param:Integer) :
pre : param > 0
post : classParam = classParam@pre + param
HTH,
Christian
Sebastien wrote:
> Hi,
>
> Sorry for my mistake in my post but I use ":" in my OCL constraint and not
> "::". The problem doesn't come from that.
>
> For the @pre I use it like that :
> context ClassName::operationName(param:Integer)
> pre : param > 0
> post : classParam = classParam@pre + param
>
> Thanks for your answer
>
> Sebastien
>
> Christian W. Damus wrote:
<snip>
|
|
|
Re: Use of operation parameters and @pre in ocl constraints [message #577000 is a reply to message #33465] |
Fri, 05 May 2006 20:14 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Just to clarify: the requirement of the ':' in the operation context
declaration is a quirk of the OCL 2.0 specification and is, IMO, an error.
Looking at operationContextDeclCS (section 12.13.8), it includes operationCS
(12.13.10) which in both the [A] and [B] forms requires the ':' despite the
typeCS being optional.
The attrOrContextCS (12.13.3) does not have this problem because the typeCS
is mandatory for property context, and the classifierContextDeclCS
(12.13.5) also doesn't have a trailing ':'.
The reason why I think this is an error in the spec is that the examples of
operation constraints in section 7.5.14 do not show a ':'.
Perhaps you could raise a bugzilla requesting that the ':' be optional when
the operation has no result type? I would like to still support the ':'
for compatibility, but the OCL is cleaner without it.
Cheers,
Christian
Christian W. Damus wrote:
>
> Hi, Sebastien,
>
> What is 'classParam'? Is that a property of the 'ClassName' classifier?
>
> Ah ... I think I see it now. You need a ":" after the context operation
> declaration, even if it has no result type. So, this should read
>
> context ClassName::operationName(param:Integer) :
> pre : param > 0
> post : classParam = classParam@pre + param
>
> HTH,
>
> Christian
>
>
> Sebastien wrote:
>
>> Hi,
>>
>> Sorry for my mistake in my post but I use ":" in my OCL constraint and
>> not "::". The problem doesn't come from that.
>>
>> For the @pre I use it like that :
>> context ClassName::operationName(param:Integer)
>> pre : param > 0
>> post : classParam = classParam@pre + param
>>
>> Thanks for your answer
>>
>> Sebastien
>>
>> Christian W. Damus wrote:
>
> <snip>
|
|
| |
Goto Forum:
Current Time: Fri Aug 16 17:23:28 GMT 2024
Powered by FUDForum. Page generated in 0.04501 seconds
|