allow either file or string to be passed for parsing
[scpubgit/stemmatology.git] / lib / Text / Tradition / Parser / CollateX.pm
index 63a5635..2ab0546 100644 (file)
@@ -21,11 +21,11 @@ http://gregor.middell.net/collatex/
 
 =item B<parse>
 
-parse( $graph, $graphml_string );
+parse( $tradition, $init_options );
 
-Takes an initialized Text::Tradition::Graph object and a string
-containing the GraphML; creates the appropriate nodes and edges on the
-graph.
+Takes an initialized Text::Tradition::Graph object and its initialization
+options, including the data source; creates the appropriate nodes and edges 
+on the graph.
 
 =cut
 
@@ -34,8 +34,8 @@ my $CONTENTKEY = 'token';
 my $TRANSKEY = 'identical';
 
 sub parse {
-    my( $tradition, $graphml_str ) = @_;
-    my $graph_data = Text::Tradition::Parser::GraphML::parse( $graphml_str );
+    my( $tradition, $opts ) = @_;
+    my $graph_data = Text::Tradition::Parser::GraphML::parse( $opts );
     my $collation = $tradition->collation;
     my %witnesses; # Keep track of the witnesses we encounter as we
                    # run through the graph data.
@@ -119,15 +119,13 @@ sub parse {
             $collation->end( $gnode );
         }
     }
+    
+    # TODO Need to populate $wit->path / uncorrected_path
 
-    # Record for each witness its sequence of readings, and determine
-    # the common nodes.
-    my @common_nodes = $collation->walk_witness_paths( $end_node );
-
-    # Now we have added the witnesses and their paths, so have also
-    # implicitly marked the common nodes. Now we can calculate their
-    # explicit positions.
-    $collation->calculate_positions( @common_nodes );
+    # Now we have added the witnesses and their paths, so we can 
+    # calculate their explicit positions.
+    # TODO CollateX does this, and we should just have it exported there.
+    $collation->calculate_ranks();
 }
     
 =back