save Ternary data type to graphml too
[scpubgit/stemmatology.git] / base / lib / Text / Tradition / Witness.pm
index 4ab7d5b..69a5e66 100644 (file)
@@ -3,10 +3,9 @@ package Text::Tradition::Witness;
 use vars qw( %tags );
 use JSON;
 use Moose;
-use Moose::Util::TypeConstraints;
+use Text::Tradition::Datatypes;
 use Text::TEI::Markup qw( word_tag_wrap );
 use TryCatch;
-use XML::Easy::Syntax qw( $xml10_name_rx );
 
 =head1 NAME
 
@@ -137,6 +136,7 @@ my $ptwit = $trad->add_witness(
 is( ref( $ptwit ), 'Text::Tradition::Witness', 'Created a witness' );
 if( $ptwit ) {
     is( $ptwit->sigil, 'A', "Witness has correct sigil" );
+    $c->make_witness_path( $ptwit );
     is( $c->path_text( $ptwit->sigil ), $str, "Witness has correct text" );
 }
 
@@ -183,23 +183,11 @@ if( $xpwit ) {
 # Enable plugin(s) if available
 eval { with 'Text::Tradition::WitLanguage'; };
        
-subtype 'SourceType',
-       as 'Str',
-       where { $_ =~ /^(xmldesc|plaintext|json|collation)$/ },
-       message { 'Source type must be one of xmldesc, plaintext, json, collation' };
-       
-subtype 'Sigil',
-       as 'Str',
-       where { $_ =~ /\A$xml10_name_rx\z/ },
-       message { 'Sigil must be a valid XML attribute string' };
-
-no Moose::Util::TypeConstraints;
-
 has 'tradition' => (
-       'is' => 'ro',
-       'isa' => 'Text::Tradition',
-       'required' => 1,
-        weak_ref => 1
+       is => 'ro',
+       isa => 'Text::Tradition',
+       required => 1,
+       weak_ref => 1
        );
 
 # Sigil. Required identifier for a witness, but may be found inside
@@ -776,7 +764,7 @@ sub export_as_json {
                'name' => $self->identifier,
        };
        if( $self->is_layered ) {
-               my @lwlist = map { { 't' => $_ || '' } } @{$self->uncorrected};
+               my @lwlist = map { { 't' => $_ || '' } } @{$self->layertext};
                $obj->{'layertokens'} = \@lwlist;
        }
        return $obj;