1 package Text::Tradition::Collation::Relationship;
4 use Moose::Util::TypeConstraints;
6 enum 'RelationshipType' => qw( spelling orthographic grammatical 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, lexical,
35 collated, repetition, transposition. All but the last two are only valid
36 relationships between readings that occur at the same point in the text.
37 The 'collated' relationship should only be used by parsers to align readings
38 in the graph when the input information would otherwise be lost, e.g. from
41 =item * displayform - (Optional) The reading that should be displayed if the
42 related nodes are treated as one.
44 =item * scope - (Optional) A meta-attribute. Can be one of 'local',
45 'document', or 'global'. Denotes whether the relationship between the two
46 readings holds always, independent of context, either within this tradition
47 or across all traditions.
49 =item * annotation - (Optional) A freeform note to attach to the relationship.
51 =item * non_correctable - (Optional) True if the reading would not have been
52 corrected independently.
54 =item * non_independent - (Optional) True if the variant is unlikely to have
55 occurred independently in unrelated witnesses.
69 =head2 non_correctable
71 =head2 non_independent
73 See the option descriptions above.
79 isa => 'RelationshipType',
95 has 'displayform' => (
98 predicate => 'has_displayform',
103 isa => 'RelationshipScope',
107 has 'annotation' => (
110 predicate => 'has_annotation',
113 has 'non_correctable' => (
118 has 'non_independent' => (
123 # A read-only meta-Boolean attribute.
127 Returns true if the relationship type is one that requires that its readings
128 occupy the same place in the collation.
134 return $self->type !~ /^(repetition|transposition)$/;
139 Returns true if the relationship scope is anything other than 'local'.
145 return $self->scope ne 'local';
149 __PACKAGE__->meta->make_immutable;