The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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 which fields occurr in all records (required), whether a field has been repeated in a record (repeatable), and the same information for subfields (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 and total. 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.