Sha256: ebea62f5fc25990ca8ec979033e448a5e3c66d6be6f1b5e5c34ce493492adb16

Contents?: true

Size: 480 Bytes

Versions: 2

Compression:

Stored size: 480 Bytes

Contents

module RdfContext
  # Serialize RDF graphs in NTriples format
  class NTSerializer < AbstractSerializer
    # Serialize the graph
    #
    # @param [IO, StreamIO] stream Stream in which to place serialized graph
    # @option options [URIRef, String] :base (nil) Base URI of graph, used to shorting URI references
    # @return [void]
    def serialize(stream, base = nil)
      @graph.triples.collect do |t|
        stream.write(t.to_ntriples + "\n")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rdf_context-0.5.11 lib/rdf_context/serializer/nt_serializer.rb
rdf_context-0.5.10 lib/rdf_context/serializer/nt_serializer.rb