Ruby RDF/XML Writer for RDF.rb

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 UTC