1 package Text::Tradition::Collation::RelationshipType;
7 Text::Tradition::Collation::RelationshipType - describes a syntactic,
8 semantic, etc. relationship that can be made between two readings
12 Text::Tradition is a library for representation and analysis of collated
13 texts, particularly medieval ones. A relationship connects two readings
14 within a collation, usually when they appear in the same place in different
21 Creates a new relationship type. Usually called via
22 $collation->register_relationship_type. Options include:
26 =item * name - (Required string) The name of this relationship type.
28 =item * bindlevel - (Required int) How tightly the relationship binds. A
29 lower number indicates a closer binding. If A and B are related at
30 bindlevel 0, and B and C at bindlevel 1, it implies that A and C have the
31 same relationship as B and C do.
33 =item * is_weak - (Default false) Whether this relationship should be
34 replaced silently by a stronger type if requested. This is used primarily
35 for the internal 'collated' relationship, only to be used by parsers.
37 =item * is_colocation - (Default true) Whether this relationship implies
38 that the readings in question have parallel locations.
40 =item * is_transitive - (Default $self->is_colocation) Whether this
41 relationship type is transitive - that is, if A is related to B and C this
42 way, is B necessarily related to C?
44 =item * is_generalizable - Whether this relationship can have a non-local
47 =item * record_sub - A subroutine to canonify the reading text before
48 determining whether individual readings match. Defaults to no canonization.
64 =head2 is_generalizable
68 See the option descriptions above.
90 has 'is_colocation' => (
96 has 'is_transitive' => (
102 has 'is_generalizable' => (
106 default => sub { $_[0]->is_colocation }
109 has 'record_sub' => (
112 default => sub { sub { $_[0]->text } }
115 # TODO Define extra validation conditions here
118 __PACKAGE__->meta->make_immutable;