Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Cannot find operation xyz() for the type (abc)
Cannot find operation xyz() for the type (abc) [message #49856] Mon, 11 September 2006 16:16 Go to next message
Eclipse UserFriend
Originally posted by: nospam.myemail.fr

Hi all,

I have an enumeration type called Direction that can take "in", "out" or "in
out" as its string literals. I also have an operation as follows in the
enumeration class:

public boolean incoming() {
return this == IN_LITERAL || this == INOUT_LITERAL;
}

But when I write an OCL constraint such as:
"...port->exists(direction.incoming())" it gives me the following error
during execution

"(Cannot find operation (incoming()) for the type (PortDirection))"

I am at my wit's end and would any help would be greatly appreciated.

Regards,
Irfan Hamid.
Re: Cannot find operation xyz() for the type (abc) [message #49916 is a reply to message #49856] Tue, 12 September 2006 15:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Irfan,

Christian understands what's possible better than me, but I believe the
implementation can only call methods that are modeled as EOperations (on
EClasses) and since you can't define an EOperation for an EEnum, I don't
think you can call this method. Probably your best bet is simply to
test for these two things..


Irfan Hamid wrote:
> Hi all,
>
> I have an enumeration type called Direction that can take "in", "out" or "in
> out" as its string literals. I also have an operation as follows in the
> enumeration class:
>
> public boolean incoming() {
> return this == IN_LITERAL || this == INOUT_LITERAL;
> }
>
> But when I write an OCL constraint such as:
> "...port->exists(direction.incoming())" it gives me the following error
> during execution
>
> "(Cannot find operation (incoming()) for the type (PortDirection))"
>
> I am at my wit's end and would any help would be greatly appreciated.
>
> Regards,
> Irfan Hamid.
>
>
>
Re: Cannot find operation xyz() for the type (abc) [message #49942 is a reply to message #49916] Wed, 13 September 2006 09:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nospam.mymail.fr

Ed,

Ok. Will try that. But in fact what I needed that for was to test the
value of an EEnum. I'm working with two meta-models, one is my own and
generated with EMF2.2. The other is a 3rd-party meta-model that I cannot
change, generated with (I suspect) an older version of EMF. My model is
flat, the 3rd-party model is organized into packages.

For EEnum instances of my own model, I can test the values as
"protocol=TASKPROTOCOL::PERIODIC". This is not possible for EEnum
instances of the 3rd-party model, if I test as
"port.direction=interface::PORTDIRECTION::IN" it will give me an error
saying

java.lang.IllegalArgumentException:
org.eclipse.emf.ocl.parser.SemanticException: ERROR in
(enumerationOrClassLiteralExpCS): (Unknown enumeration literal (IN))

A tell-tale difference between the code generated from my model and that
of the 3rd-party model is that my model's EEnum constructors have the
signature

constructor_name(int value, String name, String literal)

whereas the 3rd-party model's EEnum constructors' signature is

constructor_name(int value, String name)

Regards,
Irfan Hamid.

Ed Merks wrote:
> Irfan,
>
> Christian understands what's possible better than me, but I believe the
> implementation can only call methods that are modeled as EOperations (on
> EClasses) and since you can't define an EOperation for an EEnum, I don't
> think you can call this method. Probably your best bet is simply to
> test for these two things..
>
>
> Irfan Hamid wrote:
>
>> Hi all,
>>
>> I have an enumeration type called Direction that can take "in", "out"
>> or "in out" as its string literals. I also have an operation as
>> follows in the enumeration class:
>>
>> public boolean incoming() {
>> return this == IN_LITERAL || this == INOUT_LITERAL;
>> }
>>
>> But when I write an OCL constraint such as:
>> "...port->exists(direction.incoming())" it gives me the following
>> error during execution
>>
>> "(Cannot find operation (incoming()) for the type (PortDirection))"
>>
>> I am at my wit's end and would any help would be greatly appreciated.
>>
>> Regards,
>> Irfan Hamid.
>>
>>
Re: Cannot find operation xyz() for the type (abc) [message #49962 is a reply to message #49942] Wed, 13 September 2006 17:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Irfan,

As Ed indicated, since EEnums cannot define operations, you cannot define
any that would be accessible to OCL. However, that seems beside the point,
now.

Is the name of the PORTDIRECTION enumeration literal "in" (lower case), by
any chance? The names in OCL are case-sensitive, as they are in EMF. The
error message that you got indicates that OCL found the enumeration type
because it says the literal could not be found, rather than
"Unknown type ([interface, PORTDIRECTION, IN])".

HTH,

Christian


Irfan Hamid wrote:

> Ed,
>
> Ok. Will try that. But in fact what I needed that for was to test the
> value of an EEnum. I'm working with two meta-models, one is my own and
> generated with EMF2.2. The other is a 3rd-party meta-model that I cannot
> change, generated with (I suspect) an older version of EMF. My model is
> flat, the 3rd-party model is organized into packages.
>
> For EEnum instances of my own model, I can test the values as
> "protocol=TASKPROTOCOL::PERIODIC". This is not possible for EEnum
> instances of the 3rd-party model, if I test as
> "port.direction=interface::PORTDIRECTION::IN" it will give me an error
> saying
>
> java.lang.IllegalArgumentException:
> org.eclipse.emf.ocl.parser.SemanticException: ERROR in
> (enumerationOrClassLiteralExpCS): (Unknown enumeration literal (IN))
>
> A tell-tale difference between the code generated from my model and that
> of the 3rd-party model is that my model's EEnum constructors have the
> signature
>
> constructor_name(int value, String name, String literal)
>
> whereas the 3rd-party model's EEnum constructors' signature is
>
> constructor_name(int value, String name)
>
> Regards,
> Irfan Hamid.

<snip>
Re: Cannot find operation xyz() for the type (abc) [message #50019 is a reply to message #49962] Wed, 13 September 2006 17:42 Go to previous message
Eclipse UserFriend
Originally posted by: nospam.mymail.fr

Hi Christian,

I thought of the same thing, here's how the class defines the literal

public static final PORTDIRECTION IN_LITERAL = new PORTDIRECTION(IN, "in");

So I tried also the other value, which is defined as

public static final PORTDIRECTION OUT_LITERAL = new PORTDIRECTION(OUT,
"out");

But still the same error message:

(Unknown enumeration literal (OUT))

Regards,
Irfan.

PS: Could it have anything to do with the fact that the constructor used
does not accept a String literal as follows:

public static final TASKPROTOCOL PERIODIC_LITERAL = new
TASKPROTOCOL(PERIODIC, "PERIODIC", "PERIODIC");???

Christian W. Damus wrote:
> Hi, Irfan,
>
> As Ed indicated, since EEnums cannot define operations, you cannot define
> any that would be accessible to OCL. However, that seems beside the point,
> now.
>
> Is the name of the PORTDIRECTION enumeration literal "in" (lower case), by
> any chance? The names in OCL are case-sensitive, as they are in EMF. The
> error message that you got indicates that OCL found the enumeration type
> because it says the literal could not be found, rather than
> "Unknown type ([interface, PORTDIRECTION, IN])".
>
> HTH,
>
> Christian
>
>
> Irfan Hamid wrote:
>
>
>>Ed,
>>
>>Ok. Will try that. But in fact what I needed that for was to test the
>>value of an EEnum. I'm working with two meta-models, one is my own and
>>generated with EMF2.2. The other is a 3rd-party meta-model that I cannot
>>change, generated with (I suspect) an older version of EMF. My model is
>>flat, the 3rd-party model is organized into packages.
>>
>>For EEnum instances of my own model, I can test the values as
>>"protocol=TASKPROTOCOL::PERIODIC". This is not possible for EEnum
>>instances of the 3rd-party model, if I test as
>>"port.direction=interface::PORTDIRECTION::IN" it will give me an error
>>saying
>>
>>java.lang.IllegalArgumentException:
>>org.eclipse.emf.ocl.parser.SemanticException: ERROR in
>>(enumerationOrClassLiteralExpCS): (Unknown enumeration literal (IN))
>>
>>A tell-tale difference between the code generated from my model and that
>>of the 3rd-party model is that my model's EEnum constructors have the
>>signature
>>
>>constructor_name(int value, String name, String literal)
>>
>>whereas the 3rd-party model's EEnum constructors' signature is
>>
>>constructor_name(int value, String name)
>>
>>Regards,
>>Irfan Hamid.
>
>
> <snip>
Re: Cannot find operation xyz() for the type (abc) [message #590814 is a reply to message #49856] Tue, 12 September 2006 15:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Irfan,

Christian understands what's possible better than me, but I believe the
implementation can only call methods that are modeled as EOperations (on
EClasses) and since you can't define an EOperation for an EEnum, I don't
think you can call this method. Probably your best bet is simply to
test for these two things..


Irfan Hamid wrote:
> Hi all,
>
> I have an enumeration type called Direction that can take "in", "out" or "in
> out" as its string literals. I also have an operation as follows in the
> enumeration class:
>
> public boolean incoming() {
> return this == IN_LITERAL || this == INOUT_LITERAL;
> }
>
> But when I write an OCL constraint such as:
> "...port->exists(direction.incoming())" it gives me the following error
> during execution
>
> "(Cannot find operation (incoming()) for the type (PortDirection))"
>
> I am at my wit's end and would any help would be greatly appreciated.
>
> Regards,
> Irfan Hamid.
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Cannot find operation xyz() for the type (abc) [message #590844 is a reply to message #49916] Wed, 13 September 2006 09:23 Go to previous message
Eclipse UserFriend
Originally posted by: nospam.mymail.fr

Ed,

Ok. Will try that. But in fact what I needed that for was to test the
value of an EEnum. I'm working with two meta-models, one is my own and
generated with EMF2.2. The other is a 3rd-party meta-model that I cannot
change, generated with (I suspect) an older version of EMF. My model is
flat, the 3rd-party model is organized into packages.

For EEnum instances of my own model, I can test the values as
"protocol=TASKPROTOCOL::PERIODIC". This is not possible for EEnum
instances of the 3rd-party model, if I test as
"port.direction=interface::PORTDIRECTION::IN" it will give me an error
saying

java.lang.IllegalArgumentException:
org.eclipse.emf.ocl.parser.SemanticException: ERROR in
(enumerationOrClassLiteralExpCS): (Unknown enumeration literal (IN))

A tell-tale difference between the code generated from my model and that
of the 3rd-party model is that my model's EEnum constructors have the
signature

constructor_name(int value, String name, String literal)

whereas the 3rd-party model's EEnum constructors' signature is

constructor_name(int value, String name)

Regards,
Irfan Hamid.

Ed Merks wrote:
> Irfan,
>
> Christian understands what's possible better than me, but I believe the
> implementation can only call methods that are modeled as EOperations (on
> EClasses) and since you can't define an EOperation for an EEnum, I don't
> think you can call this method. Probably your best bet is simply to
> test for these two things..
>
>
> Irfan Hamid wrote:
>
>> Hi all,
>>
>> I have an enumeration type called Direction that can take "in", "out"
>> or "in out" as its string literals. I also have an operation as
>> follows in the enumeration class:
>>
>> public boolean incoming() {
>> return this == IN_LITERAL || this == INOUT_LITERAL;
>> }
>>
>> But when I write an OCL constraint such as:
>> "...port->exists(direction.incoming())" it gives me the following
>> error during execution
>>
>> "(Cannot find operation (incoming()) for the type (PortDirection))"
>>
>> I am at my wit's end and would any help would be greatly appreciated.
>>
>> Regards,
>> Irfan Hamid.
>>
>>
Re: Cannot find operation xyz() for the type (abc) [message #590858 is a reply to message #49942] Wed, 13 September 2006 17:18 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Irfan,

As Ed indicated, since EEnums cannot define operations, you cannot define
any that would be accessible to OCL. However, that seems beside the point,
now.

Is the name of the PORTDIRECTION enumeration literal "in" (lower case), by
any chance? The names in OCL are case-sensitive, as they are in EMF. The
error message that you got indicates that OCL found the enumeration type
because it says the literal could not be found, rather than
"Unknown type ([interface, PORTDIRECTION, IN])".

HTH,

Christian


Irfan Hamid wrote:

> Ed,
>
> Ok. Will try that. But in fact what I needed that for was to test the
> value of an EEnum. I'm working with two meta-models, one is my own and
> generated with EMF2.2. The other is a 3rd-party meta-model that I cannot
> change, generated with (I suspect) an older version of EMF. My model is
> flat, the 3rd-party model is organized into packages.
>
> For EEnum instances of my own model, I can test the values as
> "protocol=TASKPROTOCOL::PERIODIC". This is not possible for EEnum
> instances of the 3rd-party model, if I test as
> "port.direction=interface::PORTDIRECTION::IN" it will give me an error
> saying
>
> java.lang.IllegalArgumentException:
> org.eclipse.emf.ocl.parser.SemanticException: ERROR in
> (enumerationOrClassLiteralExpCS): (Unknown enumeration literal (IN))
>
> A tell-tale difference between the code generated from my model and that
> of the 3rd-party model is that my model's EEnum constructors have the
> signature
>
> constructor_name(int value, String name, String literal)
>
> whereas the 3rd-party model's EEnum constructors' signature is
>
> constructor_name(int value, String name)
>
> Regards,
> Irfan Hamid.

<snip>
Re: Cannot find operation xyz() for the type (abc) [message #590897 is a reply to message #49962] Wed, 13 September 2006 17:42 Go to previous message
Eclipse UserFriend
Originally posted by: nospam.mymail.fr

Hi Christian,

I thought of the same thing, here's how the class defines the literal

public static final PORTDIRECTION IN_LITERAL = new PORTDIRECTION(IN, "in");

So I tried also the other value, which is defined as

public static final PORTDIRECTION OUT_LITERAL = new PORTDIRECTION(OUT,
"out");

But still the same error message:

(Unknown enumeration literal (OUT))

Regards,
Irfan.

PS: Could it have anything to do with the fact that the constructor used
does not accept a String literal as follows:

public static final TASKPROTOCOL PERIODIC_LITERAL = new
TASKPROTOCOL(PERIODIC, "PERIODIC", "PERIODIC");???

Christian W. Damus wrote:
> Hi, Irfan,
>
> As Ed indicated, since EEnums cannot define operations, you cannot define
> any that would be accessible to OCL. However, that seems beside the point,
> now.
>
> Is the name of the PORTDIRECTION enumeration literal "in" (lower case), by
> any chance? The names in OCL are case-sensitive, as they are in EMF. The
> error message that you got indicates that OCL found the enumeration type
> because it says the literal could not be found, rather than
> "Unknown type ([interface, PORTDIRECTION, IN])".
>
> HTH,
>
> Christian
>
>
> Irfan Hamid wrote:
>
>
>>Ed,
>>
>>Ok. Will try that. But in fact what I needed that for was to test the
>>value of an EEnum. I'm working with two meta-models, one is my own and
>>generated with EMF2.2. The other is a 3rd-party meta-model that I cannot
>>change, generated with (I suspect) an older version of EMF. My model is
>>flat, the 3rd-party model is organized into packages.
>>
>>For EEnum instances of my own model, I can test the values as
>>"protocol=TASKPROTOCOL::PERIODIC". This is not possible for EEnum
>>instances of the 3rd-party model, if I test as
>>"port.direction=interface::PORTDIRECTION::IN" it will give me an error
>>saying
>>
>>java.lang.IllegalArgumentException:
>>org.eclipse.emf.ocl.parser.SemanticException: ERROR in
>>(enumerationOrClassLiteralExpCS): (Unknown enumeration literal (IN))
>>
>>A tell-tale difference between the code generated from my model and that
>>of the 3rd-party model is that my model's EEnum constructors have the
>>signature
>>
>>constructor_name(int value, String name, String literal)
>>
>>whereas the 3rd-party model's EEnum constructors' signature is
>>
>>constructor_name(int value, String name)
>>
>>Regards,
>>Irfan Hamid.
>
>
> <snip>
Previous Topic:WrongPrimayKeyException and MissingColoumnExceptions while using elver with jpox
Next Topic:JET2 Documentation
Goto Forum:
  


Current Time: Thu Apr 18 09:20:58 GMT 2024

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

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

Back to the top