Options
All
  • Public
  • Public/Protected
  • All
Menu

This extension allows an app to declare that the domain data must conform to some defined shapes. A collection of shapes is like a 'schema' or 'object model'.

The extension can be declared in the data using declare, or instantiated and provided to the clone function in the app parameter, e.g.

api = await clone(
  new MemoryLevel, MqttRemotes, config,
  new ShapeConstrained(new PropertyShape({
    path: 'http://ex.org/#name', count: 1
  })));

Note that properties and types provided as initialisation parameters to shapes (e.g. path above) must be fully-qualified IRIs according to the vocabulary of the domain. See MeldContext for more information.

If combining shape constraints with other extensions, it may be necessary (and is safe) to use the constraints member of this class directly as a sublist in a list of constraints.

see

https://www.w3.org/TR/shacl/

experimental

Hierarchy

  • ShapeConstrained

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • Parameters

    • Rest ...shapes: Shape[]

      The shapes to which domain data must conform

    Returns ShapeConstrained

Properties

shapes

shapes: Shape[]

The shapes to which domain data must conform.

Methods

Static declare

  • Extension declaration. Insert into the domain data to install the extension. For example (assuming a m-ld clone object):

    clone.write(ShapeConstrained.declare(0, PropertyShape.declare({
      path: 'name', count: 1
    })));
    

    Note that declaration of shapes will not retrospectively apply constraints to any existing subjects in the domain. It's the app's responsibility to correct existing data, if necessary.

    Parameters

    • priority: number

      the preferred index into the existing list of extensions (lower value is higher priority).

    • Rest ...controlledShapes: (Subject | Reference)[]

      shape Subjects, or References to pre-existing shapes

    Returns Subject

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Static property
  • Static method
  • Inherited property
  • Protected method

Generated using TypeDoc. Delivered by Vercel. @m-ld/m-ld - v0.9.2-edge.3 Source code licensed MIT. Privacy policy