Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » adding new element F to Containmentreference(I am using EOL to change an emf model that an instance of emf metamodel)
adding new element F to Containmentreference [message #1755257] Wed, 01 March 2017 17:36 Go to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 182
Registered: October 2014
Senior Member
Hi ,
I am using the following code to add new element type task to D2 which is a processor . task is the Containmentreference between the processor and task that means parent of task is processor D2.
I got error says that Property 'eRef' not found in object processor [name=D2, multiplicity=1, speedfactor=1.0, scheduling=default, replication=1, quantum=0.0, ]
[ var vprocessor=Lqn!processor;
for (p in vprocessor){
p.name=getName(SrightId);//this operation returns name of processor D2
"D2 ".print()+p.name.println();
var target=Lqn!task;
var t:new Lqn!task;
t.name=getName(valueIdS);\\return task its name is F
for (g in target){
var parentSource=g.closure(x | x.eContainer()) ;
"parent of task ".print()+parentSource.first().eClass.name.println();

var eRef=t.closure(x | x.eContainmentFeature);
"Containmentreference".print()+eRef.println();

var type=parentSource.eClass.println();

p.eRef.name.add(t);

}
} ][/code]

Can you please help me .
Metamodel and instance of metamodel are attached

[Updated on: Wed, 01 March 2017 17:39]

Report message to a moderator

Re: adding new element F to Containmentreference [message #1755267 is a reply to message #1755257] Wed, 01 March 2017 20:48 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1613
Registered: July 2009
Location: York, UK
Senior Member

Hi Taghreed,

Class "processor" doesn't seem to have a property called "eRef" in your metamodel.

Cheers,
Dimitris
Re: adding new element F to Containmentreference [message #1755281 is a reply to message #1755267] Thu, 02 March 2017 02:08 Go to previous messageGo to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 182
Registered: October 2014
Senior Member
Hi Dimitris,
I am getting the property "task" containment Refererence which is in the metamodel in processor class and assigning it to the variable eRef.

var eRef=t.closure(x | x.eContainmentFeature);
Can you please advise me.

Thanks,
Taghreed
Re: adding new element F to Containmentreference [message #1755285 is a reply to message #1755281] Thu, 02 March 2017 07:12 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1613
Registered: July 2009
Location: York, UK
Senior Member

Hi Taghreed,

No class has a feature called "eContainmentFeature" in your metamodel. Why did you expect this to work?

Cheers,
Dimitris
Re: adding new element F to Containmentreference [message #1755358 is a reply to message #1755285] Thu, 02 March 2017 15:50 Go to previous messageGo to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 182
Registered: October 2014
Senior Member
Hi Dimitris,
I tried to test my metamodel with this code:
 var tasks = Lqn!task;
   for (p in tasks ){
     "parent".print()+ p.asSequence().closure(x | x.eContainer()).println();
       var eRef :Sequence =p.closure(x | x.eContainmentFeature);
       "eRef ".print()+ eRef.println;


Then i got this in the console:
parentSequence {processor [name=D1, multiplicity=1, speedfactor=1.0, scheduling=default, replication=1, quantum=0.0, ], lqnmodel [name=model To lqn, description=null, lqnSchemaVersion=1, lqnCoreSchemaVersion=1, xmldebug=false, ]}
eRef Sequence {EReference [name=task, ordered=true, unique=true, lowerBound=1, upperBound=-1, many=true, required=true, changeable=true, volatile=false, transient=false, defaultValueLiteral=null, defaultValue=null, unsettable=false, derived=false, containment=true, container=false, resolveProxies=true, ], EReference [name=eStructuralFeatures, ordered=true, unique=true, lowerBound=0, upperBound=-1, many=true, required=false, changeable=true, volatile=false, transient=false, defaultValueLiteral=null, defaultValue=null, unsettable=false, derived=false, containment=true, container=false, resolveProxies=false, ]}
parentSequence {processor [name=D2, multiplicity=1, speedfactor=1.0, scheduling=default, replication=1, quantum=0.0, ], lqnmodel [name=model To lqn, description=null, lqnSchemaVersion=1, lqnCoreSchemaVersion=1, xmldebug=false, ]}
eRef Sequence {EReference [name=task, ordered=true, unique=true, lowerBound=1, upperBound=-1, many=true, required=true, changeable=true, volatile=false, transient=false, defaultValueLiteral=null, defaultValue=null, unsettable=false, derived=false, containment=true, container=false, resolveProxies=true, ], EReference [name=eStructuralFeatures, ordered=true, unique=true, lowerBound=0, upperBound=-1, many=true, required=false, changeable=true, volatile=false, transient=false, defaultValueLiteral=null, defaultValue=null, unsettable=false, derived=false, containment=true, container=false, resolveProxies=false, ]}

for each processor (parent) there are tasks (children) and i tried to add new task to processor p=D2 by this code :
p.task.add(t); it did work but when i replaced task with a variable eRef it generated the error.

Cheers,
Taghreed

[Updated on: Thu, 02 March 2017 16:02]

Report message to a moderator

Re: adding new element F to Containmentreference [message #1755425 is a reply to message #1755358] Fri, 03 March 2017 09:04 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1613
Registered: July 2009
Location: York, UK
Senior Member

Hi Taghreed,

Could you please provide a minimal example [1] I can use to reproduce this?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: adding new element F to Containmentreference [message #1755481 is a reply to message #1755425] Fri, 03 March 2017 16:24 Go to previous messageGo to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 182
Registered: October 2014
Senior Member
Hi Dimitris,
I am using Eclipse version 1.3.201602270002.
Steps to produce the proplem:
-Run queryEtl(1) run configuration
-open oldexampleLqn.model by its default editor
-You will see that task F was added to the root (Lqnmodel) not to its parent which is Processor D2.

I know that i need to use p.task.add(t) to add F to its parent (processor D2) but i need to use a variable that holds task instead of using p.task.add(t) like this . I identified task as belows:
var eRef=g.closure(x | x.eContainmentFeature); then adding task(F) to D2 by using this code p.eRef.add(t);

I wish that i explained the problem more clearly now.
Cheers,
Taghreed


[Updated on: Fri, 03 March 2017 16:29]

Report message to a moderator

Re: adding new element F to Containmentreference [message #1755485 is a reply to message #1755481] Fri, 03 March 2017 17:02 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1613
Registered: July 2009
Location: York, UK
Senior Member

Hi Taghreed,

As discussed earlier in this thread p.eRef.add(t) fails because class Processor does not have an "eRef" attribute/reference. Changing this line to p.task.add(t) seems to be doing the trick.

Cheers,
Dimitris
Re: adding new element F to Containmentreference [message #1755489 is a reply to message #1755485] Fri, 03 March 2017 17:32 Go to previous messageGo to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 182
Registered: October 2014
Senior Member
but eRef is just a variable i mean eRef=task that is a reference in the Lqn metamodel :
class processor {
attr String name;
attr int multiplicity=1;
attr float speedfactor=1;
attr PSchedulerType scheduling;
attr int replication=1;
attr float quantum=0;

val task[+] #host task;

}
Did u mean that i canot use a variable that holds the name of the reference ??to do the trick u need to use it as it is?

Thanks,
Taghreed

[Updated on: Fri, 03 March 2017 17:36]

Report message to a moderator

Re: adding new element F to Containmentreference [message #1755491 is a reply to message #1755489] Fri, 03 March 2017 18:21 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1613
Registered: July 2009
Location: York, UK
Senior Member

Exactly; eRef is a variable but your code was using it as a property name.

Cheers,
Dimitris
Previous Topic:ETL Examples
Next Topic:Getting ConcurrentModificationException in ETL
Goto Forum:
  


Current Time: Mon Nov 19 05:54:05 GMT 2018

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

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

Back to the top