[Xtext] Problem : Cannot find compatible feature foo in sealed EClass [message #43269] |
Thu, 07 May 2009 12:46 |
Eclipse User |
|
|
|
Originally posted by: sderrienREMOVE.irisa.fr
Hello,
I want to define a DSL for an existing ecore meta model.
In this model I have an AbstractClass which has a feature named foo, and
a ConcreteClass that inherits from this AbstractClass.
I want to write a Rule to create an initialized instance of
ConcreteClass in which I initialize the feature foo (inherited from
AbstractClass).
I use the following Xtext Rule for this
MyRule1 returns ConcreteClass:
foo+=AnotherRule
However, I get the following error :
Cannot find compatible feature foo in sealed EClass ConcreteClass from
imported package http://mypackageURI.
Is there a way to specify that the feature belongs to the ParentClass
(something like super.foo+=AnotherRule) ? If not is there any alternive
solution ?
Steven Derrien
|
|
|
|
Re: [Xtext] Problem : Cannot find compatible feature foo in sealed EClass [message #43419 is a reply to message #43326] |
Thu, 07 May 2009 19:41 |
Eclipse User |
|
|
|
Originally posted by: sderrienREMOVE.irisa.fr
Hello Heiko,
Thank you for your help.
Actually my example was not correct, since my DSL involves
cross-references. Here is the actual code snippet :
import "http://www.irisa.fr/cairn/datapath/fsm" as fsm
import "http://www.irisa.fr/cairn/datapath/port" as ports
....
FSMRule returns fsm::FSM :
ports+=InputPortRule terms+=PredicateTermRule;
InputPortRule returns ports::InControlPort:
name=ID;
PredicateTermRule returns fsm::PredicateTerm :
(negated?=('!'))? flag=[ports::InControlPort];
^^^^
It is the flag feature that causes the error message :
"Cannot find compatible feature flag in sealed EClass PredicateTerm from
imported package http://www.irisa.fr/cairn/datapath/fsm."
In the ecore file defining the fsm package, the EClass *PredicateTerm*
has a EReference feature named *flag* of type *InControlPort*, with
upperBound set to 1, and containment set to false.
Unless I am missing something obvious, everything seems consistent
to me (I double-checked before writing this mail).
Do you have any hints ?
Thanks in advance,
Steven
Heiko Behrens a écrit :
> Hey Steven,
>
> the problem here is that Xtext tries to find a proper feature that
> corresponds to "foo+=AnotherRule" in your meta model. Each assignment
> has to match with respect to its name, cardinality and type.
>
> Just looking at your snippet I would guess that AnotherRules does not
> return the proper type for the given feature foo defined in your
> existing meta model.
>
> This should work:
>
> MyRule returns ConcreteClass:
> foo=AnotherRule;
>
> AnotherRule returns TypeOfFeatureFooInConcreteClass:
> some?="rule that matches return type";
>
> Also, please be aware that "+=" and "=" expect different configurations
> of your meta model. The former expects a multi value containment feature
> where as the latter expect a single value containment.
>
> Hope that helps,
> Heiko
|
|
|
Re: [Xtext] Problem : Cannot find compatible feature foo in sealed EClass [message #43512 is a reply to message #43419] |
Fri, 08 May 2009 06:37 |
Sven Efftinge Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
You use namespace URIs this implies that you have installed both
EPackages into the workbench. Did you?
We also need to have a look at the EPackages in order track the problem
down.
Sven
Steven Derrien schrieb:
> Hello Heiko,
>
> Thank you for your help.
>
> Actually my example was not correct, since my DSL involves
> cross-references. Here is the actual code snippet :
>
> import "http://www.irisa.fr/cairn/datapath/fsm" as fsm
> import "http://www.irisa.fr/cairn/datapath/port" as ports
>
> ...
>
> FSMRule returns fsm::FSM :
> ports+=InputPortRule terms+=PredicateTermRule;
>
>
> InputPortRule returns ports::InControlPort:
> name=ID;
>
> PredicateTermRule returns fsm::PredicateTerm :
> (negated?=('!'))? flag=[ports::InControlPort];
> ^^^^
>
> It is the flag feature that causes the error message :
>
> "Cannot find compatible feature flag in sealed EClass PredicateTerm from
> imported package http://www.irisa.fr/cairn/datapath/fsm."
>
> In the ecore file defining the fsm package, the EClass *PredicateTerm*
> has a EReference feature named *flag* of type *InControlPort*, with
> upperBound set to 1, and containment set to false.
>
> Unless I am missing something obvious, everything seems consistent
> to me (I double-checked before writing this mail).
>
> Do you have any hints ?
>
> Thanks in advance,
>
> Steven
>
>
> Heiko Behrens a écrit :
>> Hey Steven,
>>
>> the problem here is that Xtext tries to find a proper feature that
>> corresponds to "foo+=AnotherRule" in your meta model. Each assignment
>> has to match with respect to its name, cardinality and type.
>>
>> Just looking at your snippet I would guess that AnotherRules does not
>> return the proper type for the given feature foo defined in your
>> existing meta model.
>>
>> This should work:
>>
>> MyRule returns ConcreteClass:
>> foo=AnotherRule;
>>
>> AnotherRule returns TypeOfFeatureFooInConcreteClass:
>> some?="rule that matches return type";
>>
>> Also, please be aware that "+=" and "=" expect different
>> configurations of your meta model. The former expects a multi value
>> containment feature where as the latter expect a single value
>> containment.
>>
>> Hope that helps,
>> Heiko
|
|
|
Re: [Xtext] Problem : Cannot find compatible feature foo in sealed EClass [message #43662 is a reply to message #43512] |
Fri, 08 May 2009 09:54 |
Eclipse User |
|
|
|
Originally posted by: sderrienREMOVE.irisa.fr
Hi Sven,
Sven Efftinge a écrit :
> You use namespace URIs this implies that you have installed both
> EPackages into the workbench. Did you?
Yes, I can see them in the EMF package registry view. Anyhow, if
packages are not registered, the Xtext editor shows an error directly on
the corresponding *import* line.
> We also need to have a look at the EPackages in order track the problem
> down.
I'll see If I can send them to you by mail.
Thanks for the support.
Steven
>
> Sven
>
>
> Steven Derrien schrieb:
>> Hello Heiko,
>>
>> Thank you for your help.
>>
>> Actually my example was not correct, since my DSL involves
>> cross-references. Here is the actual code snippet :
>>
>> import "http://www.irisa.fr/cairn/datapath/fsm" as fsm
>> import "http://www.irisa.fr/cairn/datapath/port" as ports
>>
>> ...
>>
>> FSMRule returns fsm::FSM :
>> ports+=InputPortRule terms+=PredicateTermRule;
>>
>>
>> InputPortRule returns ports::InControlPort:
>> name=ID;
>>
>> PredicateTermRule returns fsm::PredicateTerm :
>> (negated?=('!'))? flag=[ports::InControlPort];
>> ^^^^
>>
>> It is the flag feature that causes the error message :
>>
>> "Cannot find compatible feature flag in sealed EClass PredicateTerm
>> from imported package http://www.irisa.fr/cairn/datapath/fsm."
>>
>> In the ecore file defining the fsm package, the EClass *PredicateTerm*
>> has a EReference feature named *flag* of type *InControlPort*, with
>> upperBound set to 1, and containment set to false.
>>
>> Unless I am missing something obvious, everything seems consistent
>> to me (I double-checked before writing this mail).
>>
>> Do you have any hints ?
>>
>> Thanks in advance,
>>
>> Steven
>>
>>
>> Heiko Behrens a écrit :
>>> Hey Steven,
>>>
>>> the problem here is that Xtext tries to find a proper feature that
>>> corresponds to "foo+=AnotherRule" in your meta model. Each assignment
>>> has to match with respect to its name, cardinality and type.
>>>
>>> Just looking at your snippet I would guess that AnotherRules does not
>>> return the proper type for the given feature foo defined in your
>>> existing meta model.
>>>
>>> This should work:
>>>
>>> MyRule returns ConcreteClass:
>>> foo=AnotherRule;
>>>
>>> AnotherRule returns TypeOfFeatureFooInConcreteClass:
>>> some?="rule that matches return type";
>>>
>>> Also, please be aware that "+=" and "=" expect different
>>> configurations of your meta model. The former expects a multi value
>>> containment feature where as the latter expect a single value
>>> containment.
>>>
>>> Hope that helps,
>>> Heiko
|
|
|
Re: [Xtext] Problem : Cannot find compatible feature foo in sealed EClass [message #656376 is a reply to message #43662] |
Fri, 25 February 2011 11:19 |
|
Hi gays,
I just jumped into the same issue and can't find any solution.
The problem is that I'm writing a FSM (FinitStateMachine) like DSL.
In the FSM, there is two type of nodes: controlNodes and simpleNodes.
I have an abstract node in my ecore which is an abstract super class for both nodes.
Both nodes have an id, so the id belongs to the AbstractNode and concrete node will inherit it.
The problem is, when I write some thing like :
ControlNode returns ControlNode:
{ControlNode}
( 'ControlNode' id=EString
...
I got the runtime error :
java.lang.IllegalArgumentException: ControlNode.id does not exist
So, How can I assign a value to the id when creating an instance for my concrete steps.
Thanks
[Updated on: Fri, 25 February 2011 11:19] Report message to a moderator
|
|
|
|
|
|
Re: [Xtext] Problem : Cannot find compatible feature foo in sealed EClass [message #656759 is a reply to message #656754] |
Mon, 28 February 2011 13:11 |
|
Jan Koehnlein wrote on Mon, 28 February 2011 07:42 | The assignment should work for all (local and inherited) features.
How does your EString rule look like? Does it return a value that is
compatible to the type of the AbstractNode.id attribute? Do you define
|
My EString rule works for attributes owned by subclasses and the compatibility is fine. Here is its code:
EString returns ecore::EString:
STRING | ID;
Quote: | the Ecore model yourself? Is it error free and registered correctly in
the plugin.xml?
|
Yes, I have an already defined Ecore and my xText editor is about to create models conform to my Ecore metamodel.
It's error free and registered correctly (since it works without the inheritance staff).
Amine
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07187 seconds