Class: RDF::Raptor::NTriples::Writer

Inherits:
Writer
  • Object
show all
Includes:
FFI
Defined in:
lib/rdf/raptor/ntriples.rb

Overview

N-Triples serializer.

Examples:

Obtaining an N-Triples writer class

RDF::Writer.for(:ntriples)       #=> RDF::Raptor::NTriples::Writer
RDF::Writer.for("output.nt")
RDF::Writer.for(file_name:      "output.nt")
RDF::Writer.for(file_extension: "nt")
RDF::Writer.for(content_type:   "text/plain")

Serializing RDF statements into an N-Triples file

RDF::Writer.open("output.nt") do |writer|
  graph.each_statement do |statement|
    writer << statement
  end
end

Constant Summary

Constants included from FFI

FFI::ENGINE

Instance Method Summary collapse

Methods included from FFI

#version

Instance Method Details

#write_term(value) ⇒ Object



92
93
94
# File 'lib/rdf/raptor/ntriples.rb', line 92

def write_term(value)
  V2.raptor_term_ntriples_write(value, @serializer.iostream)
end