Options
All
  • Public
  • Public/Protected
  • All
Menu

Link Library

A Link to the Web

Reference: How to use Link with React

CircleCI Code Climate coverage

This package aims to make building rich web applications quick and easy by providing all the tools needed to work with linked data, providing high-level API's for view rendering, data querying & manipulation, and API communication. See the link-redux package on how to use this in a React project.

To transform your Rails application into a linked-data serving beast, see our Active Model Serializers plugin.

This was built at Argu, if you like what we do, these technologies or open data, send us a mail.

Example

See the TODO app for a live example and link-redux-todo for the implementation. Mind that it isn't connected to a back-end, so it's only a demo for the view rendering mechanism.

Installation

yarn add link-lib

and some peer dependencies:

yarn add @ontologies/as @ontologies/core @ontologies/schema @ontologies/shacl @ontologies/xsd http-status-codes n-quads-parser

The package externalizes the Promise API, so make sure to include your own when targeting platforms without native support.

Usage

See the Hypermedia API page for documentation on how to execute actions against the service.

See Link Redux for documentation on how to use Link in a React application.

Included namespace prefixes

See the utilities for the namespaces included by default.

Contributing

The usual stuff. Open an issue to discuss a change, open PR's from topic-branches targeted to master for bugfixes and refactors.

Index

Modules

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

AnyRDFObject

AnyRDFObject: BlankNode | NamedNode | Literal | Quad | Quadruple

BasicComponent

BasicComponent: () => string | undefined

Type declaration

    • (): string | undefined
    • Returns string | undefined

BlankNode

BlankNode: BasicBlankNode

Constructable

Constructable<T, T>: {}

Type parameters

  • T

  • T

Type declaration

DataTuple

DataTuple: [RDFIndex, NamedBlobTuple[]]

ErrorReporter

ErrorReporter: (e: Error, ...args: any) => void

Type declaration

    • (e: Error, ...args: any): void
    • Parameters

      • e: Error
      • Rest ...args: any

      Returns void

FetchFailureCallback

FetchFailureCallback: (success: false, error: string, result: undefined) => void

Type declaration

    • (success: false, error: string, result: undefined): void
    • Parameters

      • success: false
      • error: string
      • result: undefined

      Returns void

FetchSuccessCallback

FetchSuccessCallback: (success: true, error: null, result: Response) => void

Type declaration

    • (success: true, error: null, result: Response): void
    • Parameters

      • success: true
      • error: null
      • result: Response

      Returns void

GetBasicStoreOpts

GetBasicStoreOpts: Partial<ExplodedLRS<BasicComponent>>

Indexable

Indexable: number | string

LazyIRIArgument

LazyIRIArgument: SomeNode | SomeNode[]

LazyNNArgument

LazyNNArgument: NamedNode | NamedNode[]

Literal

Literal: BasicLiteral

MiddlewareActionHandler

MiddlewareActionHandler: (action: NamedNode, args: any) => Promise<any>

Type declaration

    • (action: NamedNode, args: any): Promise<any>
    • Parameters

      • action: NamedNode
      • args: any

      Returns Promise<any>

MiddlewareFn

MiddlewareFn<T>: (store: LinkedRenderStore<T>) => MiddlewareWithBoundLRS

Type parameters

  • T

Type declaration

MiddlewareWithBoundLRS

MiddlewareWithBoundLRS: (next: MiddlewareActionHandler) => MiddlewareActionHandler

NamedBlobTuple

NamedBlobTuple: [SomeNode, File]

NamedNode

NamedNode: BasicNamedNode

Node

Node: BasicNode

OptionalNamedNode

OptionalNamedNode: NamedNode | null

OptionalNode

OptionalNode: Node | null

OptionalTerm

OptionalTerm: SomeTerm | null

ParsedObject

ParsedObject: [SomeNode, LowLevelStore, NamedBlobTuple[]]

PropertyActionCallback

PropertyActionCallback: (quad: Quad) => void

Type declaration

    • (quad: Quad): void
    • Parameters

      • quad: Quad

      Returns void

Quad

Quad: BasicQuad

Quadruple

Quadruple: BasicQuadruple

RDFLibParse

RDFLibParse: (str: string, kb: LowLevelStore, base: string, contentType: string, callback: () => void) => void

Type declaration

    • (str: string, kb: LowLevelStore, base: string, contentType: string, callback: () => void): void
    • Parameters

      • str: string
      • kb: LowLevelStore
      • base: string
      • contentType: string
      • callback: () => void
          • (): void
          • Returns void

      Returns void

RequestCallbackHandler

RequestCallbackHandler: (uri: string | NamedNode, error?: Error) => boolean | undefined

Type declaration

    • (uri: string | NamedNode, error?: Error): boolean | undefined
    • Parameters

      • uri: string | NamedNode
      • Optional error: Error

      Returns boolean | undefined

ResourceQueueItem

ResourceQueueItem: [NamedNode, FetchOpts | undefined]

ResponseAndFallbacks

ResponseAndFallbacks: Response | XMLHttpRequest | ExtensionResponse | RDFLibFetcherRequest | RDFLibFetcherResponse

ResponseTransformer

ResponseTransformer: (response: ResponseAndFallbacks) => Promise<Quad[]>

Type declaration

SearchIndex

SearchIndex: [Array<SomeTerm | null>, number[], number[]]

SerializableDataTypes

SerializablePrimitives

SerializablePrimitives: boolean | DataObject | Date | File | number | string | NamedNode | BlankNode | Literal

SomeNode

SomeNode: NamedNode | BlankNode

SomeRequestStatus

SomeTerm

SomeTerm: NamedNode | BlankNode | Literal

StoreProcessor

StoreProcessor: (delta: Quadruple[]) => StoreProcessorResult

Type declaration

StoreProcessorResult

StoreProcessorResult: [Quadruple[], Quadruple[], Quad[]]

SubscriptionCallback

SubscriptionCallback<T>: (v: T, lastUpdateAt?: undefined | number) => void

Type parameters

  • T

Type declaration

    • (v: T, lastUpdateAt?: undefined | number): void
    • Parameters

      • v: T
      • Optional lastUpdateAt: undefined | number

      Returns void

SubscriptionRegistration

Term

Term: BasicTerm

WildQuadruple

WildQuadruple: [Node | null, NamedNode | null, SomeTerm | null, Node | null]

Variables

Const BASE

BASE: 36 = 36

Const CI_MATCH_PREFIX

CI_MATCH_PREFIX: 0 = 0

Const CI_MATCH_SUFFIX

CI_MATCH_SUFFIX: 1 = 1

Const DATA_ACQUIRED

DATA_ACQUIRED: "DATA_ACQUIRED" = "DATA_ACQUIRED"

Const DEC_CUTOFF

DEC_CUTOFF: 2 = 2

Const DEFAULT_TOPOLOGY

DEFAULT_TOPOLOGY: NamedNode = ll.defaultTopology

Const DT

DT: any = rdfFactory.id(DEFAULT_TOPOLOGY)

Const EMPTY_ST_ARR

EMPTY_ST_ARR: ReadonlyArray<Quad> = Object.freeze([])

Const FETCHER_CALLBACKS

FETCHER_CALLBACKS: string[] = ["done", "fail", "refresh", "request", "retract"]

Const FETCH_EXT

FETCH_EXT: "FETCH_EXT" = "FETCH_EXT"

Const FETCH_RESOURCE

FETCH_RESOURCE: "FETCH_RESOURCE" = "FETCH_RESOURCE"

Const F_JSON

F_JSON: "application/json" = "application/json"

Const F_JSONLD

F_JSONLD: "application/ld+json" = "application/ld+json"

Const F_N3

F_N3: "text/n3" = "text/n3"

Const F_NQUADS

F_NQUADS: "application/n-quads" = "application/n-quads"

Const F_NTRIPLES

F_NTRIPLES: "application/n-triples" = "application/n-triples"

Const F_NTRIPLES_DEP

F_NTRIPLES_DEP: "text/ntriples" = "text/ntriples"

Const F_PLAIN

F_PLAIN: "text/plain" = "text/plain"

Const F_RDF_XML

F_RDF_XML: "application/rdf+xml" = "application/rdf+xml"

Const F_TURTLE

F_TURTLE: "text/turtle" = "text/turtle"

Const F_TURTLE_DEP

F_TURTLE_DEP: "application/x-turtle" = "application/x-turtle"

Const GET_ENTITY

GET_ENTITY: "GET_ENTITY" = "GET_ENTITY"

Const IRI_LEN

IRI_LEN: 20 = 20

LinkedDataAPI

LinkedDataAPI: { constructor: any }

Type declaration

Const MAIN_NODE_DEFAULT_IRI

MAIN_NODE_DEFAULT_IRI: NamedNode = ll.targetResource

Const MSG_BAD_REQUEST

MSG_BAD_REQUEST: "Request failed with bad status code" = "Request failed with bad status code"

Const MSG_INCORRECT_TARGET

MSG_INCORRECT_TARGET: "Collections or Literals can't be the target" = "Collections or Literals can't be the target"

Const MSG_OBJECT_NOT_IRI

MSG_OBJECT_NOT_IRI: "Action object property must be an IRI." = "Action object property must be an IRI."

Const MSG_TYPE_ERR

MSG_TYPE_ERR: "Non-optimized NamedNode instance given. Please memoize your namespace correctly." = "Non-optimized NamedNode instance given. Please memoize your namespace correctly."

Const MSG_URL_UNDEFINED

MSG_URL_UNDEFINED: "No url given with action." = "No url given with action."

Const MSG_URL_UNRESOLVABLE

MSG_URL_UNRESOLVABLE: "Can't execute action with non-named-node url." = "Can't execute action with non-named-node url."

Const NON_CONTENT_EXTS

NON_CONTENT_EXTS: string[] = ["php", "asp", "aspx", "cgi", "jsp"]

Const NON_DATA_OBJECTS_CTORS

NON_DATA_OBJECTS_CTORS: Function[] = [Array,ArrayBuffer,Boolean,DataView,Date,Error,EvalError,Float32Array,Float64Array,Int16Array,Int32Array,Int8Array,Intl.Collator,Intl.DateTimeFormat,Intl.NumberFormat,Map,Number,Promise,/* istanbul ignore next */(typeof Proxy !== "undefined" ? Proxy : undefined)!,RangeError,ReferenceError,RegExp,Set,].filter(Boolean)

Const OWL

OWL: VocabularyProcessor = {axioms: [],processStatement(item: Quad, ctx: VocabularyProcessingContext): Quad[] | null {if (rdfFactory.equals(item.predicate, nsOWLsameAs)) {const a = ctx.equivalenceSet.add((item.object as SomeNode).id as number);const b = ctx.equivalenceSet.add(item.subject.id as number);ctx.equivalenceSet.union(a, b);return [item];}return null;},processType(_: NamedNode, __: VocabularyProcessingContext): boolean {return false;},} as VocabularyProcessor

Const RCN

RCN: any = rdfFactory.id(RENDER_CLASS_NAME)

Const RDFS

RDFS: VocabularyProcessor = {axioms: [rdfFactory.quad(rdf.type, rdfs.domain, rdfs.Resource),rdfFactory.quad(rdfs.domain, rdfs.domain, rdf.Property),rdfFactory.quad(rdfs.range, rdfs.domain, rdf.Property),rdfFactory.quad(rdfs.subPropertyOf, rdfs.domain, rdf.Property),rdfFactory.quad(rdfs.subClassOf, rdfs.domain, rdfs.Class),rdfFactory.quad(rdf.subject, rdfs.domain, rdf.Statement),rdfFactory.quad(rdf.predicate, rdfs.domain, rdf.Statement),rdfFactory.quad(rdf.object, rdfs.domain, rdf.Statement),rdfFactory.quad(rdfs.member, rdfs.domain, rdfs.Resource),rdfFactory.quad(rdf.first, rdfs.domain, rdf.List),rdfFactory.quad(rdf.rest, rdfs.domain, rdf.List),rdfFactory.quad(rdfs.seeAlso, rdfs.domain, rdfs.Resource),rdfFactory.quad(rdfs.isDefinedBy, rdfs.domain, rdfs.Resource),rdfFactory.quad(rdfs.comment, rdfs.domain, rdfs.Resource),rdfFactory.quad(rdfs.label, rdfs.domain, rdfs.Resource),rdfFactory.quad(rdf.value, rdfs.domain, rdfs.Resource),rdfFactory.quad(rdf.type, rdfs.range, rdfs.Class),rdfFactory.quad(rdfs.domain, rdfs.range, rdfs.Class),rdfFactory.quad(rdfs.range, rdfs.range, rdfs.Class),rdfFactory.quad(rdfs.subPropertyOf, rdfs.range, rdf.Property),rdfFactory.quad(rdfs.subClassOf, rdfs.range, rdfs.Class),rdfFactory.quad(rdf.subject, rdfs.range, rdfs.Resource),rdfFactory.quad(rdf.predicate, rdfs.range, rdfs.Resource),rdfFactory.quad(rdf.object, rdfs.range, rdfs.Resource),rdfFactory.quad(rdfs.member, rdfs.range, rdfs.Resource),rdfFactory.quad(rdf.first, rdfs.range, rdfs.Resource),rdfFactory.quad(rdf.rest, rdfs.range, rdf.List),rdfFactory.quad(rdfs.seeAlso, rdfs.range, rdfs.Resource),rdfFactory.quad(rdfs.isDefinedBy, rdfs.range, rdfs.Resource),rdfFactory.quad(rdfs.comment, rdfs.range, rdfs.Literal),rdfFactory.quad(rdfs.label, rdfs.range, rdfs.Literal),rdfFactory.quad(rdf.value, rdfs.range, rdfs.Resource),rdfFactory.quad(rdf.Alt, rdfs.subClassOf, rdfs.Container),rdfFactory.quad(rdf.Bag, rdfs.subClassOf, rdfs.Container),rdfFactory.quad(rdf.Seq, rdfs.subClassOf, rdfs.Container),rdfFactory.quad(rdfs.ContainerMembershipProperty, rdfs.subClassOf, rdf.Property),rdfFactory.quad(rdfs.isDefinedBy, rdfs.subPropertyOf, rdfs.seeAlso),rdfFactory.quad(rdfs.Datatype, rdfs.subClassOf, rdfs.Class),rdfFactory.quad(rdfs.Resource, rdf.type, rdfs.Class),rdfFactory.quad(rdfs.Class, rdf.type, rdfs.Class),],processStatement(item: Quad, ctx: VocabularyProcessingContext): Quad[] | null {const result = [item];const domainStatements = ctx.store.match(item.predicate, rdfs.domain, null, null);if (domainStatements.length > 0) {for (let i = 0; i < domainStatements.length; i++) {result.push(rdfFactory.quad(item.subject as NamedNode, rdf.type, domainStatements[i].object));}}const rangeStatements = ctx.store.match(item.predicate, rdfs.range, null, null);if (rangeStatements.length > 0) { // P rdfs:range C..Cnfor (let i = 0; i < rangeStatements.length; i++) {result.push(rdfFactory.quad(item.object as NamedNode, rdf.type, rangeStatements[i].object));}}if (equals(rdfs.domain, item.predicate)) {result.push(rdfFactory.quad(item.subject, rdf.type, rdf.Property)); // P rdf:type rdf:Propertyresult.push(rdfFactory.quad(item.object, rdf.type, rdfs.Class)); // C rdf:type rdfs:Classconst dereferences = ctx.store.match(item.subject, null, null, null);for (let i = 0; i < dereferences.length; i++) {result.push(rdfFactory.quad(item.subject as NamedNode, rdf.type, dereferences[i].object));}if (!equals(item.subject, rdf.type)) {ctx.dataStore.getInternalStore().newPropertyAction(item.subject as NamedNode,(quad: Quad) => {ctx.store.addQuads([rdfFactory.quad(quad.subject, rdf.type, item.object)]);return true;},);}} else if (equals(rdfs.range, item.predicate)) {result.push(rdfFactory.quad(item.subject, rdf.type, rdf.Property)); // P rdf:type rdf:Propertyresult.push(rdfFactory.quad(item.object, rdf.type, rdfs.Class)); // C rdf:type rdfs:Classconst dereferences = ctx.store.match(null, null, item.subject, null);for (let i = 0; i < dereferences.length; i++) {result.push(rdfFactory.quad(dereferences[i].subject, rdf.type, item.object));}if (!equals(item.subject, rdf.type)) {ctx.dataStore.getInternalStore().newPropertyAction(item.subject as NamedNode,(quad: Quad) => {ctx.store.addQuads([rdfFactory.quad(quad.object, rdf.type, item.object)]);return true;},);}} else if (equals(rdfs.subClassOf, item.predicate)) { // C1 rdfs:subClassOf C2if (!(item.object.termType === TermType.NamedNode || item.object.termType === TermType.BlankNode)) {throw new Error("Object of subClassOf statement must be a NamedNode");}const iSubject = id(item.subject);const iObject = id(item.object);if (!ctx.superMap.has(iObject)) {ctx.superMap.set(iObject, new Set([id(rdfs.Resource)]));}let parents = ctx.superMap.get(iObject);if (parents === undefined) {parents = new Set();ctx.superMap.set(iObject, parents);}parents.add(iObject);const itemVal = ctx.superMap.get(iSubject) || new Set<number>([iSubject]);parents.forEach((i) => itemVal.add(i));ctx.superMap.set(iSubject, itemVal);ctx.superMap.forEach((v, k) => {if (k !== iSubject && v.has(iSubject)) {itemVal.forEach(v.add, v);}});} else if (equals(rdfs.subPropertyOf, item.predicate)) {// TODO: Implementreturn result;}return result.length === 1 ? null : result;},processType(type: NamedNode, ctx: VocabularyProcessingContext): boolean {RDFS.processStatement(rdfFactory.quad(type, rdfs.subClassOf, rdfs.Resource), ctx);ctx.store.addQuads([rdfFactory.quad(type, rdf.type, rdfs.Class)]);return false;},} as VocabularyProcessor

Implements the RDF/RDFS axioms and rules.

Const RENDER_CLASS_NAME

RENDER_CLASS_NAME: NamedNode = ll.typeRenderClass

Constant used to determine that a class is used to render a type rather than a property. Constant used to determine that a component is used to render a type rather than a property.

Const SAFE_METHODS

SAFE_METHODS: string[] = ["GET", "HEAD", "OPTIONS", "CONNECT", "TRACE"]

Const SET_ACCEPT_HOST

SET_ACCEPT_HOST: "SET_ACCEPT_HOST" = "SET_ACCEPT_HOST"

Const STORE_UPDATE

STORE_UPDATE: "STORE_UPDATE" = "STORE_UPDATE"

Const createNS

createNS: (ns: string) => Namespace = basicCreateNS

Type declaration

    • (ns: string): Namespace
    • Parameters

      • ns: string

      Returns Namespace

Const creativeWorkStatements

creativeWorkStatements: any[] = [rdfFactory.quad(schemaCW, rdf.type, rdfs.Class),rdfFactory.quad(schemaCW, rdfs.label, rdfFactory.literal("CreativeWork")),rdfFactory.quad(schemaCW, rdfs.subClassOf, schemaT),rdfFactory.quad(schemaCW,dcterms.source,rdfFactory.namedNode("http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_rNews"),),rdfFactory.quad(schemaCW,rdfs.comment,rdfFactory.literal("The most generic kind of creative work, including books, movies, [...], etc."),),]

Const emptyRequest

emptyRequest: EmptyRequestStatus = Object.freeze({lastRequested: null,requested: false,status: null,timesRequested: 0,}) as EmptyRequestStatus

Const equals

equals: (Anonymous function) = rdfFactory.supports[Feature.identity]? (a: any, b: any): boolean => a === b: rdfFactory.supports[Feature.idStamp]? (a: any, b: any): boolean => a?.id === b?.id: (a: any, b: any): boolean => rdfFactory.equals(a, b)
internal

Const ex

ex: (term: string) => NamedNode = createNS("http://example.com/ns#")

Type declaration

    • (term: string): NamedNode
    • Parameters

      • term: string

      Returns NamedNode

Const example

example: (term: string) => NamedNode = createNS("http://example.com/")

Type declaration

    • (term: string): NamedNode
    • Parameters

      • term: string

      Returns NamedNode

Const http

http: (term: string) => NamedNode = createNS("http://www.w3.org/2007/ont/http#")

Type declaration

    • (term: string): NamedNode
    • Parameters

      • term: string

      Returns NamedNode

Const httph

httph: (term: string) => NamedNode = createNS("http://www.w3.org/2007/ont/httph#")

Type declaration

    • (term: string): NamedNode
    • Parameters

      • term: string

      Returns NamedNode

Const ianaJSONLDResource

ianaJSONLDResource: NamedNode = ianaMT(`${F_JSONLD}#Resource`)

Const ianaJSONResource

ianaJSONResource: NamedNode = ianaMT(`${F_JSON}#Resource`)

Const ianaMT

ianaMT: (term: string) => NamedNode = createNS("http://www.w3.org/ns/iana/media-types/")

Type declaration

    • (term: string): NamedNode
    • Parameters

      • term: string

      Returns NamedNode

Const ianaN3Resource

ianaN3Resource: NamedNode = ianaMT(`${F_N3}#Resource`)

Const ianaNQResource

ianaNQResource: NamedNode = ianaMT(`${F_NQUADS}#Resource`)

Const ianaNTResource

ianaNTResource: NamedNode = ianaMT(`${F_NTRIPLES}#Resource`)

Const ianaPlainResource

ianaPlainResource: NamedNode = ianaMT(`${F_PLAIN}#Resource`)

Const ianaRDFXMLResource

ianaRDFXMLResource: NamedNode = ianaMT(`${F_RDF_XML}#Resource`)

Const ianaTTLResource

ianaTTLResource: NamedNode = ianaMT(`${F_TURTLE}#Resource`)

Const id

id: (Anonymous function) = rdfFactory.supports[Feature.idStamp]? (obj?: Term | Quad | any): number => (obj as any)?.id || noIdError(obj): (obj?: Term | Quad | any): number => rdfFactory.id(obj)
internal

Const ldNS

ldNS: (term: string) => NamedNode = createNS("http://purl.org/linked-delta/")

Type declaration

    • (term: string): NamedNode
    • Parameters

      • term: string

      Returns NamedNode

Const link

link: (term: string) => NamedNode = createNS("http://www.w3.org/2007/ont/link#")

Type declaration

    • (term: string): NamedNode
    • Parameters

      • term: string

      Returns NamedNode

Const ll

ll: (term: string) => NamedNode = createNS("http://purl.org/link-lib/")

Type declaration

    • (term: string): NamedNode
    • Parameters

      • term: string

      Returns NamedNode

Const memberPrefix

memberPrefix: string = rdf.ns("_").value

Const nsOWLsameAs

nsOWLsameAs: NamedNode = owl.sameAs

Const quadParts

quadParts: Array<keyof Omit<Quad, keyof IdTerm>> = ["subject","predicate","object","graph",]

Const schemaCW

schemaCW: NamedNode = schema.CreativeWork

Const schemaT

schemaT: NamedNode = schema.Thing

Const thingStatements

thingStatements: any[] = [rdfFactory.quad(schemaT, rdf.type, rdfs.Class),rdfFactory.quad(schemaT, rdfs.comment, rdfFactory.literal("The most generic type of item.")),rdfFactory.quad(schemaT, rdfs.label, rdfFactory.literal("Thing.")),]

Functions

Equatable

  • Equatable<BC>(base: BC): (Anonymous class) & BC

Indexable

  • Indexable<BC>(base: BC): (Anonymous class) & BC

add

allRDFPropertyStatements

  • allRDFPropertyStatements(obj: Quad[] | undefined, predicate: SomeNode): Quad[]
  • Filters {obj} to only include statements where the subject equals {predicate}.

    Parameters

    • obj: Quad[] | undefined

      The statements to filter.

    • predicate: SomeNode

      The subject to filter for.

    Returns Quad[]

    A possibly empty filtered array of statements.

allRDFValues

  • allRDFValues(obj: Quad[], predicate: SomeNode): Term[]
  • Filters {obj} on subject {predicate} returning the resulting statements' objects.

    see

    allRDFPropertyStatements

    Parameters

    Returns Term[]

anyRDFValue

  • anyRDFValue(obj: Quad[] | undefined, predicate: SomeNode): Term | undefined
  • Resolve {predicate} to any value, if any. If present, additional values are ignored.

    Parameters

    • obj: Quad[] | undefined
    • predicate: SomeNode

    Returns Term | undefined

applyMiddleware

Const assert

  • assert(obj: any): void

computeSearchIndices

contentTypeByExtention

  • contentTypeByExtention(ext: string): string

contentTypeByMimeString

  • contentTypeByMimeString(contentType: string, ext: string): string | undefined

convertToCacheKey

Const createProcessRDF

createStore

  • Initializes a {LinkedRenderStore} with tied together middleware.

    Type parameters

    • T

    Parameters

    • storeOpts: LinkedRenderStoreOptions<T>

      Constructor arguments for the LRS.

    • Default value middleware: Array<MiddlewareFn<any>> = []

      Main middleware, to be executed before the {linkMiddelware}.

    • Default value trailingMiddleware: Array<MiddlewareFn<any>> = []

      Middleware to be placed after the {linkMiddleware}. Note: defining trailing middleware causes actions not to be executed via {LinkedRenderStore#execActionByIRI} anymore, this behaviour can be enabled manually in one of the defined middlewares if still desired.

    Returns LinkedRenderStore<T>

dataToGraphTuple

Const deltaProcessor

  • deltaProcessor(addGraphIRIS: NamedNode[], replaceGraphIRIS: NamedNode[], removeGraphIRIS: NamedNode[], purgeGraphIRIS: NamedNode[], sliceGraphIRIS: NamedNode[]): (store: LowLevelStore) => StoreProcessor

doc

  • doc<T>(iri: T): T
  • Type parameters

    • T: NamedNode | BlankNode

    Parameters

    • iri: T

    Returns T

expandProperty

  • expandProperty(prop: NamedNode | Term | string | undefined, namespaces?: NamespaceMap): NamedNode | undefined
  • Expands a property if it's in short-form while preserving long-form. Note: The vocabulary needs to be present in the store prefix mapping

    Parameters

    • prop: NamedNode | Term | string | undefined

      The short- or long-form property

    • Default value namespaces: NamespaceMap = {}

      Object of namespaces by their abbreviation.

    Returns NamedNode | undefined

    The (expanded) property

Const failedRequest

filterIndex

findShortestIndex

Const getBasicStore

getContentType

  • Extracts the content type from a request. The content-type value has precedence if it contains a known type. Otherwise it returns the extension if present, or the content-type without the encoding.

    summary

    Extracts the content type from a request.

    Parameters

    Returns string

getHeader

getJSON

getPropBestLang

  • getPropBestLang<T>(rawProp: Quad | Quad[], langPrefs: string[]): T
  • Type parameters

    • T: Term

    Parameters

    • rawProp: Quad | Quad[]
    • langPrefs: string[]

    Returns T

getPropBestLangRaw

  • getPropBestLangRaw(statements: Quad | Quad[], langPrefs: string[]): Quad
  • Parameters

    • statements: Quad | Quad[]
    • langPrefs: string[]

    Returns Quad

getTermBestLang

  • getTermBestLang(rawTerm: Term | Term[], langPrefs: string[]): Term
  • Parameters

    • rawTerm: Term | Term[]
    • langPrefs: string[]

    Returns Term

getURL

handleStatus

isCallbackStore

  • isCallbackStore(store: any): store is CallbackStore

isDifferentOrigin

  • isDifferentOrigin(href: SomeNode | string): boolean
  • Checks if the origin of {href} matches current origin from {window.location}

    Parameters

    Returns boolean

    true if matches, false otherwise.

Const isInGraph

  • isInGraph(graphIRIS: NamedNode[]): (graph: Node) => boolean

isIterable

  • isIterable(o: any): o is any[] | Set<any>

isPending

isPlainObject

  • isPlainObject(o: any): o is DataObject

Const isRDFLibFetcher

  • isRDFLibFetcher(v: any): v is any

Const isRdfLibResponse

  • isRdfLibResponse(res: any): res is RDFLibFetcherResponse

Const linkMiddleware

  • linkMiddleware<T>(catchActions?: boolean): MiddlewareFn<T>
  • Binds various uris to link actions.

    see

    {createStore}

    Type parameters

    • T

    Parameters

    • Default value catchActions: boolean = true

      Set to true to catch all left-over actions to {LinkedRenderStore#execActionByIRI}.

    Returns MiddlewareFn<T>

linkedDeltaProcessor

list

match

Const matchSingle

  • matchSingle(graphIRI: NamedNode): (graph: Node) => boolean

Const noIdError

  • noIdError(obj: any): void

normalizeType

  • normalizeType<T1>(type: T1 | T1[]): T1[]

Const normalizedIds

  • normalizedIds<T>(item: T, defaultValue?: Node | undefined): number[]

patchRDFLibStoreWithOverrides

  • patchRDFLibStoreWithOverrides<T>(graph: any, changeBufferTarget: ChangeBuffer): T
  • Patch rdflib with memoized versions of terms by overriding certain object methods. For browsers that don't support Proxy.

    Type parameters

    • T: any

    Parameters

    Returns T

processDataObject

Private processObject

processResponse

  • processResponse(iri: string | NamedNode, res: Response): Quad[]
  • Saves response metadata into a graph.

    Parameters

    • iri: string | NamedNode

      The original iri that was fetched.

    • res: Response

      The (fetch) response object from the request.

    Returns Quad[]

    A graph with metadata about the response.

Const pushQuadruple

pushToMap

  • pushToMap<T>(map: {}, k: string, v: T): void
  • Pushes in-place value {v} onto an array under key {k} of Map {map}.

    Type parameters

    • T

    Parameters

    • map: {}

      The reference to the Map to add the data to.

      • [key: string]: T[]
    • k: string

      The key on {map}. An array is initialized when it doesn't yet exists.

    • v: T

      The value to push on the array under {k}.

    Returns void

quadByIndex

Const queuedDeltaStatus

sendMessage

seq

Const timedOutRequest

toGraph

  • Convert a DataObject into a graph. Useful for writing test data in semi-plain JS objects

    Parameters

    • iriOrData: SomeNode | DataObject

      The data object or an iri for the top-level object.

    • Optional data: DataObject

      The data object if an IRI was passed.

    • Optional store: LowLevelStore

      A graph to write the statements into.

    • Optional ns: NamespaceMap

      Namespace mapping for converting shortened keys.

    Returns ParsedObject

updateIndices

uploadIRI

  • uploadIRI(): NamedNode

Object literals

Const RDFLIB

RDFLIB: object

Implements the assumptions done by rdflib.js in various parts of their code.

axioms

axioms: any[] = [rdfFactory.quad(link.Document, subClassOf, Resource),rdfFactory.quad(ianaJSONResource, subClassOf, Resource),rdfFactory.quad(ianaJSONLDResource, subClassOf, Resource),rdfFactory.quad(ianaN3Resource, subClassOf, Resource),rdfFactory.quad(ianaNTResource, subClassOf, Resource),rdfFactory.quad(ianaNQResource, subClassOf, Resource),rdfFactory.quad(ianaPlainResource, subClassOf, Resource),rdfFactory.quad(ianaRDFXMLResource, subClassOf, Resource),rdfFactory.quad(ianaTTLResource, subClassOf, Resource),]

processStatement

processType

Const ld

ld: object

add

add: NamedNode = ldNS("add")

purge

purge: NamedNode = ldNS("purge")

remove

remove: NamedNode = ldNS("remove")

replace

replace: NamedNode = ldNS("replace")

slice

slice: NamedNode = ldNS("slice")

supplant

supplant: NamedNode = ldNS("supplant")

Const transformers

transformers: object

createProcessRDF

createProcessRDF: createProcessRDF

linkedDeltaProcessor

linkedDeltaProcessor: linkedDeltaProcessor

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