data type
The identity of the datatype itself. Used in the internal representation, which is visible to query filters; but a canonical json-rql Value is substituted in retrieval and updates.
Deserialises data. If this method is not provided, the data must be directly deserialisable from JSON.
Obtains a (preferably short) identity for the given data, which is consistent with equality between data objects. The identity value is only visible to query filters; the data is {@link #toValue indirected} in retrieval and updates.
Convert data to a representation that can be stringified to JSON. If this method is not provided, the data itself must be JSON serialisable. The implementation should include a version if the format is likely to change.
Provides a value to appear when the data is retrieved. The datatype should
always accept the returned value forms in its validate
method. If the
value's type should be anything other than this datatype's @id
, a
ValueObject
should be returned including the desired @type
, even if
it's a built-in type like xs:string. The value object will be compacted as
normal in the application API.
If the returned value is an expanded ValueObject
, its datatype MUST be a
fully expanded IRI.
If this method is not provided, the data itself MUST be a valid API value.
Parses a value provided by the app. This may give the application some
leeway in type strictness; but note that the value provided back to the app
will always be that returned by {@link Datatype#toValue}, if
provided, or the Data
itself if not.
If the provided value is an expanded ValueObject
, its datatype will be a
fully pre-expanded IRI.
the valid data, or undefined if the data is not valid
Generated using TypeDoc. Delivered by Vercel. @m-ld/m-ld - v0.10.0 Source code licensed MIT. Privacy policy
A Datatype is a handler for data in the domain that is 'indirected'. This means that its validation and storage is separate to the internal graph representation that is used for all other Subject properties.
A plain indirected data type is primarily used as an optimisation, to improve the cost of internal data indexing. However, a Shared data type adds the capability to present specialist mutable data with its own algorithms for reconciling concurrent mutations.