A fast and simple SPARQL query interface for Linked Data Fragments and hyper-graph-db.
Note: This is a fork of Linked Data Fragments Client which includes only the code for the sparql interator. It has been modified to accept hyper-graph-db as a client.
npm install sparql-iterator
First, create or connect to a HyperGraph representation of a dataset.
Then create a SparqlIterator to evaluate SPARQL queries on that dataset.
varSparqlIterator=require('sparql-iterator');varhypergraph=require('hyper-graph-db');vargraph=newhypergraph(storage,key);varquery='SELECT * { ?s ?p <http://dbpedia.org/resource/Belgium>. ?s ?p ?o } LIMIT 100',results=newSparqlIterator(query,{hypergraph: graph});results.on('data',function(result){console.log(result);});Returns a new stream of results. Expects query to be a valid SPARQL query as a string or an object representing a parsed query (refer to SPARQL.js).
Expects options argument to be an object passing in the client to use.
Either:
{hypergraph: instanceofHyperGraph,}or:
{fragmentsClient: aninstanceofLinkedDataFragementsClient,}A data event is fired for each new result that matches the SPARQL query.
A end event is fired when the query has completed.
A error event is fired when an error has occurred.