From: Tara L Andrews Date: Thu, 19 Apr 2012 12:14:42 +0000 (+0200) Subject: replace local with global rel if they are equivalent anyway X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=13e893dc2c0d9e482e4a8576d7c7d59e88866669;p=scpubgit%2Fstemmatology.git replace local with global rel if they are equivalent anyway --- diff --git a/lib/Text/Tradition/Collation/RelationshipStore.pm b/lib/Text/Tradition/Collation/RelationshipStore.pm index 1e3af41..3d98174 100644 --- a/lib/Text/Tradition/Collation/RelationshipStore.pm +++ b/lib/Text/Tradition/Collation/RelationshipStore.pm @@ -262,8 +262,14 @@ sub add_relationship { throw( "Found conflicting relationship at @$v" ); } elsif( $rel->type ne 'collated' ) { # Replace a collation relationship; leave any other sort in place. - warn "Not overriding local relationship set at @$v"; - next; + my $r1ann = $rel->has_annotation ? $rel->annotation : ''; + my $r2ann = $relationship->has_annotation ? $relationship->annotation : ''; + unless( $rel->type eq $relationship->type && $r1ann eq $r2ann ) { + warn sprintf( "Not overriding local relationship %s with global %s " + . "set at %s -> %s (%s -> %s)", $rel->type, $relationship->type, + @$v, $rel->reading_a, $rel->reading_b ); + next; + } } } map { $self->_drop_collations( $_ ) } @$v;