Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Query in ETL -Accessing the Target Node Parent?(Query in ETL -Accessing the Target Node Parent?)
Query in ETL -Accessing the Target Node Parent? [message #1730799] Thu, 28 April 2016 14:24 Go to next message
Rajkumar K is currently offline Rajkumar KFriend
Messages: 26
Registered: May 2015
Junior Member
Hello,

I have a situation to write a ETL rule for the following model transformation.

Tree
-------- + Node(A)
---------------- + Node(B)
-------------------------------- + Node(C)

Graph
-------- + Node(A)
---------------- + Node(B)
-------------------------------- + Node(C)
---------------------------------------- ==> Node_C_Sibiling (Reference to Node_C_Sibiling)
---------------------------------+ Node_(C_Sibiling)

The use case is , I have write a rule for transformation source model to target model. For Node_C i have to do the following
1) Create a sibiling Node
2) Refer the Sibiling Node to Node_c

Problem area...

rule Tree2Node transform t : Tree!Node
to n : Graph!Node {
guard : t.name ==' Node_c'

n.name = t.name;

if (n.parent.isDefined()) { // returning false
// transformation for attribute copy
}
}

Please let me know how to do I access the target active node's parent Node?

Since n.parent.isDefined() is returning false. This means I can't access the active Target node's parent ? Or is there way to access the target's Node parent ?
Hence I can add the sibiling node.

Best Regards,

Rajkumar
Re: Query in ETL -Accessing the Target Node Parent? [message #1730822 is a reply to message #1730799] Thu, 28 April 2016 18:26 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

You're trying to access n.parent on a new Node n, before it has been set. Shouldn't you set it first, probably from the equivalent() of one of the tree nodes related to the current tree node?

[Updated on: Thu, 28 April 2016 18:27]

Report message to a moderator

Re: Query in ETL -Accessing the Target Node Parent? [message #1731794 is a reply to message #1730822] Tue, 10 May 2016 09:00 Go to previous messageGo to next message
Rajkumar K is currently offline Rajkumar KFriend
Messages: 26
Registered: May 2015
Junior Member
Thank you for the feedback....Sorry for delay in reply.

I tried this solutions and couldn't find any issues during the transformation.

However when I used equivalent() in source model and added the target Node

the added elements are not serialized in the file. But if I use the println() on the

added nodes and the size of containments are printing properly in the console.

Any idea why the added elements are not serialized in the file ?

Best Regards,

Rajkumar
Re: Query in ETL -Accessing the Target Node Parent? [message #1731921 is a reply to message #1731794] Wed, 11 May 2016 05:02 Go to previous messageGo to next message
Rajkumar K is currently offline Rajkumar KFriend
Messages: 26
Registered: May 2015
Junior Member
I have created separate rule one for copying the source and another for sibling and it works... Smile
Re: Query in ETL -Accessing the Target Node Parent? [message #1731932 is a reply to message #1731921] Wed, 11 May 2016 07:54 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Great!

Normally, if a certain model element is not serialized, that's because it's not contained by anything in the resource. To be serialized, there has to be a containment path from the root of the model to the model element. I suppose that might have been the issue.
Previous Topic:EVL: How to define and use a profile and stereotypes in a model validation
Next Topic:How to add a new UML Property as subset of an UML Class in EML
Goto Forum:
  


Current Time: Sat Apr 20 00:27:31 GMT 2024

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

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

Back to the top