- CALCULATION STORAGE METHODS
Text::Tradition::Analysis::Result - object to express an IDP calculation result for a particular graph problem.
Given a graph (expressing a stemma hypothesis) and a set of witness groupings (expressing variation in reading between witnesses related according to the stemma hypothesis), it is possible to calculate certain properties of how the readings might be related to each other. This calculation depends on a custom program run under the IDP system [TODO URL]. As the problem is NP-hard, the calculation can take a long time. The purpose of this object is to allow storage of calculated results in a database.
For each graph problem, the following features can be calculated:
Whether the reading groups form a genealogical pattern on the stemma.
The groupings, including lost/hypothetical witnesses if necessary, that minimize the amount of non-genealogical variation on the stemma.
The classes, which for each witness express whether (in a minimally non-genealogical case) the witness is a source of its reading, follows a parent witness, or reverts to an ancestral reading that is not the parent's.
Creates a new graph problem. Requires two properties:
setlist - An array of arrays expressing the witness sets. The inner arrays will be converted to Set::Scalar objects, and must have distinct members.
graph - A dot description of a graph (e.g. the output of a call to Text::Tradition::Stemma::editable) against which the sets will be analyzed.
All other properties should be calculated by IDP rather than set manually. These include:
is_genealogical - Boolean, indicating whether the witness sets form genealogical groupings on the graph.
status - String to indicate whether a solution has been calculated for this analysis problem. Recognized values are "OK" (calculated) and "running" (being calculated now). All other values, or no value, imply that the calculation has yet to take place.
groupings - These are extended (if necessary) versions of the witness sets, which include the hypothetical witnesses necessary to minimize coincidence of variation.
classes - These are key/value pairs, keyed by witness, indicating for each witness whether it is the source of a reading variant, whether it represents a reversion to an ancestor (but not parent) reading, or whether its reading follows that of a parent on the graph.
If a class has been calculated for the given witness, has_class returns true and class returns the calculated answer.
Returns a unique key that can be used to look up this graph/set combination in a database. Currently an MD5 hash of the request_string.
A request string is the graph followed by the groups, which should form a unique key for the result.
A useful utility function to sort Set::Scalar objects first in descending order by size, then in ascending alphabetical order by first element (i.e. by stringification.)
Return all 'source' class witnesses in these sets for this graph.
Return the minimum grouping (including necessary hypothetical witnesses) for the witness set specified. Will return undef if $set does not match one of the defined witness sets in $self->sets.
Record that the sets are genealogical for this graph.
Record that the witness in question is of the given class.
Record that the group in question (either an arrayref or a Set::Scalar) forms a minimum grouping on the graph. Will throw an error unless the group is a (non-proper) superset of an existing witness set.