Options
All
  • Public
  • Public/Protected
  • All
Menu

Main entrypoint into the functionality of link-lib.

Before using the methods for querying data and views here, search through your render library (e.g. link-redux) to see if it exposes an API which covers your use-case. Skipping the render library might cause unexpected behaviour and hard to solve bugs.

Type parameters

  • T

Hierarchy

  • LinkedRenderStore

Implements

Index

Constructors

constructor

Properties

actions

actions: {}

Map of {ActionMap} which hold action dispatchers. Calling a dispatcher should execute the action, causing them to be handled like any back-end sent action.

Constructing action IRI's and dispatching them in user code was a bit hard, this object allows any middleware to define their actions (within their namespace) in a code-oriented fashion. The middleware has control over how the actions will be dispatched, but it should be the same as if a back-end would have executed the action (via the Exec-Action header).

Type declaration

api

defaultType

defaultType: NamedNode = schema.Thing

Whenever a resource has no type, assume it to be this.

deltaProcessors

deltaProcessors: DeltaProcessor[]

mapping

mapping: ComponentStore<T>

namespaces

namespaces: NamespaceMap

Can aid in parsing an creating prefix mapping strings. Please use @ontologies/ packages in your programs, canonicalizing certain prefixes will lead to brittle and hard to refactor code!

report

schema

schema: Schema<Indexable>

store

store: RDFStore = new RDFStore()

Accessors

dispatch

Methods

addDeltaProcessor

addOntologySchematics

  • addOntologySchematics(items: Quad[]): void
  • Push one or more ontological items onto the graph so it can be used by the render store for component determination.

    Adding information after the initial render currently conflicts with the caching and will result in inconsistent results.

    Statements added here will also be added to the data store so views can access the statements.

    Parameters

    • items: Quad[]

    Returns void

dig

  • dig(subject: Node, path: NamedNode[]): Term[]
  • Resolve the values at the end of the path

    Parameters

    • subject: Node

      The resource to start descending on

    • path: NamedNode[]

      A list of linked predicates to descend on.

    Returns Term[]

exec

  • exec(subject: NamedNode, args?: DataObject): Promise<any>

execActionByIRI

  • Execute an Action by its IRI. This will result in an HTTP request being done and probably some state changes.

    Parameters

    • subject: NamedNode

      The resource to execute. Generally a schema:Action derivative with a schema:EntryPoint to describe the request. Currently schema:url is used over schema:urlTemplate to acquire the request URL, since template processing isn't implemented (yet).

    • Optional data: DataObject

      An object to send in the body when a non-safe method is used.

    Returns Promise<LinkedActionResponse>

findSubject

  • findSubject(subject: Node, path: NamedNode[], match: Term | Term[]): Node[]
  • Retrieve the subjects from {subject} to find all resources which have an object at the end of the {path} which matches {match}.

    Parameters

    • subject: Node

      The resource to start descending on.

    • path: NamedNode[]

      A list of linked predicates to descend on.

    • match: Term | Term[]

      The value which the predicate at the end of {path} has to match for its subject to return.

    Returns Node[]

getComponentForProperty

  • getComponentForProperty(type?: NamedNode | NamedNode[] | undefined, predicate: NamedNode | NamedNode[], topology?: NamedNode): T | undefined
  • Finds the best render component for a given property in respect to a topology.

    renderlibrary

    This should only be used by render-libraries, not by application code.

    Parameters

    • Default value type: NamedNode | NamedNode[] | undefined = this.defaultType

      The type(s) of the resource to render.

    • predicate: NamedNode | NamedNode[]

      The predicate(s) (property(s)) to render.

    • Default value topology: NamedNode = DEFAULT_TOPOLOGY

    Returns T | undefined

    The most appropriate renderer, if any.

getComponentForType

  • getComponentForType(type: NamedNode | NamedNode[], topology?: NamedNode): T | undefined
  • Finds the best render component for a type in respect to a topology.

    renderlibrary

    This should only be used by render-libraries, not by application code.

    see

    LinkedRenderStore#getComponentForProperty

    Parameters

    • type: NamedNode | NamedNode[]

      The type(s) of the resource to render.

    • Default value topology: NamedNode = DEFAULT_TOPOLOGY

    Returns T | undefined

    The most appropriate renderer, if any.

getEntity

  • getEntity(iri: NamedNode, opts?: FetchOpts): Promise<void>
  • Will fetch the entity with the URL {iri}. When a resource under that subject is already present, it will not be fetched again.

    renderlibrary

    This should only be used by render-libraries, not by application code.

    Parameters

    • iri: NamedNode

      The Node of the resource

    • Optional opts: FetchOpts

      The options for fetch-/processing the resource.

    Returns Promise<void>

    A promise with the resulting entity

getResourceProperties

  • getResourceProperties<TT>(subject: Node, property: Node | Node[]): TT[]
  • Resolves all the properties {property} of resource {subject} to a value.

    renderlibrary

    This should only be used by render-libraries, not by application code.

    Type parameters

    • TT: Term

      The expected return type for the properties.

    Parameters

    • subject: Node

      The resource to get the properties for.

    • property: Node | Node[]

    Returns TT[]

    The resolved values of {property}, or an empty array when none are present.

getResourceProperty

  • getResourceProperty<TT>(subject: Node, property: Node | Node[]): TT | undefined
  • Resolves the property {property} of resource {subject} to a value.

    When more than one statement on {property} is present, a random one will be chosen. See {LinkedResourceContainer#getResourceProperties} to retrieve all the values.

    renderlibrary

    This should only be used by render-libraries, not by application code.

    Type parameters

    • TT: Term

      The expected return type for the property.

    Parameters

    • subject: Node

      The resource to get the properties for.

    • property: Node | Node[]

    Returns TT | undefined

    The resolved value of {property}, or undefined when none are present.

getResourcePropertyRaw

  • getResourcePropertyRaw(subject: Node, property: Node | Node[]): Quad[]
  • Resolves all the properties {property} of resource {subject} to their statements.

    renderlibrary

    This should only be used by render-libraries, not by application code.

    Parameters

    • subject: Node

      The resource to get the properties for.

    • property: Node | Node[]

    Returns Quad[]

    All the statements of {property} on {subject}, or an empty array when none are present.

getStatus

processDelta

  • processDelta(delta: Array<Quadruple | void> | Quad[], expedite?: boolean): Promise<Quad[]>
  • Process a linked-delta onto the store.

    This should generally only be called from the middleware or the data api

    Parameters

    • delta: Array<Quadruple | void> | Quad[]

      An array of [s, p, o, g] arrays containing the delta.

    • Default value expedite: boolean = false

      Will immediately process the delta rather than waiting for an idle moment, useful in conjunction with event handlers within the UI needing immediate feedback. Might cause jumpy interfaces.

    Returns Promise<Quad[]>

queueDelta

  • queueDelta(delta: Array<Quadruple | void> | Quad[], expedite?: boolean): Promise<void>
  • Queue a linked-delta to be processed.

    Note: This should only be used by render-libraries (e.g. link-redux), not by application code.

    renderlibrary

    This should only be used by render-libraries, not by application code.

    Parameters

    • delta: Array<Quadruple | void> | Quad[]
    • Default value expedite: boolean = false

    Returns Promise<void>

queueEntity

  • queueEntity(iri: NamedNode, opts?: FetchOpts): void
  • Efficiently queues a resource to be fetched later.

    This skips the overhead of creating a promise and allows the subsystem to retrieve multiple resource in one round trip, sacrificing loading status for performance.

    renderlibrary

    This should only be used by render-libraries, not by application code.

    Parameters

    Returns void

registerAll

removeResource

  • removeResource(subject: Node, expedite?: boolean): Promise<void>
  • Remove a resource from the store, when views are still rendered the resource will be re-fetched.

    unstable

    Parameters

    • subject: Node
    • Default value expedite: boolean = false

    Returns Promise<void>

reset

  • reset(): void
  • Resets the render store mappings and the schema graph.

    Note: This should only be used by render-libraries (e.g. link-redux), not by application code.

    Returns void

resourceComponent

  • resourceComponent(subject: Node, topology?: NamedNode): T | undefined
  • Get a render component for {subject}.

    renderlibrary

    Parameters

    • subject: Node

      The resource to get the renderer for.

    • Optional topology: NamedNode

      The topology to take into account when picking the renderer.

    Returns T | undefined

resourcePropertyComponent

  • resourcePropertyComponent(subject: Node, predicate: NamedNode | NamedNode[], topology?: NamedNode): T | undefined
  • Get a render component for a rendering {property} on resource {subject}.

    renderlibrary

    Parameters

    • subject: Node
    • predicate: NamedNode | NamedNode[]
    • Optional topology: NamedNode

    Returns T | undefined

shouldLoadResource

  • shouldLoadResource(subject: Node): boolean

subscribe

  • Listen for data changes by subscribing to store changes.

    renderlibrary

    This should only be used by render-libraries, not by application code.

    Parameters

    Returns () => void

    function Unsubscription function.

      • (): void
      • Returns void

touch

  • touch(_iri: string | NamedNode, _err?: Error): boolean

tryEntity

  • tryEntity(iri: Node): Quad[]
  • Returns an entity from the cache directly. This won't cause any network requests even if the entity can't be found.

    renderlibrary

    This should only be used by render-libraries, not by application code.

    Parameters

    • iri: Node

      The Node of the resource.

    Returns Quad[]

    The object if found, or undefined.

Static registerRenderer

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc