Package gavo :: Package base :: Module metavalidation
[frames] | no frames]

Module metavalidation

source code

Meta information validation.

The idea is that you define certain assertions about the meta information of a given object type. Defined assertions are

Validators are usually built using model descriptions. These are enumerations of meta keys, separated by commata, with an optional code in parenteses. Whitespace is ignored. Codes allowed in parens are:

An example for a valid model description: "publisher.name,creator.email(), identifier (!), dateUpdated(1)"

These model descriptions can come in metaModel attributes of structures. If they are, you can use the validateStructure function below to validate an entire structure tree.

Classes
  MetaValidationError
  MetaAssertion
An assertion about the meta content of an object.
  MetaExists
An assertion that a meta item is present for key in whatever form.
  MetaIsAtomic
An assertion that a meta item is present and contains a single value only.
  MetaAtomicExistsOnSelf
An assertion that a meta item is present and unique for key on metaCarrier itself.
  MetaValidator
A metadata model that can verify objects of compliance.
Functions
 
parseModel(modelDescr)
returns a MetaValidator for a model description.
source code
 
validateStructure(aStruct)
does a meta validation for a base.Structure.
source code
Variables
  __package__ = 'gavo.base'
Function Details

parseModel(modelDescr)

source code 

returns a MetaValidator for a model description.

model descriptions are covered in the module docstring.

validateStructure(aStruct)

source code 

does a meta validation for a base.Structure.

This works by traversing the children of the structure, looking for nodes with a metaModel attribute. For all these, a validation is carried out. The first node failing the validation determines the return value.

The function raises a MetaValidationError if aStruct is invalid.