Skip to content

Interface: IConnectedLdoDataset\<Plugins>

A ConnectedLdoDataset has all the functionality of a LdoDataset with the added functionality of keeping track of fetched remote Resources.

It is recommended to use the createConnectedLdoDataset to initialize this class.

Example

import { createConnectedLdoDataset } from "@ldo/connected";
import { ProfileShapeType } from "./.ldo/profile.shapeTypes.ts"

// At least one plugin needs to be provided to a ConnectedLdoDataset. In this
// example we'll use both the Solid and NextGraph plugins.
import { solidConnectedPlugin } from "@ldo/connected-solid";
import { nextGraphConnectedPlugin } from "@ldo/connected-nextgraph";

// ...

const connectedLdoDataset = createConnectedLdoDataset([
  solidConnectedPlugin,
  nextGraphConnectedPlugin
]);

const profileDocument = connectedLdoDataset
  .getResource("https://example.com/profile");
await profileDocument.read();

const profile = connectedLdoDataset
  .using(ProfileShapeType)
  .fromSubject("https://example.com/profile#me");

Type parameters

Name Type
Plugins extends ConnectedPlugin[]

Hierarchy

  • LdoDataset

IConnectedLdoDataset

Implemented by

Properties

dataset

Protected dataset: DatasetCore\<Quad, Quad>

Inherited from

LdoDataset.dataset

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:3


datasetCoreFactory

Protected datasetCoreFactory: DatasetCoreFactory\<Quad, Quad, DatasetCore\<Quad, Quad>>

Inherited from

LdoDataset.datasetCoreFactory

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:4


datasetFactory

Protected datasetFactory: DatasetFactory\<Quad, Quad, Dataset\<Quad, Quad>>

Inherited from

LdoDataset.datasetFactory

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:8


eventEmitter

Protected eventEmitter: EventEmitter\<DefaultEventMap>

Inherited from

LdoDataset.eventEmitter

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:9


transactionDatasetFactory

Protected transactionDatasetFactory: ITransactionDatasetFactory\<Quad>

Inherited from

LdoDataset.transactionDatasetFactory

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:10

Accessors

size

get size(): number

Returns

number

Inherited from

LdoDataset.size

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:26

Methods

[iterator]

[iterator](): Iterator\<Quad, Quad, undefined>

Returns

Iterator\<Quad, Quad, undefined>

Inherited from

LdoDataset.[iterator]

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:30


add

add(quad): this

Parameters

Name Type
quad Quad

Returns

this

Inherited from

LdoDataset.add

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:17


addAll

addAll(quads): this

Parameters

Name Type
quads Quad[] | Dataset\<Quad, Quad>

Returns

this

Inherited from

LdoDataset.addAll

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:14


addListener

addListener(eventName, listener): this

Parameters

Name Type
eventName QuadMatch
listener nodeEventListener\<Quad>

Returns

this

Inherited from

LdoDataset.addListener

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:20


bulk

bulk(changed): this

Parameters

Name Type
changed DatasetChanges\<Quad>

Returns

this

Inherited from

LdoDataset.bulk

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:15


contains

contains(other): boolean

Parameters

Name Type
other Dataset\<Quad, Quad>

Returns

boolean

Inherited from

LdoDataset.contains

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:8


createResource

createResource\<Name, Plugin>(name, createResourceOptions?): Promise\<ReturnType\<Plugin["createResource"]>>

Generates a random uri and creates a resource.

Type parameters

Name Type
Name extends any
Plugin extends ConnectedPlugin\<any, any, any, any, any>

Parameters

Name Type Description
name Name -
createResourceOptions? Plugin["types"]["createResourceOptions"] Some set of options specific to the plugin you've selected.

Returns

Promise\<ReturnType\<Plugin["createResource"]>>

A created resource or an error

Example

const profileDocument = await connectedLdoDataset
  .createResource("solid");

Defined in

packages/connected/src/IConnectedLdoDataset.ts:96


delete

delete(quad): this

Parameters

Name Type
quad Quad

Returns

this

Inherited from

LdoDataset.delete

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:18


deleteMatches

deleteMatches(subject?, predicate?, object?, graph?): this

Parameters

Name Type
subject? Term
predicate? Term
object? Term
graph? Term

Returns

this

Inherited from

LdoDataset.deleteMatches

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:16


difference

difference(other): Dataset\<Quad, Quad>

Parameters

Name Type
other DatasetCore\<Quad, Quad>

Returns

Dataset\<Quad, Quad>

Inherited from

LdoDataset.difference

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:10


emit

emit(eventName, changes): boolean

Parameters

Name Type
eventName QuadMatch
changes DatasetChanges\<Quad>

Returns

boolean

Inherited from

LdoDataset.emit

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:21


equals

equals(other): boolean

Parameters

Name Type
other Dataset\<Quad, Quad>

Returns

boolean

Inherited from

LdoDataset.equals

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:11


eventNames

eventNames(): QuadMatch[]

Returns

QuadMatch[]

Inherited from

LdoDataset.eventNames

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:22


every

every(iteratee): boolean

Parameters

Name Type
iteratee (quad: Quad, dataset: this) => boolean

Returns

boolean

Inherited from

LdoDataset.every

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:12


filter

filter(iteratee): Dataset\<Quad, Quad>

Parameters

Name Type
iteratee (quad: Quad, dataset: this) => boolean

Returns

Dataset\<Quad, Quad>

Inherited from

LdoDataset.filter

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:13


forEach

forEach(iteratee): void

Parameters

Name Type
iteratee (quad: Quad, dataset: this) => void

Returns

void

Inherited from

LdoDataset.forEach

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:14


forgetAllResources

forgetAllResources(): void

Removes all resources from memory

Returns

void

Example

connectedLdoDataset.forgetAllResources();

Defined in

packages/connected/src/IConnectedLdoDataset.ts:124


forgetResource

forgetResource(uri): boolean

Removes a resource from local memory

Parameters

Name Type Description
uri string the URI of the resource to remove

Returns

boolean

true if the resource was present before removal

Example

connectedLdoDataset.forgetResource("https://example.com/resource.ttl");

Defined in

packages/connected/src/IConnectedLdoDataset.ts:114


getMaxListeners

getMaxListeners(): number

Returns

number

Inherited from

LdoDataset.getMaxListeners

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:23


getResource

getResource\<Name, Plugin, UriType>(uri, pluginName?): GetResourceReturnType\<Plugin, UriType>

Retireves a representation of a Resource at the given URI. This resource represents the current state of the resource: whether it is currently fetched or in the process of fetching as well as some information about it.

Type parameters

Name Type
Name extends any
Plugin extends ConnectedPlugin\<any, any, any, any, any>
UriType extends string

Parameters

Name Type Description
uri UriType the URI of the resource
pluginName? Name optionally, force this function to choose a specific plugin to use rather than perform content negotiation.

Returns

GetResourceReturnType\<Plugin, UriType>

a Resource

Example

const profileDocument = connectedLdoDataset
  .getResource("https://example.com/profile");

Defined in

packages/connected/src/IConnectedLdoDataset.ts:72


has

has(quad): boolean

Parameters

Name Type
quad Quad

Returns

boolean

Inherited from

LdoDataset.has

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:29


import

import(stream): Promise\<IConnectedLdoDataset\<Plugins>>

Parameters

Name Type
stream Stream\<Quad>

Returns

Promise\<IConnectedLdoDataset\<Plugins>>

Inherited from

LdoDataset.import

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:15


intersection

intersection(other): Dataset\<Quad, Quad>

Parameters

Name Type
other Dataset\<Quad, Quad>

Returns

Dataset\<Quad, Quad>

Inherited from

LdoDataset.intersection

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:16


listenerCount

listenerCount(eventName): number

Parameters

Name Type
eventName QuadMatch

Returns

number

Inherited from

LdoDataset.listenerCount

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:24


listeners

listeners(eventName): nodeEventListener\<Quad>[]

Parameters

Name Type
eventName QuadMatch

Returns

nodeEventListener\<Quad>[]

Inherited from

LdoDataset.listeners

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:25


map

map(iteratee): Dataset\<Quad, Quad>

Parameters

Name Type
iteratee (quad: Quad, dataset: this) => Quad

Returns

Dataset\<Quad, Quad>

Inherited from

LdoDataset.map

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:17


match

match(subject?, predicate?, object?, graph?): Dataset\<Quad, Quad>

Parameters

Name Type
subject? null | Term
predicate? null | Term
object? null | Term
graph? null | Term

Returns

Dataset\<Quad, Quad>

Inherited from

LdoDataset.match

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:25


off

off(eventName, listener): void

Parameters

Name Type
eventName QuadMatch
listener nodeEventListener\<Quad>

Returns

void

Inherited from

LdoDataset.off

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:26


on

on(eventName, listener): this

Parameters

Name Type
eventName QuadMatch
listener nodeEventListener\<Quad>

Returns

this

Inherited from

LdoDataset.on

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:27


once

once(eventName, listener): this

Parameters

Name Type
eventName QuadMatch
listener nodeEventListener\<Quad>

Returns

this

Inherited from

LdoDataset.once

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:28


prependListener

prependListener(eventName, listener): this

Parameters

Name Type
eventName QuadMatch
listener nodeEventListener\<Quad>

Returns

this

Inherited from

LdoDataset.prependListener

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:29


prependOnceListener

prependOnceListener(eventName, listener): this

Parameters

Name Type
eventName QuadMatch
listener nodeEventListener\<Quad>

Returns

this

Inherited from

LdoDataset.prependOnceListener

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:30


rawListeners

rawListeners(eventName): nodeEventListener\<Quad>[]

Parameters

Name Type
eventName QuadMatch

Returns

nodeEventListener\<Quad>[]

Inherited from

LdoDataset.rawListeners

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:35


reduce

reduce\<A>(iteratee, initialValue?): A

Type parameters

Name Type
A unknown

Parameters

Name Type
iteratee (accumulator: A, quad: Quad, dataset: this) => A
initialValue? A

Returns

A

Inherited from

LdoDataset.reduce

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:18


removeAllListeners

removeAllListeners(eventName): this

Parameters

Name Type
eventName QuadMatch

Returns

this

Inherited from

LdoDataset.removeAllListeners

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:31


removeListener

removeListener(eventName, listener): this

Parameters

Name Type
eventName QuadMatch
listener nodeEventListener\<Quad>

Returns

this

Inherited from

LdoDataset.removeListener

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:32


removeListenerFromAllEvents

removeListenerFromAllEvents(listener): this

Parameters

Name Type
listener nodeEventListener\<Quad>

Returns

this

Inherited from

LdoDataset.removeListenerFromAllEvents

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:33


setContext

setContext\<Name, Plugin>(name, context): any

Sets conetext for a specific plugin

Type parameters

Name Type
Name extends any
Plugin extends ConnectedPlugin\<any, any, any, any, any>

Parameters

Name Type Description
name Name -
context Plugin["types"]["context"] the context for this specific plugin

Returns

any

Defined in

packages/connected/src/IConnectedLdoDataset.ts:132


setMaxListeners

setMaxListeners(n): this

Parameters

Name Type
n number

Returns

this

Inherited from

LdoDataset.setMaxListeners

Defined in

packages/subscribable-dataset/dist/SubscribableDataset.d.ts:34


some

some(iteratee): boolean

Parameters

Name Type
iteratee (quad: Quad, dataset: this) => boolean

Returns

boolean

Inherited from

LdoDataset.some

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:19


startTransaction

startTransaction(): LdoTransactionDataset

Returns

LdoTransactionDataset

Inherited from

LdoDataset.startTransaction

Defined in

packages/ldo/dist/LdoDataset.d.ts:10


toArray

toArray(): Quad[]

Returns

Quad[]

Inherited from

LdoDataset.toArray

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:20


toCanonical

toCanonical(): string

Returns

string

Inherited from

LdoDataset.toCanonical

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:21


toStream

toStream(): Stream\<Quad>

Returns

Stream\<Quad>

Inherited from

LdoDataset.toStream

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:22


toString

toString(): string

Returns

string

Inherited from

LdoDataset.toString

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:23


union

union(other): Dataset\<Quad, Quad>

Parameters

Name Type
other Dataset\<Quad, Quad>

Returns

Dataset\<Quad, Quad>

Inherited from

LdoDataset.union

Defined in

packages/dataset/dist/ExtendedDataset.d.ts:24


usingType

usingType\<Type>(shapeType): LdoBuilder\<Type>

Type parameters

Name Type
Type extends LdoBase

Parameters

Name Type
shapeType ShapeType\<Type>

Returns

LdoBuilder\<Type>

Inherited from

LdoDataset.usingType

Defined in

packages/ldo/dist/LdoDataset.d.ts:9