@grafctory/blue - v0.17.0
    Preparing search index...

    Type Alias ResourceConstraints

    Constraints accepted by the resource shape factory.

    States what a resource is called, where its members resolve their predicates, what class it belongs to and which identifiers it may be named by; the members it carries are stated apart.

    type ResourceConstraints = {
        name?: string | Dictionary;
        description?: string | Dictionary;
        space?: Namespace;
        class?: Reference;
        pattern?: string;
        in?: readonly Reference[];
        hasValue?: readonly Reference[];
        validators?: readonly Validator<Resource>[];
    }
    Index
    name?: string | Dictionary

    Human-readable name for the shape.

    Accepts a localised Dictionary or, as a shorthand for the English-only case, a plain text string, expanded to { en: <value> } on the built shape.

    Inheritance — always from the child; not inherited.

    SHACL defines sh:name only for property shapes; extended here to node shapes.

    description?: string | Dictionary

    Human-readable description of the shape.

    Accepts a localised Dictionary or, as a shorthand for the English-only case, a Markdown string, expanded to { en: <value> } on the built shape.

    Inheritance — always from the child; not inherited.

    SHACL defines sh:description only for property shapes; extended here to node shapes.

    space?: Namespace

    Default namespace for mapping member names to predicates.

    A member stating neither a forward nor a reverse mapping is stored under its own name resolved against this space.

    Inheritance — inherited; conflicting parents without a child override are reported as an error.

    the base namespace (base:/#)

    class?: Reference

    Target class for resource instances.

    The absolute IRI naming the primary class a resource belongs to, stated by each shape in its own right. Where the shape declares a type member, that member carries this class as its value; the classes inherited on top of it are read off classes.

    A class is an obligation on the resources a shape describes, so a shape standing in for another as a member range must belong to every class that one declares, whether stated in its own right or inherited: a shape merely repeating the members of the one it stands in for is rejected.

    Inheritance — always from the child; not inherited.

    pattern?: string

    IRI path pattern that resource identifiers must match.

    Patterns are IRI-like templates: {name} stands for a single path segment and a trailing /* for one or more. A pattern ending in / names a container, such as a catalogue root, and matches only identifiers ending in that slash. Patterns may be absolute or root-relative; root-relative patterns match absolute IRIs, ignoring the origin. A /* wildcard standing alone on the root path admits every identifier under the origin, at any depth.

    The pattern binds only the identifier a resource states, so a resource stating no identifier is accepted.

    Inheritance — only the trailing /* wildcard admits narrowing: a child may replace /* with more specific segments (for example, /products/* to /products/{id}/reviews/{rid}), provided the fixed prefix matches. All other cases require exact equality; a mismatch is reported as an error.

    undefined (no pattern constraint)

    https://example.org/products/{sku}  → https://example.org/products/ABC-456
    https://example.org/categories/* → https://example.org/categories/electronics/phones
    https://example.org/* → https://example.org/catalogues/2026

    /employees/{id} → https://example.org/employees/123
    /departments/* → https://example.org/departments/sales/emea
    in?: readonly Reference[]

    Allowed resource identifiers (closed enumeration).

    When specified, resource identifiers must be members of this list. IRIs must be absolute. Empty arrays are ignored. The list binds only the identifier a resource states, so a resource stating no identifier is accepted.

    Inheritance — child may only drop allowed identifiers.

    undefined (no enumeration constraint)

    hasValue?: readonly Reference[]

    Resource identifiers a resource must be named by.

    When specified, the identifier must equal every listed value, so a shape listing two or more admits no resource at all. IRIs must be absolute. Empty arrays are ignored.

    A resource stating no identifier is accepted, where SHACL would reject it as matching no listed value. A member ranging over values is held to its own hasValue even where it carries none, as an absent value never matches.

    Inheritance — child may only add required identifiers.

    undefined (no required values)

    validators?: readonly Validator<Resource>[]

    Custom checks a resource must pass beyond the declarative constraints.

    Carries the constraints a shape cannot state declaratively: each is handed the whole resource and reports what it finds as a Trace, or undefined where the resource passes. Every check runs, so a resource is told everything that is wrong with it at once rather than one thing at a time, and each trace is keyed by the name of the check reporting it.

    Important

    Checks run only where a whole resource is validated, never against a retrieval template or the resources it retrieves: a retrieval may leave out any member a check reads, failing the check on data it never asked for.

    Inheritance — union of the checks stated and the ones inherited; every check applies.