Sha256: fba18d39104f71d3d0c940da16e8e1a47965793c03fdc6fd90f38084926569f2

Contents?: true

Size: 546 Bytes

Versions: 5

Compression:

Stored size: 546 Bytes

Contents

require File.join(File.dirname(__FILE__), 'abstract_serializer')

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

5 entries across 5 versions & 1 rubygems

Version Path
rdf_context-0.5.9.1 lib/rdf_context/serializer/nt_serializer.rb
rdf_context-0.5.9 lib/rdf_context/serializer/nt_serializer.rb
rdf_context-0.5.8.2 lib/rdf_context/serializer/nt_serializer.rb
rdf_context-0.5.8.1 lib/rdf_context/serializer/nt_serializer.rb
rdf_context-0.5.7 lib/rdf_context/serializer/nt_serializer.rb