W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > June 2010

Ruby RDF/XML Writer for RDF.rb

From: Gregg Kellogg <gregg@kellogg-assoc.com>
Date: Sat, 12 Jun 2010 01:09:01 -0400
To: "public-rdf-ruby@w3.org" <public-rdf-ruby@w3.org>
Message-ID: <F1751B4C-6EE1-42C5-B6FA-A67DC1C25D86@kellogg-assoc.com>
I just pushed version 0.0.3 of rdf-rdfxml to Gemcutter and GitHub. It now passes W3C RDF/XML Parser tests (with some minor exceptions) and includes an RDF/XML Writer.

Basic usage is the same as for other RDF.rb writers:

RDF::RDFXML::Write.open("etc/test.rdf") do |writer|
writer.write_graph(graph)
end

or

RDF::RDFXML::Writer.buffer do |writer|
graph.each_statement do |statement|
writer << statement
end
end

Unlike other writers, RDF/XML waits for the entire graph to be built, so it is more efficient to use the write_graph version.

Both the Reader and Writer are essentially equivalent to the versions in RdfContext, which is pretty stable. As with the Reader, the Writer also makes use of Nokogiri for constructing the XML output.

Please report any anomalies either to the GitHub issues or to Lighthouse as indicated in the README..

Here are 0.0.3 r release notes:

* Added patches for the following:
  * RDF::Graph#properties
  * RDF::Graph#seq (Output rdf:Seq elements in order)
  * RDF::Graph#type_of
  * RDF::Literal.xmlliteral (Create literal and normalize XML)
  * RDF::Literal#xmlliteral?
  * RDF::Literal#anonymous? (missing from library)
  * RDF::Literal#to_s (only one of @lang or ^^type, not both)
  * RDF::URI#join (Don't add trailing '/')
* Reader fixes
* Writer complete
* Spec status
  * Isomorphic XMLLiteral tests fail due to attribute order variation
  * Reader parsing multi-line quite in NTriples test file fails due to lack of support in RDF::NTriples
  * A couple of URI normalizations fail:
    * should create <http://foo/> from <http://foo#> and ''
    * should create <http://foo/bar> from <http://foo/bar#> and ''
  * Writer test needs Turtle reader

Gregg
Received on Saturday, 12 June 2010 05:09:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 12 June 2010 05:09:52 GMT