AccessFilters

An access predicate (AccessPredicate) as a filter of the query algebra, which every backend pushes down: the predicate read in negation normal form, each comparison on the field its attribute is stored under in the model queried, as fieldOf says.

  • A comparison holds of a present value, and so does its negation, guarded by IS_NOT_NULL of its field: an absent value, or a record holding none, grants neither way, on every backend alike (SQL's three-valued NOT and a document store's missing fields agree only so). The check of absence, IS_NULL, is the one comparison of no value; its negation is IS_NOT_NULL.

  • IS_NULL of a declared attribute holds only of a record whose stamp holds the attribute as an explicit null: EXISTS and IS_NULL of its field (#7370). A stamp holds every attribute its model declared then, one without a value as an explicit null, and no key for one declared since; such a record, which the type's access walk has not stamped again yet, grants neither IS_NULL nor its negation, so a rule that reads a new attribute shows less while the walk runs, never more. The built-in owner and space are not so: every stamp holds them, a store may leave a null one out, and a missing one is null, so their IS_NULL is the field's alone.

  • A comparison with a claim the caller does not hold (AccessPredicate.Unknown), or of an attribute the model does not store (fieldOf null, a dataset with no column for it), matches nothing, negated or not.

  • One value: EQUAL is EqualFilter, IN InFilter and STARTS_WITH StartsWithFilter. Several: CONTAINS is ContainsAllFilter of the one value, CONTAINS_ANY an OrFilter of those, and IS_EMPTY an IsEmptyFilter of a present field. An enum's value is compared as the name Jackson writes for it, and an integer as a long, as the records store them.

It agrees with AccessPredicate.allows, which the kernel evaluates, for a record that holds a key of every attribute compared, as a state always does. A comparison of an attribute the record holds no key of is one allows is never asked: it reads as AccessPredicate.Unknown, holding neither way. The query TCK's AccessFilterSpec holds every backend, the in-memory one among them, to both (its grants).

Functions

Link copied to clipboard
fun compile(predicate: AccessPredicate, fieldOf: (AccessAttribute<*, *>) -> QueryField<*>?): FilterExpression

predicate as a filter, each attribute compared on fieldOf of it, or matching nothing where that is null.

Link copied to clipboard

predicate as a filter whose comparisons comparisonOf builds, each matching nothing where it gives none: for a model that holds an attribute as a filter of its own rather than as a field, such as the owner and the space of a snapshot or a dataset row (me.ahoo.wow.api.query.OwnerIdFilter, me.ahoo.wow.api.query.SpaceIdFilter) under the default rule (me.ahoo.wow.api.access.ScopeAccess). comparisonOf builds a comparison as it is: a negated one matches nothing.