bsfs.query.validator module#

class bsfs.query.validator.Filter(schema: Schema)#

Bases: object

Validate a bsfs.query.ast.filter query’s structure and schema compliance.

  • Conditions (Bounded, Value) can only be applied on literals

  • Branches, Id, and Has can only be applied on nodes

  • Predicates’ domain and range must match

  • Predicate paths must follow the schema

  • Referenced types are present in the schema

schema: Schema#
validate(root_type: Node, query: FilterExpression) bool#

Validate a filter query, assuming the subject having root_type.

Raises a bsfs.utils.errors.ConsistencyError if the query violates the schema. Raises a bsfs.utils.errors.BackendError if the query structure is invalid.