Sha256: 881451830b3e75d471e366fc54a9fc4f0701d9e689f264a557ea90e354424e0e

Contents?: true

Size: 1.81 KB

Versions: 1

Compression:

Stored size: 1.81 KB

Contents

module RDF::Raptor
  ##
  # Graphviz support.
  #
  # @example Requiring the `RDF::Raptor` module
  #   require 'rdf/raptor'
  #
  # @example Serializing RDF statements into a Graphviz file
  #   RDF::Writer.open("output.dot") do |writer|
  #     graph.each_statement do |statement|
  #       writer << statement
  #     end
  #   end
  #
  module Graphviz
    ##
    # Graphviz format specification.
    #
    # @example Obtaining a Graphviz format class
    #   RDF::Format.for(:graphviz)     #=> RDF::Raptor::Graphviz::Format
    #   RDF::Format.for("output.dot")
    #   RDF::Format.for(:file_name      => "output.dot")
    #   RDF::Format.for(:file_extension => "dot")
    #   RDF::Format.for(:content_type   => "text/vnd.graphviz")
    #
    # @see http://www.iana.org/assignments/media-types/text/vnd.graphviz
    class Format < RDF::Raptor::Format
      content_type     'text/vnd.graphviz', :aliases => ['application/x-graphviz', 'text/x-graphviz'], :extension => :dot # TODO: also .gv
      content_encoding 'utf-8'
      rapper_format    :dot

      writer { RDF::Raptor::Graphviz::Writer }
    end # Format

    ##
    # Graphviz serializer.
    #
    # @example Obtaining a Graphviz writer class
    #   RDF::Writer.for(:graphviz)     #=> RDF::Raptor::Graphviz::Writer
    #   RDF::Writer.for("output.dot")
    #   RDF::Writer.for(:file_name      => "output.dot")
    #   RDF::Writer.for(:file_extension => "dot")
    #   RDF::Writer.for(:content_type   => "text/vnd.graphviz")
    #
    # @example Serializing RDF statements into a Graphviz file
    #   RDF::Writer.open("output.dot") do |writer|
    #     graph.each_statement do |statement|
    #       writer << statement
    #     end
    #   end
    #
    class Writer < RDF::Raptor::Writer
      format RDF::Raptor::Graphviz::Format
    end # Writer
  end # Graphviz
end # RDF::Raptor

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rdf-raptor-0.4.1 lib/rdf/raptor/graphviz.rb