[Activerdf] Rails and ActiveRDF

Eyal Oren eyal.oren at deri.org
Tue Aug 29 12:10:58 IST 2006


On 08/29/06/08/06 12:08 +0200, Ingo Paulsen wrote:
>My ruby module path is /usr/local/lib/ruby/1.8 (Mac OS X 10.4.7, Ruby  
>1.8.5). I copied faceted.rb into this path and also the src directory  
>like so:
>
>/usr/local/lib/ruby/1.8/faceted.rb
>/usr/local/lib/ruby/1.8/src
I'm not sure where faceted.rb comes from? Or did you mean faceteer.rb?

The way I usually set this up is the following:
Check out faceteer-engine directory somewhere, say
/home/eyal/faceteer-engine

Then put a symlink to faceteer-engine/faceteer.rb in /usr/lib/ruby/1.8:
/usr/lib/ruby/1.8/faceteer.rb -> /home/eyal/faceteer-engine/faceteer.rb

Then ruby can find faceteer.rb (because it is in the load-path), and inside 
faceteer.rb we automatically include all the necessary stuff from 
/home/eyal/faceteer-engine/src.

Try that.
Sorry for not writing this up before, browserdf.org was not really meant as 
installable software, but it is currently the only real-life example I have 
of rails+activerdf.

>Is this okay? For getting started do I have to replace localhost with  
>browserdf.com in database.yml?
yes.

>0. tomcat with YARS in it (e.g. http://localhost:8080/yars/context/ test 
>works for me)
>1. rails browserdf
>2. changed environment.rb as mentioned above
>3. changed database.yml for using YARS data-store
>4. tried to start the server WEBrick get this error messages  
>(starting WEBrick with a simple MySQL connection works fine.)
this is indeed the good way to figure out the problem. I think your problem 
is that (1) you didnt start the memcache server (it runs as a separate 
server), and (2) you maybe used the wrong memcache gem (there are two 
running around, I linked to the correct one from the wiki).

The easiest thing is to actually not use memcache to start with, as I did 
in the attached environment.rb. I'd advise memcache for real applications, 
but to get started, just comment it out.

Let's see if this helps...

 -eyal
-------------- next part --------------
# Be sure to restart your web server when you modify this file.

# Uncomment below to force Rails into production mode when 
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
#require 'memcache'
#memcache_options = {
#	:compression => false,
#	:debug => false,
#	:namespace => "app-#{RAILS_ENV}",
#	:readonly => false,
#	:urlencode => false
#}
#
#memcache_servers = [ 'localhost' ]
#CACHE = MemCache.new memcache_options
#CACHE.servers = memcache_servers
#CACHE.flush_all

#$logger = Logger.new(STDOUT)

Rails::Initializer.run do |config|
  # Skip frameworks you're not going to use
  config.frameworks -= [:active_record]

  # Add additional load paths for your own custom dirs
  config.load_paths += %W( "#{RAILS_ROOT}/lib/activerdf" )

	#config.action_controller.session_store = :mem_cache_store
	#config.action_controller.fragment_cache_store = :mem_cache_store, memcache_servers, memcache_options


	# TODO find out the right version: development/testing/etc.
	yaml = YAML::load_file config.database_configuration_file
	yaml = yaml['development']
	require 'active_rdf'
	NodeFactory.connection yaml.symbolize_keys
	
	#cache_params = *([memcache_servers, memcache_options].flatten)
	#ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.merge!({ 'cache' => CACHE })
	nil
end



More information about the Activerdf mailing list