The State of RDF in Ruby [closed]

主宰稳场 提交于 2019-11-28 17:58:56

Hey, Iaalto, I'm the author of the survey article that you mentioned. I've been thinking about doing a new survey.

A little has changed since I did the original survey, but not much. Here are a couple of things to consider:

  1. ActiveRDF seems to have gone the route of being a JRuby specific library. Several of their adapters are for Java only libraries. Not necessarily a problem, but something to be aware of.
  2. Reddy only has a memory based graph. Again, not necessarily a problem. I wouldn't discount Reddy for that (premature optimization), but I also wouldn't dream of storing billions of triples.
  3. I recently found a new set of Ruby bindings for Redland called RedLeaf. Not sure how mature it is, but it looks like Michael has been working on it for about a year. I hadn't heard of it until recently because it is off-grid (no RubyForge or GitHub project).
  4. I created a project on GitHub called RubyRDF (github.com/pjstadig/rubyrdf/tree/master). It doesn't have a ton of documentation, but it is mostly functional. It has a Sesame compatible adapter with support for transactions. I still have some ideas for future direction, and making it more feature complete, but not a lot of impetus to work on it. I'd welcome any contributions.

Bottom line: If JRuby is not a problem for you, then go with ActiveRDF, it is the most complete and mature. If memory based graph is not a problem, then the next most mature is probably Reddy.

I just wrote up a new survey article on Ruby and RDF. Some of my conclusions are:

  • There's a huge amount of activity surrounding RDF.rb, with over a score of database adapters, serialization/deserialization plugins, and interfaces to other libraries. Most of the recent object mappers have been built on top of RDF.rb, too.
  • The popular Redland RDF library has Ruby bindings, and it's actively maintained.
  • ActiveRDF was the premiere object mapper for RDF, but it no longer appears to be actively maintained.
  • The only recent, active object mapper at the moment appears to be Spira.
  • None of the object mappers are taking advantage of ActiveModel yet. This would be really slick, because it would provide much deeper integration between RDF and Rails.

There are also some interesting follow-up comments from the authors of RDF.rb and Spira. Ben Lavender, in particular, has thought a lot about how to sanely map RDF onto Ruby objects.

Personally I went for RDF.rb as their web site had OK documentation, and it was easy to get started with using the blog tutorials.

ActiveRDF seems like a larger project - but their wiki is down (actually the main page links to a copy of the wiki on archive.com) - and all the example talk about SPARQL queries.

Here's a simple triple lookup example, apologies for silly syntax as this was my first Ruby script:

require 'rubygems'
require 'rdf'
require 'rdf/raptor'

scufl2 = RDF::Vocabulary.new("http://ns.taverna.org.uk/2010/scufl2/ontology/")
dc = RDF::Vocabulary.new("http://purl.org/dc/elements/1.1/")

graph = RDF::Graph.load("../resources/workflows/example.ttl")
graph.query([nil, scufl2.workflow, nil]) do |bundle,p,workflow|
  graph.query([workflow, scufl2.name, nil]) do |wf,p,workflow_name|
    # Should just be one
    print workflow_name
  end
end

Unfortunately, like many Ruby and Python dependencies, this also needed some binaries to be able to read Turtle or RDF/XML. "aptitude install raptor-utils" took care of that, though.

I'm the author of Redland but I don't use Ruby myself. The ruby bindings probably still work (they passed the unit tests at the last release) but probably need some love for any newer ruby language changes.

Pure Ruby users I think have tried Active RDF which is more recent than the other things you suggest but focused on Rails.

Otherwise I suggest asking on the Semantic Web Interest Group IRC channel - #swig on irc.freenode.net

Edit: There's also Reddy http://github.com/tommorris/reddy/tree/master and other ruby rdf code on github if you look around.

Check out RDF.rb http://rdf.rubyforge.org/

AllegroGraph (RDF DB) has a Ruby Client - https://github.com/phifty/agraph

There is a Ruby Sesame library: http://github.com/tillsc/ruby-sesame

Sesame is one of the two most popular RDF frameworks for Java. We (Ontotext) develop a triple storage + built-in inference engine called OWLIM. We provide a free version called SwiftOWLIM.

Some of our users use it with Ruby through the above Ruby Sesame library.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!