Skip to content
Thomas Bergwinkl edited this page Mar 21, 2016 · 4 revisions

Parse triples from file triples.nt and forward them to the graph.

var parser = new N3Parser(fs.createReadStream('triples.nt'))
var graph = new Graph()

var stream = parser.read()

stream.once('end', function () {
  console.log('done')
})

graph.write(stream)

Parse triples from file triples.nt and forward only the triples matching the sp pattern to the graph.

var parser = new N3Parser(fs.createReadStream('triples.nt'))
var graph = new Graph()

var stream = parser.read(
  rdf.iri('http://example.org/subject'),
  rdf.iri('http://example.org/predicate'))

stream.once('end', function () {
  console.log('done')
})

graph.write(stream)
Clone this wiki locally