Comunica SPARQL AMF is a SPARQL query engine for JavaScript that takes into account approximate membership functions.
This can be tested using the feature-handlers-amf-2
branch in the LDF Server.
This module is part of the Comunica framework.
$ yarn add @comunica/actor-init-sparql-amf
or
$ npm install -g @comunica/actor-init-sparql-amf
Show 100 triples from http://localhost:3000/dataset:
$ comunica-sparql-amf http://localhost:3000/dataset "CONSTRUCT WHERE { ?s ?p ?o } LIMIT 100"
Show the help with all options:
$ comunica-sparql-amf --help
Just like Comunica SPARQL,
a dynamic variant (comunica-dynamic-sparql-amf
) also exists.
Read more about querying from the command line.
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);
Read more about querying an application.
Start a webservice exposing http://localhost:3000/dataset via the SPARQL protocol, i.e., a SPARQL endpoint.
$ comunica-sparql-amf-http https://www.rubensworks.net/
Show the help with all options:
$ comunica-sparql-amf-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.
Generated using TypeDoc