@jeswr/rdf-serialize-store
v1.1.1
Published
Serialise data from any iterable set of quads.
Downloads
27
Readme
rdf-serialize-store.js
Serialise data from any iterable set of quads.
Usage
import { Quad, Store, DataFactory } from 'n3';
import serialize from '@jeswr/rdf-serialize-store';
const { namedNode, literal, quad } = DataFactory;
const quads = [
quad(namedNode('http://example.org/subject'), namedNode('http://example.org/predicate'), namedNode('http://example.org/object')),
quad(namedNode('http://example.org/subject'), namedNode('http://example.org/predicate'), literal('object')),
];
// <http://example.org/subject> <http://example.org/predicate> <http://example.org/object>, "object".
await serialize(quads, { contentType: 'text/turtle' });
await serialize(new Store(quads), { contentType: 'text/turtle' });
// @prefix ex: <http://example.org/> .
// ex:subject ex:predicate ex:object, "object".
await serialize(quads, { contentType: 'text/turtle', prefixes: { ex: "http://example.org/" } });
License
©2024–present Jesse Wright, MIT License.