====== BigObject Schema ====== //from application [[..:core|core]]//\\ \\ JSON schema used for validation and filtering, see ''[[..:core#save |save]]''. See also functions for most common manipulations of restricted schemas, ''[[..:core:Schema#prescribe_property_types |prescribe_property_types]]'' ===== Methods ===== ==== no category ==== {{anchor: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); ? Example: :: Require F_VECTOR and F2_VECTOR to be stored with simple integer entries :: > $schema->prescribe_property_types(F_VECTOR => "Vector", F2_VECTOR => "Matrix"); ? Example: :: Require VERTICES to be stored as declared in the rules, that is, as a dense matrix :: > $schema->prescribe_property_types(VERTICES => "default"); ---- {{anchor:source:}} ? **''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 ''[[..:core:Schema#prescribe_property_types |prescribe_property_types]]'' are insufficient for a particular use case. Be sure to call ''[[..:core:Schema#validate_self |validate_self]]'' after making changes, to be sure that the schema is still valid. ? Returns: :''HASH'' ---- {{anchor:validate:}} ? **''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 ---- {{anchor:validate_self:}} ? **''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: :''[[..:core:Schema |Schema]]'' ----