ActiveRdfError: cannot execute query without data sources

I am playing around with LinkedData, RDF and SPARQL. That are the basics of the semantic web, the web 3.0.  ActiveRDF is a Ruby Framework for accessing LinkedData in a object oriented way. It is pretty cool. I installed the GEM on my MacBook Air:

gem install activerdf

And I installed the SPARQL Adapter:

gem install acitverdf_sparql

I started the ruby console to try the example from the front page of ActiveRDF. And I got this Exception:

ActiveRdfError: cannot execute query without data sources

The example from the ActiveRDF page does not work for me. I had to add one more line to make it work:

adapter.enabled = true

The full modified example is here:

require 'active_rdf'

adapter = ConnectionPool.add_data_source(:type => :sparql, :results => :sparql_xml, :engine => :virtuoso, :url => "http://dbpedia.org/sparql")
adapter.enabled = true
Namespace.register(:dbpedia, "http://dbpedia.org/ontology/")
tj = RDFS::Resource.new("http://dbpedia.org/resource/Thomas_Jefferson")
tj.dbpedia::birthPlace
tj.dbpedia::deathDate

query = Query.new.distinct(:o).where(tj, RDF::type, :o)
query.execute

This is working fine for me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s