Package Exports
- n-quads-parser
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (n-quads-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
NQuads parser
This is a basic, but fast pure-js n-quads parser. It has no dependencies to node and can be run in the browser without any additional packages.
Installation
yarn add n-quads-parser
npm i n-quads-parser
Usage
This was written as a faster n-quads parser for link-lib and designed to work with rdflib.js.
If you're looking for a way to build linked-data enabled RDF applications fast, check out link-redux.
RDFlib doesn't have (at the time of writing) dependency injection, one must either fork and modify rdflib or use our fork. Note that the latter has performance patches over the native RDFlib, but is also more strict in object creation.
Plain javascript:
import { IndexedFormula } from 'rdflib';
// Doesn't have to be from rdflib, check the parser file for the handful methods required
const store = new IndexedFormula();
const parser = new NQuadsParser();
fetch(url)
.then((req) => req.text())
.then((body) => parser.loadBuf(body));
// The statements should be loaded into the store.
TODO:
- Implement the whatwg streams interface
- Add the spec test suite