NAME
PICA::Schema::Builder - Create Avram Schema from examples
SYNOPSIS
my $builder = PICA::Schema::Builder->new( title => 'My Schema' );
while (my $record = get_some_pica_record()) {
$builder->add($record);
}
$schema = $builder->schema;
DESCRIPTION
An Avram Schema can be created automatically from PICA::Data records. The result contains a list of field that have been used in any of the inspected records. The schema can tell:
the number of inspected
recordswhich
fieldsand theirsubfieldshave been found in recordsthe
totalnumber each field has been found and the number ofrecordswith each field.which of the fields occurr in all records (
required)whether a field has been repeated in a record (
repeatable)
And information about requiredness and repeatability for subfields. Subfield order is not taken into account.
This class is a subclass of PICA::Schema.
CONSTRUCTOR
The builder can be initialized with information of an existing builder or schema, in particular fields, total, and records. Option ignore_unknown will ignore fields not already specified in fields.
METHODS
add( $record )
Analyse an additional PICA record.
schema
Return a PICA::Schema that all analyzed records conform to. This methods creates a deep copy and removes all fields with total zero.
SEE ALSO
Catmandu::Breaker can analyze PICA data and create additional statistics.