1 package Text::Tradition::Collation::Relationship;
4 use Moose::Util::TypeConstraints;
6 enum 'RelationshipType' => qw( spelling orthographic grammatical meaning lexical
7 collated repetition transposition );
9 enum 'RelationshipScope' => qw( local document global );
11 no Moose::Util::TypeConstraints;
15 Text::Tradition::Collation::Relationship - represents a syntactic or semantic
16 relationship between two readings
20 Text::Tradition is a library for representation and analysis of collated
21 texts, particularly medieval ones. A relationship connects two readings
22 within a collation, usually when they appear in the same place in different
29 Creates a new relationship. Usually called via $collation->add_relationship.
34 =item * type - Can be one of spelling, orthographic, grammatical, meaning, lexical, collated, repetition, transposition. All but the last two are only valid relationships between readings that occur at the same point in the text.
36 =item * displayform - (Optional) The reading that should be displayed if the related nodes are treated as one.
38 =item * scope - (Optional) A meta-attribute. Can be one of 'local', 'document', or 'global'. Denotes whether the relationship between the two readings holds always, independent of context, either within this tradition or across all traditions.
40 =item * anotation - (Optional) A freeform note to attach to the relationship.
42 =item * non_correctable - (Optional) True if the reading would not have been corrected independently.
44 =item * non_independent - (Optional) True if the variant is unlikely to have occurred independently in unrelated witnesses.
58 =head2 non_correctable
60 =head2 non_independent
62 See the option descriptions above.
68 isa => 'RelationshipType',
84 has 'displayform' => (
87 predicate => 'has_displayform',
92 isa => 'RelationshipScope',
101 has 'non_correctable' => (
104 predicate => 'noncorr_set',
107 has 'non_independent' => (
110 predicate => 'nonind_set',
113 # A read-only meta-Boolean attribute.
117 Returns true if the relationship type is one that requires that its readings
118 occupy the same place in the collation.
124 return $self->type !~ /^(repetition|transposition)$/;
129 Returns true if the relationship scope is anything other than 'local'.
135 return $self->scope ne 'local';
139 __PACKAGE__->meta->make_immutable;