Utility property definition for the JSON-LD @type
key
true
if this subject does not exist in the domain
Resolves when this subject's graph is up-to-date with the domain
Gathers all changes in the subject since the last update from state, returns them as a m-ld update for applying to the domain, and reverts them in anticipation of the resultant echoed update (which may differ due to the application of constraints).
Call from a subclass constructor to initialise the mapping between the graph and this subject's list items.
a List graph subject to initialise the list from
JSON-LD type of items in the list
an array-like object having:
will be called to get & set JSON-LD values for items in the list
Call from a subclass constructor to initialise the mapping between the
graph and this subject's properties, which have been declared with the
{@link property} annotation in Typescript. Additional runtime property
access metadata can be provided in the access
parameter.
the initial graph subject – used for its property values
custom property access information
Call from a subclass constructor to initialise the mapping between the graph and this subject's property. This method is for use in Javascript, and in scenarios where the structure of this ORM subject does not reflect the graph representation – for example, an aggregation member reflecting data from its parent graph subject.
the initial graph subject – only used for its property value
the local property name. If the type in the graph cannot be cast to the property type, {@link #updated} will be rejected.
the property definition
custom property access information
Called by the ORM domain when the subject's properties have been fully updated. The deleted flag will be set. Any reference properties or other asynchronous dependencies may not yet be loaded (may be 'faults').
Called when a graph subject (src) property is being updated.
The property that is being updated.
If any property is asynchronously updated, the final value will only be definitively set when this promise resolves.
Generated using TypeDoc. Delivered by Vercel. @m-ld/m-ld - v0.10.0 Source code licensed MIT. Privacy policy
An Object-Resource Mapping (ORM) Subject is a Javascript class used to reflect graph nodes in a m-ld domain.
The constructor of an ORM subject should accept a GraphSubject from which derive its initial state. In the case of a new subject, which does not yet exist in the domain, this will only contain an
@id
(i.e. it's a Reference), so the constructor may also accept other values for initialising properties.Local properties properties are then mapped to graph properties (edges) by calling initSrcProperties in the constructor. This ensures that any local changes to the object property values are tracked, and can be committed to the graph later using commit (usually called for a batch of subjects from OrmDomain.commit). E.g.
class Flintstone extends OrmSubject { @property(JsType.for(String)) name: string; @property(JsType.for(Optional, Number)) height?: number; constructor(src: GraphSubject) { super(src); this.initSrcProperties(src); } }
Note that an ORM subject constructor should only ever be called by the passed
construct
callback of OrmUpdating.get, so that the subject is correctly registered with the ORM domain.OrmDomain