@prov4itdata/actor-init-sparql
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Comunica PROV4ITDaTa Init Actor

A custom Comunica query engine, configured to be used by the PROV4ITDaTa project.

Install

$ yarn add @prov4itdata/actor-init-sparql

or

$ npm install -g @prov4itdata/actor-init-sparql

Usage within application

This engine can be used in JavaScript/TypeScript applications as follows:

const newEngine = require('@comunica/actor-init-sparql-amf').newEngine;
const myEngine = newEngine();

const result = await myEngine.query(`
  SELECT * WHERE {
      ?s ?p ?o
  }`, {
  sources: ['http://localhost:3000/dataset'],
});

// Consume results as a stream (best performance)
result.bindingsStream.on('data', (binding) => {
    console.log(binding.get('?s').value);
    console.log(binding.get('?s').termType);

    console.log(binding.get('?p').value);

    console.log(binding.get('?o').value);
});

// Consume results as an array (easier)
const bindings = await result.bindings();
console.log(bindings[0].get('?s').value);
console.log(bindings[0].get('?s').termType);

// Log metadata containing source-level provenance information
const metadata = await result.metadata();
console.log(metadata)

Read more about querying an application.

Package Sidebar

Install

npm i @prov4itdata/actor-init-sparql

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

111 kB

Total Files

21

Last publish

Collaborators

  • pheyvaer
  • bjdmeest
  • gddmulde