Open nichtich opened 1 year ago
Storing as documented:
#!/usr/bin/env node const N3 = require('n3') const { DataFactory } = N3 const { namedNode, literal, defaultGraph, quad } = DataFactory const store = new N3.Store() store.add( namedNode('http://ex.org/Pluto'), namedNode('http://ex.org/type'), namedNode('http://ex.org/Dog') ) store.add( namedNode('http://ex.org/Mickey'), namedNode('http://ex.org/type'), namedNode('http://ex.org/Mouse') ) // Retrieve all quads for (const quad of store) console.log(quad); console.log(store.size)
results in this output
Quad { id: '', _subject: DefaultGraph { id: '' }, _predicate: DefaultGraph { id: '' }, _object: DefaultGraph { id: '' }, _graph: DefaultGraph { id: '' } } 1
I don't understand the details of store.add vs. store.addQuad but the latter works:
store.add
store.addQuad
store.addQuad(quad( namedNode('http://ex.org/Pluto'), namedNode('http://ex.org/type'), namedNode('http://ex.org/Dog') )) store.addQuad(quad( namedNode('http://ex.org/Mickey'), namedNode('http://ex.org/type'), namedNode('http://ex.org/Mouse') ))
Storing as documented:
results in this output
I don't understand the details of
store.add
vs.store.addQuad
but the latter works: