remove some debugging statements
[scpubgit/stemmatology.git] / lib / Text / Tradition / Parser / CollateX.pm
index 68948d5..628e672 100644 (file)
@@ -126,18 +126,24 @@ sub parse {
             # Create the witness objects if they does not yet exist.
             foreach my $wit ( split( /, /, $e->{$WITKEY} ) ) {
                                unless( $tradition->witness( $wit ) ) {
-                                       $tradition->add_witness( 'sigil' => $wit );
+                                       $tradition->add_witness( 
+                                               'sigil' => $wit, 'sourcetype' => 'collation' );
                                }
                                $collation->add_path( $from->{$IDKEY}, $to->{$IDKEY}, $wit );
                        }
         } else { # type 'relationship'
-               $collation->add_relationship( $from->{$IDKEY}, $to->{$IDKEY},
-                       { 'type' => 'transposition' } );
+               if( $collation->linear ) {
+                               $collation->add_relationship( $from->{$IDKEY}, $to->{$IDKEY},
+                                       { 'type' => 'transposition' } );
+                       } else {
+                               $collation->merge_readings( $from->{$IDKEY}, $to->{$IDKEY} );
+                       }
         }
     }
 
     # Rank the readings.
-    $collation->calculate_common_readings(); # will implicitly rank
+    $collation->calculate_common_readings()
+       if $collation->linear; # will implicitly rank
 
     # Save the text for each witness so that we can ensure consistency
     # later on