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

1.3.0 • Public • Published

Comunica SPARQL OSTRICH Init Actor

Build Status npm version

A comunica SPARQL OSTRICH Init Actor for querying versioned triple stores with OSTRICH.

This module is part of the Comunica framework.

Install

OSTRICH requires ZLib, Kyoto Cabinet and CMake (compilation only) to be installed.

$ yarn add @comunica/actor-init-sparql-ostrich

Usage from the command line

Show 100 triples from version 1 from an OSTRICH store:

$ comunica-sparql-ostrich ostrichFile@myStore.ostrich "CONSTRUCT WHERE { GRAPH <http://graph.version.1> { ?s ?p ?o } } LIMIT 100"

Show 100 triples from the latest version from an OSTRICH store:

$ comunica-sparql-ostrich ostrichFile@myStore.ostrich "CONSTRUCT WHERE { ?s ?p ?o } LIMIT 100"

Show the help with all options:

$ comunica-sparql-ostrich --help

Read more about querying from the command line.

Usage within application

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

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

const result = await myEngine.query(`
  SELECT ?s ?p ?o WHERE {
    ?s ?p <http://dbpedia.org/resource/Belgium>.
    ?s ?p ?o
  } LIMIT 100`, {
  sources: [{ type: 'ostrichFile', value: 'myStore.ostrich' }],
});

// 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);

Read more about querying an application.

Usage as a SPARQL endpoint

Start a webservice exposing http://fragments.dbpedia.org/2015-10/en via the SPARQL protocol, i.e., a SPARQL endpoint.

$ comunica-sparql-ostrich-http ostrichFile@myStore.ostrich

Show the help with all options:

$ comunica-sparql-ostrich-http --help

The SPARQL endpoint can only be started dynamically. An alternative config file can be passed via the COMUNICA_CONFIG environment variable.

Use bin/http.js when running in the Comunica monorepo development environment.

Read more about setting up a SPARQL endpoint.

Package Sidebar

Install

npm i @comunica/actor-init-sparql-ostrich

Weekly Downloads

1

Version

1.3.0

License

MIT

Unpacked Size

12.1 kB

Total Files

14

Last publish

Collaborators

  • jeswr
  • joachimvh
  • rubensworks
  • rubenverborgh
  • dexagod