Reading RDF data in the N-Triples format

RDF::Reader.open("http://rdf.rubyforge.org/doap.nt") do |reader|
reader.each_statement do |statement|
puts statement.inspect
end
end

Reading RDF data in other formats

{RDF::Reader.open} and {RDF::Repository.load} use a number of mechanisms to determine the appropriate reader
to use when loading a file. The specific format to use can be forced using, e.g. :format => :ntriples
option where the specific format symbol is determined by the available readers. Both also use
MimeType or file extension, where available.

require 'rdf/nquads'
RDF::NQuads::Reader.open("http://rdf.rubyforge.org/doap.nq") do |reader|
reader.each_statement do |statement|
puts statement.inspect
end
end

Reader/Writer implementations may override {RDF::Format.detect}, which takes a small sample if input
and return a boolean indicating if it matches that specific format. In the case that a format cannot
be detected from filename or other options, or that more than one format is identified,
{RDF::Format.for} will query each loaded format by invoking it's detect method, and the first successful
match will be used to read the input.

Writing RDF data using other formats

{RDF::Writer.open}, {RDF::Enumerable#dump}, {RDF::Writer.dump} take similar options to {RDF::Reader.open} to determine the
appropriate writer to use.