2.0.1 • Published 3 months ago

rdf-store-stream v2.0.1

Weekly downloads
3,289
License
MIT
Repository
github
Last release
3 months ago

RDF Store Stream

Build status Coverage Status npm version

This package exposes a convenience function that allows RDF(JS) streams to be encapsulated into an RDF(JS) store.

The Store that will be returned is the default store from rdf-stores.

This library accepts RDFJS-compliant quads.

Installation

$ yarn install rdf-store-stream

This package also works out-of-the-box in browsers via tools such as webpack and browserify.

Require

import {storeStream} from "rdf-store-stream";

or

const storeStream = require("rdf-store-stream").storeStream;

Usage

Short example:

const store = await storeStream(quadStream);

Full example:

// Create an RDF stream
import rdfParser from "rdf-parse";
const quadStream = rdfParser.parse(fs.createReadStream('cartoons.ttl'), { contentType: 'text/turtle' });

// Import the stream into a store
const store = await storeStream(quadStream);

// Use the store
const resultStream = store.match(namedNode('http://example.org/subject'));

License

This software is written by Ruben Taelman.

This code is released under the MIT license.