X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition%2FParser%2FGraphML.pm;h=4e59b7ee40183b218634d5e009a0b43c8d82c788;hb=e290206835dd4bc540d751ea2d1849255dd192f2;hp=5c6244cc924cd5030ab439ca0ca0e0d945bd6b1f;hpb=35b673490219985a6effca9978d5d3353008bab5;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition/Parser/GraphML.pm b/lib/Text/Tradition/Parser/GraphML.pm index 5c6244c..4e59b7e 100644 --- a/lib/Text/Tradition/Parser/GraphML.pm +++ b/lib/Text/Tradition/Parser/GraphML.pm @@ -79,10 +79,10 @@ sub parse { my @nodes = $xpc->findnodes( '//g:node' ); foreach my $n ( @nodes ) { my $id = _lookup_node_data( $n, 'number' ); - my $label = _lookup_node_data( $n, 'token' ); + my $token = _lookup_node_data( $n, 'token' ); my $gnode = $collation->add_reading( $id ); $node_name{ $n->getAttribute('id') } = $id; - $gnode->set_attribute( 'label', $label ); + $gnode->text( $token ); # Now get the rest of the data, i.e. not the ID or label my $extra = {}; @@ -101,8 +101,13 @@ sub parse { # Label according to the witnesses present. my @wit_ids = $xpc->findnodes( './g:data/attribute::key', $e ); my @wit_names = map { $witnesses{ $_->getValue() } } @wit_ids; - my $label = $collation->path_label( @wit_names ); - $collation->add_path( $from, $to, $label ); + # One path per witness + foreach( @wit_names ) { + $collation->add_path( $from, $to, $_ ); + } + # Only a single path between two readings + # my $label = $collation->path_label( @wit_names ); + # $collation->add_path( $from, $to, $label ); } ## Reverse the node_name hash so that we have two-way lookup.