Category Archives: Ruby

Implementing CSV on the Web

As I blogged about before, I’ve implemented the current drafts of [CSV on the Web][] in the [rdf-tabular gem][]. The gem is is available from [rdf-tabular repo][] and is in the public domain (Unlicense) and is freely usable by anyone wishing to get a start on their own implementation. For those wishing to take an incremental approach, this post describes the basic workings of the gems, highlights more advanced cases necessary to pass the [Test Suite][] and attempts to provide some insight into the process of implementing the specifications. Read More…

CSV on the Web

As many who follow me know, I’ve long been involved in the Linked Data and Semantic Web movements. It’s been my privilege to work on several successful projects, notably [RDFa][1], [Microdata RDF][2], and [JSON-LD][3]. For the past several months I’ve actively been working with the W3C [CSV on the Web][4] Working Group to help define a mechanism for transforming tabular data into RDF and JSON.

Read More…

Release 1.1.0 of Ruby RDF libraries

I’m happy to announce release 1.1.0 of the Ruby RDF suite, this includes support for RDF 1.1 Concepts and syntaxes, including RDF Literal changes, N-Triples, N-Quads, TriG and JSON-LD. Additionally, the SPARQL gem has been updated to support RDF 1.1 differences (mainly differences in plain literals vs those with xsd:string datatypes and the fact that language-tagged literals now have the rdf:langString datatype).

RDF.rb and SPARQL gem updates

RDF.rb and SPARQL updates

Version 1.0.6 of RDF.rb and 1.0.7 of SPARQL gems released.

RDF.rb 1.0 Release

I’m happy to announce the 1.0 release of RDF.rb and related Ruby gems. This release has been a long time coming, and the library has actually been quite stable for some time.

JSON-LD and MongoDB

For the last several months, I’ve been engaged in an interesting project with Wikia. Wikia hosts hundreds of thousands of special-interest wikis for things as varied as pokemon, best cellphone rate comparisons, TV shows and Video Games.

BrowserID versus DDOS

BrowserID vs DDOS

How BrowserID saved the RDFa Test Suite from a DDOS (Distributed Denial of Service Attack).

The Use of JSON-LD in the RDFa Test Harness

This article is the second in a three-part series on implementing the RDFa Test Suite. The first article discussed the use of Sinatra, Backbone.js and Bootstrap.js in creating the test harness. In this article, we focus on JSON-LD, a Linked Data technology that complements RDFa is creating modern Web applications.

A new RDFa Test Harness

A new RDFa Test Harness

Implementing the RDFa Test Suite as a modern Web application using Sinatra, Backbone.js and Bootstrap.js.

RDF.rb 0.3.5 and SPARQL 0.1.0

I added some minor updates to RDF.rb and re-issued versions 0.3.5 for the rdf and linkeddata gems. These updates are mostly to better support HTTP content negotaion and to find appropriate readers and writers based on file extension, mime-type, and content sniffing. There are also some minor fixes to aid jRuby and Ruby 1.9.3 support.

SPARQL 1.0 for Ruby

I’ve just released version 0.0.2 of the Ruby sparql gem. This version is based on earlier work by Pius and Arto and incorporates from SPARQL Grammar and SPARQL Algebra. Further documentation is available here.

rdf.rb 0.3.4 released

After several months of gathering updates for RDF.rb, we’ve released version 0.3.4 with several new features:

RDF::RDFa update with vocabulary expansion, RDF collections and more

I’ve updated RDF::RDFa with updates from recent changes to RDF Core:

RDF::N3 no longer accepts text/turtle or :ttl

With the release of RDF::Turtle, starting with version 0.3.5, RDF::N3 no longer asserts that it is a reader for Turtle. This includes MIME Types text/turtle, application/turtle, application/x-turtle. Or the .ttl extension or :ttl or :turtle formats. Of course, N3 remains reasonably compatible with Turtle, but the recent RDF 1.1 Working Group publication of the Turtle Specification has caused some divergence.

Microdata parser for RDF.rb

I’ve just release version 0.1.0 of the RDF::Microdata gem (rubygems, github) for the RDF.rb suite. This version contains only a reader (parser). Writing is not supported at this point.

SPARQL Algebra

For those intrepid enough, I’ve pushed version 0.0.2 of sparql-algebra. It relies on unreleased changes to RDF.rb and sxp-ruby, so you need to use bundler with the included Gemfile.

RDF::RDFa, RDF::RDFXML, and RDF::N3 0.3.0 releases

The Nokogiri-based reader suite for the RDF.rb environment. This version offers substantial performance gains, due to general improvements in RDF.rb as well as a number of improvements in the readers:

RdfContext and RDF::RDFa support for RDFa 1.1 2008-08-03 draft semantics

 I’ve updated both RdfContext and RDF::RDFa gems to support the latest RDFa Core 1.1 Editor’s Draft  (2010-08-03) semantics. This includes support for the following:

RdfContext version 0.5.4 with provisional RDFa 1.1 support

I just released version 0.5.4 of RdfContext to GitHub and GemCutter. This version is notable for including support for RDFa 1.1 parsing. This is still based on an Working Draft, so it will likely change in the future.

RdfContext version 0.5.1 brings Turtle and enhanced RDF/XML serializers

Just pushed version 0.5.1 of RdfContext to GitHub and Gemcutter. This version includes a Serializer framework, including a AbstractSerializer, RecursiveSerializer and Turtle and RDF/XML serializers based on these. The RDF/XML serializer is a big improvement over the previous version, including Typed element names an RDF Container folding using parseType="collection".

RdfContext version 0.5.0 brings compliant notation-3/turtle parsing

This version of 0.5.0 adds support for Ruby 1.9 and 1.8.6 in addition to 1.8.7. Full unicode character escapes are supported in Ruby 1.9. The N3 parser has been substantially re-written and updated to be compliant with W3C SWAP, CWM and Turtle test suites, although it is supported only to the N3-rdf level, with variables and formulae not yet supported.

RdfContext gem version 0.4.5 pushed

Bug fixes and minor API changes:

RdfContext gem released

I’ve released version 0.4.4 of the RdfContext gem. As the name implies, RdfContext supports contextual data-stores bound to graphs, along with a ConjunctiveGraph providing the union of contexts within a given data-store.

RSpec soft failure for pending test cases

Recently, I’ve been playing with RSpec to run RDFa test cases. The suite has accepted and unreviewed test cases. My general way of testing is to parse the suite, and run each test through a generated spec as follows:

rdfa_parser gem released

I just released version 0.1.0 of the rdfa_parser_gem. This parser is written in Ruby and uses Nokogiri XML parsing. It passes all XHTML1 test cases and most of the existing test cases for HTML4 and HTML5.

HTTP Digest Authentication in Rails 2.3

After a fair amount of work, I’m happy to report that HTTP Digest Authentication is now a part of Rails 2.3. Although I put the finishing touches to get this into the release, it is based on work done by Dan Manges and Xavier Shay . Also, thanks to Don Parish for bug fixes and improvements after original acceptance.

Restful action caching

Caching actions without layout can be complicated when multiple request formats are used. In particular, an HTML response may use a dynamic layout, in which case you want to use the :layout => false option. However, other formats (such as XML) don’t use a layout, but the :layout => false option to _caches_action_ does not properly cache the body in this case. To solve the problem, create two caches action statements:

Detecting action caching within controller

Rails offers three forms of caching within your controller: page, action and fragment. Page caching results in the fastest access times, as the results of the first call to an action are saved in a file so that subsequent accesses never even hit rails. However, for most applications, this isn’t useful, as there may be dynamic content on a page, and this does not allow for authentication. Fragment caching is the most detailed, and allows different parts of a page to be cached and allows you to check for the presence of a cached fragment within your controller (or view), but it requires the most maintenance of cache keys. Action caching is a nice compromise between the two. It allows the controller to get into the action but takes care of cache key creation. It also allows for a dynamic layout using the :layout option. However, in some actions, the amount of work done by the controller may be non-trivial, so it would be nice to check for the presence of the cache within the body of the controller action. This can be solved by borrowing some code from within ActionController::Caching::Actions.

Automatically generate in_place_editor_for

Recently, I was creating some in_place_editors for a polymorphic controller I’m working on. Although the problems not particular to polymorphic controllers, I didn’t want to embed too much model information within the controller. I came up with a way to use meathod_missing to define the in_place_editor_for on demand:


Related to the interesting talk at a recent NBRug meeting on Ruport, I’ve been looking at doing data warehousing in Ruby. Fortunately, Anthony Eden has beaten me to the punch with ActiveWarehouse. For those unfamiliar with Data Warehousing, the concepts are basically to create a series of facts that are indexed buy multiple dimensions.

Observers in Rails 1.2

Thanks to Rick Olson for providing assistance with the proper syntax for instantiating observers in Rails 1.2. The old way was to add an observer statement to the appropriate controller, such as:

Eager Finder SQL

EagerFinderSql allows custom SQL to be specified when doing eager loading of associations through the :include option to find. This allows for purpose-constructed queries to be used and still result in a fully linked object model.