W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > August 2011

Re: loading rdf/xml from file

From: Gregg Kellogg <gregg@kellogg-assoc.com>
Date: Sat, 6 Aug 2011 11:31:59 -0400
To: Dan Brickley <danbri@danbri.org>
CC: "public-rdf-ruby@w3.org" <public-rdf-ruby@w3.org>
Message-ID: <D812AB3D-E515-4173-BE56-68BBC7805CC1@kellogg-assoc.com>
On Aug 6, 2011, at 4:45 AM, "Dan Brickley" <danbri@danbri.org> wrote:

> On 5 August 2011 18:45, Gregg Kellogg <gregg@kellogg-assoc.com> wrote:
>> Dan, you probably want to use the 'linkeddata' gem [1][2][3], which includes
>> RDF.rb and a bunch of parsers, including RDF::RDFXML. The decision was made
>> some time ago to leave RDF.rb lean, with only support for NTriples, and use
>> separate gems to add capabilities (RDFa, N3, RDF/XML, TriX, SPARQL, etc.).
>> The linkeddata gem basically exists to require the basic types.
>> Try the following:
>> require 'linkeddata'
>> g = RDF::Graph.load("http://greggkellogg.net/foaf.rdf", :format => :rdfxml)
>> :format is only necessary if it can't be intuited from the mime type or
>> extension.
> Thanks for the tip! Can you also explain this a bit more in
> http://rdf.rubyforge.org/ ? At the moment that page also gives
> impression of RDF.rb being a major Ruby hub for Linked Data apps, ...
> I had to ask to find out what to do.

I'm sure the documentation can be improved; the fact that the linked data documentation points to the same place also isn't useful.

I'll make some improvements in my fork, but I've had pull requests outstanding for 5 months; Arto controls it, but has been out of communication, I suppose due to pressures in starting Dydra. It's getting pretty frustrating, because I haven't been able to have a release of my SPARQL gem for all this time.

> Oh, second part of my question: how to load from a file in a
> subdirectory...:   graph = RDF::Graph.load("file:rdf/#{pid}.rdf")
> ...wasn't doing it... but when I removed the file: part, it was fine.
> Is it worth supporting file: URIs perhaps?

I'll look at this; it should be easy enough.

> Anyway, it's working now, thanks! I can get
> http://www.w3.org/2001/12/rubyrdf/intro.html updated if folks here
> give me suggestions for which newer things I should point to.
> Obviously RDF.rb and linkeddata gems; anything else?

There are a number of gems that for different readers and writers (N3/Turtle, RDFa 1.1, RDF/XML, TriX, RDF/JSON, JSON-LD, Microdata to name some). I also mentioned my SPARQL 1.0 implementation waiting in the wings. Additionally, there are repository adaptors for a number of commercial stores and other tools for using with native ruby objects. Ben may chime in with some more.

All are on GitHub, and most, if not all, use an unlicense and are in the public domain.

> Dan

Received on Saturday, 6 August 2011 15:32:31 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:02:15 UTC