documentation:release:4.5:core:schema

Available versions of this document: latest release, release 4.13, release 4.12, release 4.11, release 4.10, release 4.9, release 4.8, release 4.7, release 4.6, release 4.5, release 4.4, release 4.3, release 4.2, release 4.1, release 4.0, release 3.6, release 3.5, nightly master

Reference documentation for older polymake versions: release 3.4, release 3.3, release 3.2

BigObject Schema

from application core

JSON schema used for validation and filtering, see save. See also functions for most common manipulations of restricted schemas, prescribe_property_types

prescribe_property_types(Any properties)

Change the stored data type for properties in a restrictive schema Selected properties will be coerced to a different type when the object is stored in a data file or in PolyDB using this schema. Note: This function does not try to verify that the properties can be serialized as the given type or will be successfully deserialized when reading the object from a file or retrieving it from a database. It's solely in the users responsibility to choose a compatible and convertible data type.

Parameters:

Any properties: list of pairs PROPERTY_NAME ⇒ type A property in a subobject is written in dotted path notation: “NAME1.NAME2.NAME3…” Types can be specified by name in a string or as a typeof expression or as a type of an exsiting data object. Specifying undef or “default” will enforce storing the properties in their original form, as declared in the rulebase. This operation might be useful e.g. to update the schema after a data mode change.

Example:

Require FACETS to be stored as a sparse matrix

 > $schema->prescribe_property_types(FACETS => typeof SparseMatrix<Rational>);
Example:

Require F_VECTOR and F2_VECTOR to be stored with simple integer entries

 > $schema->prescribe_property_types(F_VECTOR => "Vector<Int>", F2_VECTOR => "Matrix<Int>");
Example:

Require VERTICES to be stored as declared in the rules, that is, as a dense matrix

 > $schema->prescribe_property_types(VERTICES => "default");


source()

Get access to the schema source data, as it comes from the JSON decoder. The schema can be changed manually if the standard manipulations offered by prescribe_property_types are insufficient for a particular use case. Be sure to call validate_self after making changes, to be sure that the schema is still valid.

Returns:
HASH

validate(Any primitive)

Validate a primitive perl value suitable as JSON encoder input (like the outcome of Core::Serialize::serialize). Throw an exception in case of any errors.

Parameters:

Any primitive: perl value, that is, a plain string, number, anonymous list, or anonymous hash


validate_self()

Validate the given schema against the general meta-schema for schemas. Throw an exception in case of any errors. Validation is in particular useful after manual editing the schema.

Returns:

  • documentation/release/4.5/core/schema.txt
  • Last modified: 2021/09/24 09:02
  • by 127.0.0.1