[ETL] How to deal with removing circular references [message #572441] |
Wed, 05 August 2009 16:10 |
Darren Messages: 40 Registered: September 2009 |
Member |
|
|
Hello all,
Is anyone able to provide some guidence on this?
I have a class which contains(0..*) subclasses which then contains (0..*)
instances of itself i.e.
class c1 { val c2[*]#parent contains;}
class c2 { val c2[*] contains; ref c1#contains parent}
I need to transform this to a new model where c2 can not contain
instances. i.e. all instances in c2.contains need to be stored under
c1.contains.
The actual model is more detailed than this but this is the bit I'm stuck
on. I tried:
@lazy
rule NumberedParagraph
transform p1 : DocumentModel!ParagraphType
to p2:DocumentStructure!NumberedParagraph, t2 : DocumentStructure!Text{
guard : p1.numbering.isDefined() and p1.numbering <> ''
p2.numbering := p1.numbering;
t2.text := p1.text;
p2.text.add(t2);
for (z in p1.group){
p2.parent.children.add(z.getValue().equivalent());
}
}
But p2.parent does not exist yet. Anyone have any pointers to what I
should try next. Many thanks.
Darren
|
|
|
Powered by
FUDForum. Page generated in 0.02923 seconds