X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition%2FParser%2FSelf.pm;h=79621f1bb7d8dd7ec06488defc36d0942204b964;hb=0068967c00c4546e4cec6b81ced88419b0b24b68;hp=f409900ba0e37675200cc68b55e6a7b6ec0ec1f3;hpb=56cf65bd9ea030e1e7e0cc0bd77673e4f5f00bc8;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition/Parser/Self.pm b/lib/Text/Tradition/Parser/Self.pm index f409900..79621f1 100644 --- a/lib/Text/Tradition/Parser/Self.pm +++ b/lib/Text/Tradition/Parser/Self.pm @@ -136,7 +136,7 @@ sub parse { # Set up the graph-global attributes. They will appear in the # hash under their accessor names. my $use_version; - print STDERR "Setting graph globals\n"; + # print STDERR "Setting graph globals\n"; $tradition->name( $graph_data->{'name'} ); foreach my $gkey ( keys %{$graph_data->{'global'}} ) { my $val = $graph_data->{'global'}->{$gkey}; @@ -157,14 +157,17 @@ sub parse { my $extra_data = {}; # Keep track of data that needs to be processed # after the nodes & edges are created. - print STDERR "Adding graph nodes\n"; + # print STDERR "Adding graph nodes\n"; foreach my $n ( @{$graph_data->{'nodes'}} ) { + unless( $use_version ) { + # Backwards compat! + $n->{$START_KEY} = 1 if $n->{$IDKEY} eq '#START#'; + $n->{$END_KEY} = 1 if $n->{$IDKEY} eq '#END#'; + } + # If it is the start or end node, we already have one, so # grab the rank and go. - if( defined $n->{$START_KEY} ) { - $collation->start->rank( $n->{$RANK_KEY} ); - next; - } + next if( defined $n->{$START_KEY} ); if( defined $n->{$END_KEY} ) { $collation->end->rank( $n->{$RANK_KEY} ); next; @@ -201,7 +204,7 @@ sub parse { } # Now add the edges. - print STDERR "Adding graph edges\n"; + # print STDERR "Adding graph edges\n"; foreach my $e ( @{$graph_data->{'edges'}} ) { my $from = $e->{$SOURCE_KEY}; my $to = $e->{$TARGET_KEY}; @@ -244,7 +247,7 @@ sub parse { ## needs to be processed after all the nodes are created. ## TODO unneeded after conversion unless( $use_version ) { - print STDERR "Adding second-pass node data\n"; + # print STDERR "Adding second-pass node data\n"; foreach my $nkey ( keys %$extra_data ) { foreach my $edkey ( keys %{$extra_data->{$nkey}} ) { my $this_reading = $collation->reading( $nkey );