PICA::Schema - Validate PICA based formats with Avram Schemas
$schema = PICA::Schema->new({ ... }); @errors = $schema->check($record);
A PICA Schema defines a set of PICA+ fields and subfields to validate PICA::Data records. Schemas are given as hash reference in Avram Schema language, for instance:
{ fields => { '021A' => { }, # field without additional information '003@' => { # field with additional constraints label => 'Pica-Produktionsnummer', repeatable => 0, required => 1, subfields => { '0' => { repeatable => 0, required => 1 } } } } }
See PICA::Schema::Builder to automatically construct schemas from PICA sample records.
Schema information can be included in PICA XML with PICA::Writer::XML.
Check whether a given PICA::Data record confirms to the schema and return a list of PICA::Schema::Error. Possible options include:
Don't report fields not included in the schema.
Don't report subfields not included in the schema.
Don't report fields and subfields not included in the schema.
Don't report deprecated fields.
Don't report deprecated subfields.
Don't report deprecated codes.
Don't report deprecated fields, subfields, and codes.
Don't report errors resulting on wrong subfield order.
Don't check subfields at all.
Check whether a PICA field confirms to the schema. Use same options as method check. Returns a PICA::Schema::Error on schema violation.
check
Return an abbreviated data structure of the schema without inferable fields such as tag, occurrence and code.
tag
occurrence
code
Return the field identifier of a given PICA field. The identifier consists of field tag and optional occurrence if the tag starts with 0.
0
Check a subfield value against a subfield schedule. On malformed values returns a subfield error without message key.
message
The current version does not properly validate required field on level 1 and 2.
Field types have neither been implemented yet.
PICA::Path
MARC::Schema
MARC::Lint
To install PICA::Data, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PICA::Data
CPAN shell
perl -MCPAN -e shell install PICA::Data
For more information on module installation, please visit the detailed CPAN module installation guide.