10 my($name, $id, $parent, $note) = @_;
12 my $this = bless { name => $name,
16 note => $note }, $class;
17 push @{ $parent->{children} }, $this
28 foreach my $child (@{ $this->{children} }) {
29 $child->walk($coderef)
38 my $note = $this->{note};
39 print " <termNote>$note</termNote>\n" if defined $note;
40 my $parent = $this->{parent};
41 if (defined $parent) {
42 $parent->write_relation('BT');
44 foreach my $child (@{ $this->{children} }) {
45 $child->write_relation('NT');
54 print " <relation>\n";
55 print " <relationType>$type</relationType>\n";
57 print " </relation>\n";
64 print ' ' x $level, "<termId>", $this->{id}, "</termId>\n";
65 print ' ' x $level, "<termName>", $this->{name}, "</termName>\n";
66 print ' ' x $level, "<termType>PT</termType>\n";
79 my $level = length($1);
86 $parent = $stack[$level-1] if $level > 0;
87 $stack[$level] = new Node($_, $id++, $parent, $note);
90 $stack[0]->walk(\&Node::write_zthes);