=end testing
=cut
-
+use Data::Dump;
sub parse {
my( $tradition, $opts ) = @_;
# Collation data is in the first graph; relationship-specific stuff
# is in the second.
my( $graph_data, $rel_data ) = graphml_parse( $opts );
-
+
my $collation = $tradition->collation;
my %witnesses;
# print STDERR "Setting graph globals\n";
$tradition->name( $graph_data->{'name'} );
+
my $use_version;
my $tmeta = $tradition->meta;
my $cmeta = $collation->meta;
foreach my $n ( @{$graph_data->{'nodes'}} ) {
# If it is the start or end node, we already have one, so
# grab the rank and go.
- next if( defined $n->{'is_start'} );
+ if( defined $n->{'is_start'} ) {
+ warn Data::Dump::dump($n);
+ warn $collation->start->id;
+ $collation->start->rank($n->{'rank'});
+ next;
+ }
if( defined $n->{'is_end'} ) {
+ warn Data::Dump::dump($n);
$collation->end->rank( $n->{'rank'} );
next;
}
# Now add the edges.
# print STDERR "Adding collation path edges\n";
foreach my $e ( @{$graph_data->{'edges'}} ) {
- my $from = $collation->reading( $e->{'source'}->{'id'} );
- my $to = $collation->reading( $e->{'target'}->{'id'} );
+ # warn Data::Dump::dump([$collation->reading_keys]);
+ warn $e->{source}{id};
+ # warn $e->{target}{id};
+ my($from, $to);
+ if($e->{source}{is_start}) {
+ $from = $collation->start;
+ } elsif($e->{source}{is_end}) {
+ $from = $collation->end;
+ } else {
+ $from = $collation->reading( $e->{'source'}->{'id'} );
+ }
+ if($e->{target}{is_end}) {
+ $to = $collation->end;
+ } elsif($e->{target}{is_start}) {
+ $to = $collation->start;
+ } else {
+ $to = $collation->reading( $e->{'target'}->{'id'} );
+ }
warn "No witness label on path edge!" unless $e->{'witness'};
my $label = $e->{'witness'} . ( $e->{'extra'} ? $collation->ac_label : '' );