Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)