Options
All
  • Public
  • Public/Protected
  • All
Menu

A data state corresponding to a local clock tick. A state can be some initial state (an new clone), or follow a write operation, which may have been transacted locally in this clone, or remotely on another clone.

The get and delete methods are intentionally suggestive of a REST API, which could be implemented by the class when used in a service environment.

🚧 put, post and patch methods will be available in a future release.

If a data state is not available ('live') for read and write operations, the methods will throw. Liveness depends on how this state was obtained. A mutable state such as a MeldClone is always live until it is closed. An immutable state such as obtained in a read or write procedure is live until either a write is performed in the procedure, or the procedure's asynchronous return promise resolves or rejects.

see

MeldStateMachine.read

see

MeldStateMachine.write

see

m-ld specification

Type parameters

  • Q: BaseQuad

Hierarchy

Index

Methods

ask

  • ask(pattern: Query): Promise<boolean>
  • Shorthand method to test whether or not a query pattern has a solution. No information is returned about the possible query solutions, just whether or not a solution exists.

    see

    https://www.w3.org/TR/sparql11-query/#ask

    Parameters

    • pattern: Query

      a query with a @where pattern to test

    Returns Promise<boolean>

    resolves to true if the query's @where pattern matches data in the domain

countQuads

  • countQuads(...args: Parameters<Source["match"]>): Promise<number>
  • Parameters

    • Rest ...args: Parameters<Source["match"]>

    Returns Promise<number>

delete

  • Shorthand method for deleting a single Subject by its @id. This will also remove references to the given Subject from other Subjects.

    Parameters

    • id: string

      the Subject @id

    Returns Promise<MeldState>

get

  • Shorthand method for retrieving a single Subject and its properties by its @id, if it exists.

    Parameters

    • id: string

      the Subject @id

    • Rest ...properties: SubjectProperty[]

      the properties to retrieve. If no properties are specified, all available properties of the subject will be returned.

    Returns Promise<GraphSubject | undefined>

    a promise resolving to the requested Subject with the requested properties, or undefined if not found

match

  • match(subject?: Term | null, predicate?: Term | null, object?: Term | null, graph?: Term | null): Stream<Q>
  • Returns a stream that processes all quads matching the pattern.

    Parameters

    • Optional subject: Term | null

      The optional subject.

    • Optional predicate: Term | null

      The optional predicate.

    • Optional object: Term | null

      The optional object.

    • Optional graph: Term | null

      The optional graph.

    Returns Stream<Q>

    The resulting quad stream.

query

read

  • Actively reads data from the domain.

    The query executes in response to either subscription to the returned result, or calling .then.

    All results are guaranteed to derive from the current state; however since the observable results are delivered asynchronously, the current state is not guaranteed to be live in the subscriber. In order to keep this state alive during iteration (for example, to perform a consequential operation), perform the read in the scope of a read procedure.

    see

    MeldStateMachine.read

    Type parameters

    Parameters

    • request: R

      the declarative read description

    Returns ReadResult

    read subjects

write

  • Actively writes data to the domain.

    As soon as this method is called, this current state is no longer 'live' (write will throw). To keep operating on state, use the returned new state.

    Type parameters

    • W

      one of the Write types

    Parameters

    • request: W

      the declarative write description

    Returns Promise<MeldState>

    the next state of the domain, changed by this write operation only

Legend

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

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