From: Tara L Andrews Date: Fri, 21 Mar 2014 21:35:31 +0000 (+0100) Subject: save Ternary data type to graphml too X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b71e7ea81f3976ad264c6e5e3a229c4b803e29fc;p=scpubgit%2Fstemmatology.git save Ternary data type to graphml too --- diff --git a/base/lib/Text/Tradition/Collation.pm b/base/lib/Text/Tradition/Collation.pm index bbfc94f..1573eb1 100644 --- a/base/lib/Text/Tradition/Collation.pm +++ b/base/lib/Text/Tradition/Collation.pm @@ -1269,7 +1269,8 @@ is( scalar $c->relationships, 0, "Collation has all relationships" ); # Add a few relationships $c->add_relationship( 'w123', 'w125', { 'type' => 'collated' } ); $c->add_relationship( 'w193', 'w196', { 'type' => 'collated' } ); -$c->add_relationship( 'w257', 'w262', { 'type' => 'transposition' } ); +$c->add_relationship( 'w257', 'w262', { 'type' => 'transposition', + 'is_significant' => 'yes' } ); # Now write it to GraphML and parse it again. @@ -1278,6 +1279,8 @@ my $st = Text::Tradition->new( 'input' => 'Self', 'string' => $graphml ); is( scalar $st->collation->readings, $READINGS, "Reparsed collation has all readings" ); is( scalar $st->collation->paths, $PATHS, "Reparsed collation has all paths" ); is( scalar $st->collation->relationships, 3, "Reparsed collation has new relationships" ); +my $sigrel = $st->collation->get_relationship( 'w257', 'w262' ); +is( $sigrel->is_significant, 'yes', "Ternary attribute value was restored" ); # Now add a stemma, write to GraphML, and look at the output. SKIP: { @@ -1337,6 +1340,7 @@ sub as_graphml { 'ReadingID' => 'string', 'RelationshipType' => 'string', 'RelationshipScope' => 'string', + 'Ternary' => 'string', ); # Add the data keys for the graph. Include an extra key 'version' for the diff --git a/base/t/text_tradition_collation.t b/base/t/text_tradition_collation.t index e8e4b8e..a70ff9e 100644 --- a/base/t/text_tradition_collation.t +++ b/base/t/text_tradition_collation.t @@ -212,7 +212,8 @@ is( scalar $c->relationships, 0, "Collation has all relationships" ); # Add a few relationships $c->add_relationship( 'w123', 'w125', { 'type' => 'collated' } ); $c->add_relationship( 'w193', 'w196', { 'type' => 'collated' } ); -$c->add_relationship( 'w257', 'w262', { 'type' => 'transposition' } ); +$c->add_relationship( 'w257', 'w262', { 'type' => 'transposition', + 'is_significant' => 'yes' } ); # Now write it to GraphML and parse it again. @@ -221,6 +222,8 @@ my $st = Text::Tradition->new( 'input' => 'Self', 'string' => $graphml ); is( scalar $st->collation->readings, $READINGS, "Reparsed collation has all readings" ); is( scalar $st->collation->paths, $PATHS, "Reparsed collation has all paths" ); is( scalar $st->collation->relationships, 3, "Reparsed collation has new relationships" ); +my $sigrel = $st->collation->get_relationship( 'w257', 'w262' ); +is( $sigrel->is_significant, 'yes', "Ternary attribute value was restored" ); # Now add a stemma, write to GraphML, and look at the output. SKIP: {