Skip to content

jacoscaz/quadstore-browser

Repository files navigation

Using quadstore in browsers

This project serves as a reference for developers looking to use quadstore in web browsers.

The webpack.config.js file contains the reference configuration for Webpack 5.x that is used to transform dist/bundle.js (initially produced by the TypeScript compiler) into an actual bundle ready for use in browsers as an ES module.

The bundle contains quadstore, the quadstore-comunica SPARQL query engine, the browser-level backend for persistent storage via IndexedDB and rdf-data-factory, an implementation of the RDF/JS DataFactory interface.

package version
quadstore 13.1.0
quadstore-comunica 4.2.0
browser-level 1.0.1
rdf-data-factory 1.1.2

The static/index.html page and associated dist/main.js script provide a small demonstration of how to use all of the above.

The bundle file is also served at https://cdn.jsdelivr.net/gh/jacoscaz/quadstore-browser/dist/bundle.js and can be used in webpages as follows:

<script type="module">
    import {
        Quadstore,
        Engine,
        BrowserLevel,
        DataFactory,
    } from 'https://cdn.jsdelivr.net/gh/jacoscaz/quadstore-browser/dist/bundle.js';
    const backend = new BrowserLevel('quadstore');
    const dataFactory = new DataFactory();
    const store = new Quadstore({ backend, dataFactory });
    const engine = new Engine(store);
    await store.open();
    await store.clear();
    await store.put(dataFactory.quad(dataFactory.namedNode('ex://s'), dataFactory.namedNode('ex://p'), dataFactory.namedNode('ex://o')));
    const stream = await engine.queryBindings(`SELECT * WHERE { ?s ?p ?o }`);
    stream.on('data', console.log);
</script>

How to build

npm install
npm run build

Issues

Issues should be reported in quadstore's issue tracker.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published