aleph.schema

Schema

class aleph.schema.Schema

Imports

  • object

Summary

Defines the abstract data model.

Schema items define the entities and links available in the model.

__init__(self, schemata, section, name, data)
__repr__(self)
extends(self)

Return the inherited schemata.

get(self, name)
properties(self)

Return properties, those defined locally and in ancestors.

schemata(self)

Return the full inheritance chain.

to_dict(self)
validate(self, data)

Validate a dataset against the given schema.

This will also drop keys which are not present as properties.

SchemaProperty

class aleph.schema.SchemaProperty

Imports

  • object
__init__(self, schema, name, data)
__repr__(self)
to_dict(self)
validate(self, data)

Validate that the data should be stored.

Since the types system doesn’t really have validation, this currently tries to normalize the value to see if it passes strict parsing.

SchemaSet

class aleph.schema.SchemaSet

Imports

  • object

Summary

A collection of schemata.

__init__(self, data)
__iter__(self)
__repr__(self)
get(self, name)
merge_entity_schema(self, left, right)

Select the most narrow of two schemata.

When indexing data from a dataset, an entity may be declared as a LegalEntity in one query, and as a Person in another. This function will select the most specific of two schemata offered. In the example, that would be Person.

to_dict(self)

SchemaValidationException

class aleph.schema.SchemaValidationException

Imports

  • exceptions.Exception

Summary

Schema validation errors will be caught by the API.

__init__(self, errors)