--- /dev/null
+#!/usr/bin/env perl
+
+use 5.010;
+use inc::Module::Install;
+author( 'Tara L Andrews <aurum@cpan.org>' );
+license( 'perl' );
+all_from( 'lib/Text/Tradition' );
+requires( 'perl' => '5.010' );
+requires( 'XML::LibXML' );
+requires( 'Graph::Easy' );
+requires( 'Text::CSV::Simple' );
+&WriteAll;
--- /dev/null
+#!/usr/bin/env perl
+
+package Text::Tradition;
+
+use Moose;
+
+has 'collation' => (
+ is => 'ro',
+ isa => 'Text::Tradition::Collation',
+ init_arg => undef,
+ );
+
+has 'witnesses' => (
+ traits => ['Array'],
+ is => 'rw',
+ isa => 'ArrayRef[Text::Tradition::Witness]',
+ handles => {
+ all_options => 'elements',
+ add_option => 'push',
+ map_options => 'map',
+ option_count => 'count',
+ sorted_options => 'sort',
+ },
+ );
+
+# The user will usually be instantiating a Tradition object, and
+# examining its collation. The information about the tradition can
+# come via several routes:
+# - graphML from CollateX or elsewhere, standalone
+# - TEI parallel segmentation
+# - Leuven-style spreadsheet of variants, converted to CSV, plus base text
+# - apparatus pulled from CTE, plus base text
+# From this we should be able to get basic witness information.
+#
+# Alternatively the user can just give us the uncollated texts. Then
+# instead of passing a collation, s/he is passing a set of witnesses
+# from which we will generate a collation. Those witnesses can be in
+# plaintext or in TEI with certain constraints adopted.
+
+# So the constructor for a tradition needs to take one of these infosets,
+# and construct the collation and the witness objects.
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
--- /dev/null
+#!/usr/bin/env perl
+
+package Text::Tradition::Collation;
+use Moose;
+
+has 'graph' => (
+ is => 'ro',
+ isa => 'Text::Tradition::Graph',
+ );
+
+# The graph is full of nodes, which have positions and equivalences.
+# These have to be stored externally to the graph itself.
+has 'positions' => (
+ is => 'ro';
+ isa => 'Text::Tradition::Graph::Position',
+ );
+
+has 'equivalences' => (
+ is => 'rw';
+ isa => 'Text::Tradition::Graph::Equivalence',
+ );
+
+# We need a way to access the parent object.
+has 'tradition' => (
+ is => 'ro',
+ isa => 'Text::Tradition',
+ );
+
+# The collation can be created two ways:
+# 1. Collate a set of witnesses (with CollateX I guess) and process
+# the results as in 2.
+# 2. Read a pre-prepared collation in one of a variety of formats,
+# and make the graph from that.
+
+# The graph itself will (for now) be immutable, and the positions
+# within the graph will also be immutable. We need to calculate those
+# positions upon graph construction. The equivalences between graph
+# nodes will be mutable, entirely determined by the user (or possibly
+# by some semantic pre-processing provided by the user.) So the
+# constructor should just make an empty equivalences object. The
+# constructor will also need to make the witness objects, if we didn't
+# come through option 1.
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
--- /dev/null
+#!/usr/bin/env perl
+
+package Text::Tradition::Witness;
+use Moose;
+
+has 'sigil' => (
+ is => 'rw',
+ isa => 'Str',
+ );
+
+has 'text' => (
+ is => 'rw',
+ isa => 'Array',
+ );
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
--- /dev/null
+#!/usr/bin/perl
+
+use lib 'lib';
+use strict;
+use warnings;
+use Text::Tradition::Graph;
+
+# First: read the base. Make a graph, but also note which
+# nodes represent line beginnings.
+
+open( GRAPH, $ARGV[0] ) or die "Could not read file $ARGV[0]";
+my @lines = <GRAPH>;
+close GRAPH;
+my $graphml_str = join( '', @lines );
+
+my $collation_graph = Text::Tradition::Graph->new(
+ 'GraphML' => $graphml_str,
+ );
+
+print $collation_graph->as_svg();
+print STDERR "DONE\n";
--- /dev/null
+#!/usr/bin/env perl
+
+use lib 'lib';
+use strict;
+use warnings;
+use Text::Tradition::Graph;
+
+my $collation_graph = Text::Tradition::Graph->new(
+ 'CSV' => $ARGV[0],
+ 'base' => $ARGV[1],
+ );
+
+print $collation_graph->as_svg();
+print STDERR "Done\n";