From: Tara L Andrews Date: Wed, 28 Dec 2011 02:15:03 +0000 (+0100) Subject: pull the rank out of the start and end nodes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0174d6a95b61554447aae5f781131fbb6f4ab171;p=scpubgit%2Fstemmatology.git pull the rank out of the start and end nodes --- diff --git a/lib/Text/Tradition/Parser/Self.pm b/lib/Text/Tradition/Parser/Self.pm index a1725d6..f409900 100644 --- a/lib/Text/Tradition/Parser/Self.pm +++ b/lib/Text/Tradition/Parser/Self.pm @@ -159,8 +159,16 @@ sub parse { # after the nodes & edges are created. print STDERR "Adding graph nodes\n"; foreach my $n ( @{$graph_data->{'nodes'}} ) { - # If it is the start or end node, we already have one, so skip it. - next if defined $n->{$START_KEY} || defined $n->{$END_KEY}; + # 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; + } + if( defined $n->{$END_KEY} ) { + $collation->end->rank( $n->{$RANK_KEY} ); + next; + } # First extract the data that we can use without reference to # anything else. @@ -225,7 +233,9 @@ sub parse { warn "No relationship type for relationship edge!" unless $opts->{'type'}; my( $ok, @result ) = $collation->add_relationship( $from->{$IDKEY}, $to->{$IDKEY}, $opts ); unless( $ok ) { - warn "Did not add relationship: @result"; + my $relinfo = $opts->{'type'} . ' ' + . join( ' -> ', $from->{$IDKEY}, $to->{$IDKEY} ); + warn "Did not add relationship $relinfo: @result"; } } }