Class: RdfContext::NTSerializer

Inherits:
AbstractSerializer show all
Defined in:
lib/rdf_context/serializer/nt_serializer.rb

Overview

Serialize RDF graphs in NTriples format

Instance Attribute Summary

Attributes inherited from AbstractSerializer

#base, #graph

Instance Method Summary collapse

Methods inherited from AbstractSerializer

#initialize, #relativize

Constructor Details

This class inherits a constructor from RdfContext::AbstractSerializer

Instance Method Details

#serialize(stream, base = nil)

This method returns an undefined value.

Serialize the graph

Parameters:

  • stream (IO, StreamIO)

    Stream in which to place serialized graph

  • options (Hash)

    a customizable set of options



9
10
11
12
13
# File 'lib/rdf_context/serializer/nt_serializer.rb', line 9

def serialize(stream, base = nil)
  @graph.triples.collect do |t|
    stream.write(t.to_ntriples + "\n")
  end
end