Transform signature table.
Resource retrieval template.
Property value set template.
Property value template.
Value retrieval template.
Collection retrieval template.
Localised text map template.
Union-typed property template.
Union branch key.
Collection property projection.
Collection retrieval constraints.
Named computed expression.
Computed expression.
Transform pipe.
Property path.
Constraint option set.
Constraint option.
Sort order.
Parsed Selection or Projection key.
Constraint operator symbols.
Value transforms for computed expressions.
Static typing profile of a Transform.
Extracts the numeric-literal keys of a union frame, in both string ("0") and numeric (0) form.
Projects a template-shaped object through Instance.
Projects a Instance property key to its output name.
A REST/JSON data model and client-driven template language for retrieval, filtering, and aggregation
Checks if a value is a Template.
Checks if a value is a Placeholders set.
Checks if a value is a Placeholder.
Checks if a value is a Model single-value template.
Checks if a value is a Query.
Checks if a value is a Locales template.
Checks if a value is a Union.
Checks if a value is a Union branch key.
Checks if a value is a Projection.
Checks if a value is a Selection.
Checks if a value is a Binding.
Checks if a value is an Expression.
Checks if a value is an Options set.
Checks if a value is an Option.
Checks if a value is an Order.
Checks if a value is a Probe.
Checks if a value is a valid Selection entry key.
Checks if a value is an Operator.
Checks if a value is a Transform.
Checks whether a value is an aggregate Transform.
Checks if a value is vacuous per the template elision rule.
Resolves an Order to its sort precedence.
Resolves an Order to its sort direction.
Encodes a template as a JSON string.
Decodes a template from an encoded string.
Encodes a selection as a URL-safe string.
Decodes a selection from a URL-safe string.
Encodes a probe as a key string.
Decodes a key string into a probe.
Client-driven resource retrieval.
Defines types for specifying the data envelope to retrieve in REST/JSON APIs, including property selection, linked resource expansion, and, for collections, filtering, sorting, and pagination.
QEST's design rationale covers the client-driven retrieval approach; Appendix A covers cross-backend semantics and normalisation.
Data model
Type inference
Type guards
Accessors
Codecs
Retrieval Patterns
Resource Retrieval
A Template specifies which properties to retrieve from a single Resource and how deeply to expand linked resources. No over-fetching of unwanted fields, no under-fetching requiring additional calls:
Collection Retrieval
A Query specifies how to retrieve a Resource collection — the collection-shaped counterpart of Template, combining a per-item element (a scalar, a nested
Template(or per-branch Union), or a Projection for computed aggregates) with a Selection for filtering, ordering, and pagination. Collection queries appear inside a managing resource that owns the collection, following REST/JSON best practices. A collection is a tuple pairing the per-item element with an optional Selection — a single call retrieves filtered, sorted, and paginated results with arbitrarily deep expansions, no over-fetching, no under-fetching:Localised Properties
For multilingual properties, use Locales templates with TagRange keys to select language tags to retrieve. Within a single map, all tag-range-keyed values must be uniformly scalar or uniformly array:
A localised property is a single structured value, the localised counterpart of a nested resource rather than a multi-valued property: a Dictionary reached through Locales as its own Placeholders arm. The
TagRangekeys are RFC 4647 basic language ranges that filter which locales populate the map (the standalone*matches every tag, and a plain range such asenalso matches more specific tags likeen-US), while the per-tag value shape (""or[""]) only selects each entry's cardinality. Tag ranges select retrieved content only and are independent of Selection: aLocalesmap carriesTagRangekeys, neverSelectionoperator keys. Resource matching by localised text is done separately, at the enclosing collection'sSelectionvia?/!.The
@nonekey for non-localised values is not supported; use theundtag for language-neutral values.Computed Properties
Projections can define computed properties using expressions combining property paths with Transform.
Plain transforms operate on individual values and may project scalar literals, linked resource references, nested templates expanding a linked resource inline, or Locales tag-range maps declaring a localised cell that yields a complete Dictionary value per row:
A projection emits distinct rows: rows with the same combination of cell values collapse into one, so the result is the set of distinct binding tuples rather than a multiset. Distinctness spans the whole collection, folding both multi-valued fan-out duplicates and equal tuples from different items; include an identifying binding such as
id(as above) to keep otherwise-equal items on separate rows.Aggregate Grouping
Aggregate transforms operate on sets of values. When at least one aggregate Expression appears in a Projection or the sibling Selection, the query is evaluated under grouped semantics; otherwise every row is projected independently and no grouping applies.
Under grouped semantics, each operator's role is determined by whether its expression references an aggregate transform:
Grouping is fixed by the projection alone and is never inferred from a sort key: a non-aggregate ordering expression must reference an existing grouping key, and processors must reject one that matches none.
Rows sharing the same grouping-key values collapse into a single group. Aggregate filter and ordering constraints are independent of any projected bindings: an aggregate may appear in a constraint without being projected, and a projected aggregate may appear without being constrained.
Aggregate expressions use bag semantics over their inputs:
count:(empty path) returns the number of rows in scope; a non-empty path (for example,sum:price) ranges over the values resolved by the path for each input row, with multi-valued path fan-outs contributing every resolved value individually. No implicit deduplication is applied — clients needing distinct-value aggregates project the value of interest as a non-aggregate grouping binding.See Aggregate Transforms for the transform catalogue and cross-backend semantics.
Faceted Search
Aggregates enable faceted search patterns, computing category counts, value ranges, and totals in a single call:
Union Branches
For properties whose declared range is a union type, a Union declares per-branch retrieval by mapping opaque keys to the Placeholder to fetch for each variant of interest. The keys carry no positional or nominal meaning: the variant a placeholder retrieves is fixed by matching it against the property's declared variants, and an unmatched variant is skipped at runtime:
Expressions
A Projection Binding key pairs a result name with a computed value: a pipeline of Transform and a property path (together an Expression). The result name and its
=are mandatory; a bare identifier is not a binding:Value Ordering
Comparison (
<,>,<=,>=) and sort (^) operators rely on a total ordering over values defined by the XPath 2.0 comparison operators, which are in turn based on XSD ordered value spaces. These operators, along with sort focus (+), target Literal values only; Reference values, nested Template resources, and Dictionary values are neither comparable nor sortable:null— undefined values sort before all defined valuesboolean—false<truenumber— standard numeric ordering;NaNis unorderedstring— Unicode codepoint collationCross-type comparisons and values that fall outside these rules produce unpredictable, system-dependent results.
Type Inference
Instance infers the type of the Resource fetched by a given Template, so client code can declare strongly-typed result variables without restating the type:
The projection drops Selection metadata, widens collection tuples into homogeneous arrays, projects a Union into a union of per-branch results, recurses through nested templates and collection projections, and reduces each Binding key in a nested Projection to its Identifier portion, mirroring how the runtime materialises a fetched resource.
Serialisation
Template Serialisation
Template objects are serialised as JSON via encodeTemplate / decodeTemplate, with IRI internalisation and resolution handled transparently. The encoder emits plain JSON by default and optionally URL-encoded JSON or URL-safe base64url-encoded JSON for transport; the decoder auto-detects the input encoding.
Selection Serialisation
Selection objects are serialised as
application/x-www-form-urlencodedstrings via encodeSelection / decodeSelection for transmission as URL query strings in GET requests.Form serialisation specifies only selection constraints; servers are expected to convert to a collection template by wrapping inside the target endpoint's collection property and providing a default resource retrieval template.
The format encodes queries as
label=valuepairs where:expression=valuefor?expression=value(disjunctive matching)expression<=valuefor<=expression=value(less than or equal)expression>=valuefor>=expression=value(greater than or equal)Values use JSON primitive syntax, with a Dictionary entry inlined through a single postfix
@tagsuffix:@tagsuffix, lifting it into a one-entry Dictionary (for example,"text"@endecodes to{ en: "text" })Encoding notes:
~(like),!(all)&(separator),=(key/value),+(space),%(escape)Numeric-looking values like
123are parsed as numbers unless double-quoted.This query:
categoryis "electronics" OR "home"namecontains "widget"priceis between 50 and 150 (inclusive)priceascending