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',
99 predicate => 'has_annotation',
102 has 'non_correctable' => (
107 has 'non_independent' => (
112 # A read-only meta-Boolean attribute.
116 Returns true if the relationship type is one that requires that its readings
117 occupy the same place in the collation.
123 return $self->type !~ /^(repetition|transposition)$/;
128 Returns true if the relationship scope is anything other than 'local'.
134 return $self->scope ne 'local';
138 __PACKAGE__->meta->make_immutable;