Class: RDF::Raptor::Turtle::Writer

Inherits:
Writer
  • Object
show all
Defined in:
lib/rdf/raptor/turtle.rb

Overview

Turtle serializer.

Examples:

Obtaining a Turtle writer class

RDF::Writer.for(:turtle)       #=> RDF::Raptor::Turtle::Writer
RDF::Writer.for("output.ttl")
RDF::Writer.for(file_name:      "output.ttl")
RDF::Writer.for(file_extension: "ttl")
RDF::Writer.for(content_type:   "text/turtle")

Serializing RDF statements into a Turtle file

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