Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@prefix : .
:a foaf:name "a" .
:b foaf:name "b" .
`).forEach(t => {
graph._store.addTriple(t)
})
const query = `
PREFIX foaf:
SELECT ?name
WHERE {
?s foaf:name ?name .
}`
// Creates a plan builder for the RDF dataset
const builder = new PlanBuilder(dataset)
// Get an iterator to evaluate the query
const iterator = builder.build(query)
// Read results
iterator.subscribe(bindings => {
console.log('Find solutions:', bindings.toObject())
}, err => {
console.error('error', err)
}, () => {
console.log('Query evaluation complete!')
})
db.put([triple1, triple2], () => {
const graph = new LevelRDFGraph(db)
const dataset = new HashMapDataset('http://example.org#default', graph)
const query = `
PREFIX foaf:
SELECT ?name
WHERE {
?s foaf:name ?name .
}`
// Creates a plan builder for the RDF dataset
const builder = new PlanBuilder(dataset)
// Get an iterator to evaluate the query
const iterator = builder.build(query)
// Read results
iterator.subscribe(bindings => {
console.log('Find solutions:', bindings.toObject())
}, err => {
console.error('error', err)
}, () => {
console.log('Query evaluation complete!')
})
})