How to use the sparql-engine.Pipeline.getInstance function in sparql-engine

To help you get started, we’ve selected a few sparql-engine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Callidon / sparql-engine / examples / levelgraph.js View on Github external
evalBGP (bgp) {
    // Connect the Node.js Readable stream
    // into the SPARQL query engine using the fromAsync method
    return Pipeline.getInstance().fromAsync(input => {
      // rewrite variables using levelgraph API
      bgp = bgp.map(t => {
        if (t.subject.startsWith('?')) {
          t.subject = this._db.v(t.subject.substring(1))
        }
        if (t.predicate.startsWith('?')) {
          t.predicate = this._db.v(t.predicate.substring(1))
        }
        if (t.object.startsWith('?')) {
          t.object = this._db.v(t.object.substring(1))
        }
        return t
      })
      // Evaluates the BGP using Levelgraph stream API
      const stream = this._db.searchStream(bgp)

sparql-engine

A framework for building SPARQL query engines in Javascript

MIT
Latest version published 2 years ago

Package Health Score

39 / 100
Full package analysis