rdf-dataset-ext
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/rdf-dataset-ext package

1.1.0 • Public • Published

rdf-dataset-ext

build status npm version

Util functions for easier RDF/JS DatasetCore handling.

Usage

All provided functions can be imported as properties of the package or directly from the file matching the function name.

Import addAll from property:

const { addAll } = require('rdf-dataset-ext')

Import addAll from file:

const addAll = require('rdf-dataset-ext/addAll')

addAll(dataset, iterable)

Iterates over iterable and adds all quads to dataset by calling .add for each quad. Returns the given dataset.

deleteMatch(dataset, subject, predicate, object, graph)

Deletes all quads in the given dataset which match the given subject, predicate, object, graph pattern. .match of dataset is used to find the matches and .delete to delete all matches. Returns the given dataset.

equals(a, b)

Tests if the datasets a and b contain the same quads without doing a normalization step beforehand. That means Blank Node labels must also match. The comparison is done by testing .size of both dataset for equality and by looping over all quads of a and check if b contains it using the .has method. Returns true if both datasets are equal. Otherwise false is returned.

async fromStream(dataset, stream)

Adds all quads from stream till the stream is finished. Errors emitted by the stream are forwarded as Promise rejects. Returns the given dataset.

toCanonical(dataset)

Returns the canonical representation of the dataset as string.

toStream(dataset)

Creates a Stream which emits all quads of the given dataset. Returns the created stream.

Package Sidebar

Install

npm i rdf-dataset-ext

Weekly Downloads

1,404

Version

1.1.0

License

MIT

Unpacked Size

16.1 kB

Total Files

17

Last publish

Collaborators

  • bergos