@jeswr/rdf-serialize-store
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

rdf-serialize-store.js

Serialise data from any iterable set of quads.

GitHub license npm version build Dependabot semantic-release

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @jeswr/rdf-serialize-store

Weekly Downloads

4

Version

1.1.1

License

MIT

Unpacked Size

6.59 kB

Total Files

5

Last publish

Collaborators

  • jeswr