New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

quadstore-sparql

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quadstore-sparql

A SPARQL engine for quadstore

latest
Source
npmnpm
Version
6.0.0
Version published
Maintainers
1
Created
Source

quadstore-sparql

quadstore-sparql is a SPARQL engine for quadstore.

Credits

quadstore-sparql is basically a wrapper around a specific configuration of the Comunica engine framework.

All credit goes to the wonderful team maintaining Comunica.

Current version

Current version: v6.0.0 [See on NPM].

quadstore-sparql is maintained alongside quadstore and versioned accordingly. Equal major version numbers imply compatibility between the two modules.

Notes

  • Uses Semantic Versioning. Pre-releases are tagged accordingly.
  • The master branch is kept in sync with NPM and all development work happens on the devel branch and/or issue-specific branches.
  • Requires Node.js >= 8.0.0.

Usage

SparqlEngine()

The constructor expects an instance of quadstore.RdfStore as its only argument.

const memdown = require('memdown');
const quadstore = require('quadstore');
const SparqlEngine = require('quadstore-sparql');

const rdfStoreInstance = new quadstore.RdfStore(memdown());
const sparqlEngineInstance = new SparqlEngine(store);

rdfStoreInstance.import();
sparqlEngineInstance.query('SELECT * WHERE {?s ?p ?o}', (err, result) => { 
  /* ... */
});

SparqlEngine.prototype.query()

The .query() method takes care of calling the .queryStream() method and then buffering all data emitted by the stream.

const queryString = 'SELECT *  WHERE { GRAPH ?g { ?s ?p ?o } }';
const resultFormat = 'application/sparql-results+xml';

const result = await sparqlEngineInstance.queryStream(queryString, resultFormat);
console.log(result);

Depending on the format argument, the returned item is either an array of quads/bindings or a string.

SparqlEngine.prototype.queryStream()

const queryString = 'SELECT *  WHERE { GRAPH ?g { ?s ?p ?o } }';
const resultFormat = 'application/sparql-results+xml';

const resultStream = await sparqlEngineInstance.queryStream(queryString, resultFormat);
resultStream.on('data', (chunk) => { /* ... */ });

Returns a stream.Readable that outputs the results of the query, formatted according to the data format specified as the second argument.

FormatDatatype of emitted chunks
nildictionary of bindings as RDF/JS' Term instances
comunicaraw @comunica/actor-init-sparql-rdfjs' result object
application/jsonsimple JSON serialization
application/sparql-results+xmlSPARQL-XML
application/sparql-results+jsonSPARQL-JSON
application/trigTrig
application/n-quadsN-Quads

Browser

For in-browser usage refer to quadstore's instructions on the same topic. This package uses @comunica/actor-init-sparql-rdfjs, which is a hefty package. Expect bundle sizes in the 1 - 2 MB range.

Keywords

node

FAQs

Package last updated on 05 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts