Skip to content

Repository files navigation

Sparql Iterator

Build StatusCoverage Status

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.

Installation

npm install sparql-iterator

Simple Use

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

API

var stream = new SparqlIterator(query, options);

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,}

stream.on('data', cb)

A data event is fired for each new result that matches the SPARQL query.

stream.on('end', cb)

A end event is fired when the query has completed.

stream.on('error', cb)

A error event is fired when an error has occurred.

About

A stream interface for SPARQL queries.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages