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.