The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

PICA::Schema - Specification of a PICA based format

DESCRIPTION

A PICA Schema defines a set of PICA+ fields and subfields to validate PICA::Data records. A schema is given as hash reference such as:

    {
      fields => {
        '021A' => { },      # field without additional information
        '003@' => {         # field with additional constraints
          unique => 1,
          label => 'Pica-Produktionsnummer',
          subfields => {
            0 => { unique => 1 }
          }
        }
      }
    }

METHODS

check( $record [, %options ] )

Check whether a given PICA::Data record confirms to the schema and return a list of detected violations. Possible options include:

ignore_unknown_fields

Don't report fields not included in the schema.

ignore_unknown_subfields

Don't report subfields not included in the schema.

Errors are given as list of hash reference with keys tag and occurrence set to tag and (optional) ocurrence of the violated field. If key unique is set, the field was repeated although not repeatable. Otherwise, if key subfields is set, the field was defined but contained invalid subfields.

Additional error field message contains a human-readable error message which can also be derived from the rest of the error object.

check_field( $field [, %options ] )

Check whether a PICA field confirms to the schema. Use same options as method check.

LIMITATIONS

The current version can only validate records with tags on level 0.

SEE ALSO

PICA::Path (support may be added in a future version)

MARC::Lint