Changeset 483

Show
Ignore:
Timestamp:
06/02/10 18:54:56 (8 years ago)
Author:
samuraraujo
Message:
 
Location:
Explorator/trunk/vendor/plugins
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • Explorator/trunk/vendor/plugins/active_rdf/lib/active_rdf.rb

    r279 r483  
    55 
    66# determine the directory in which we are running depending on cruby or jruby 
    7 if RUBY_PLATFORM =~ /java/ 
     7if RUBY_PLATFORM =~ /xjava/ 
    88  # jruby can not follow symlinks, because java does not know the symlink concept 
    99  this_dir = File.dirname(File.expand_path(__FILE__)) 
     
    1414 
    1515# set the load path, which uses the running directory, but has to be different if running on jruby directly from source.  
    16 if RUBY_PLATFORM =~ /java/ and Gem::cache.search(/^activerdf$/).empty? 
     16if RUBY_PLATFORM =~ /xjava/ and Gem::cache.search(/^activerdf$/).empty? 
    1717  $: << this_dir + '/activerdf/lib/' 
    1818  $: << this_dir + '/activerdf/lib/active_rdf/' 
     
    4949        # we are not running as a gem 
    5050        $activerdflog.info 'ActiveRDF is NOT installed as a Gem' 
    51         if RUBY_PLATFORM =~ /java/ 
     51        if RUBY_PLATFORM =~ /xjava/ 
    5252          load_adapter this_dir + '/activerdf/activerdf-jena/lib/activerdf_jena/init' 
    5353          load_adapter this_dir + '/activerdf/activerdf-sparql/lib/activerdf_sparql/sparql' 
  • Explorator/trunk/vendor/plugins/active_rdf/lib/active_rdf/objectmanager/object_manager.rb

    r439 r483  
    1 require 'active_rdf' 
     1require 'active_rdf' unless PLATFORM =~ /java/ 
    22 
    33# Constructs Ruby classes for RDFS classes (in the right namespace) 
  • Explorator/trunk/vendor/plugins/activerdf_sparql-1.3.6/lib/activerdf_sparql/sparql_sesame_api.rb

    r482 r483  
    1 require 'rjb' 
     1require 'rjb' unless RUBY_PLATFORM =~ /java/ 
    22 
    33# SPARQL adapter 
    44class SparqlSesameApiAdapter < ActiveRdfAdapter 
     5   
     6  include Java if RUBY_PLATFORM =~ /java/ 
     7   
    58  $activerdflog.info "loading SPARQL SESAME API adapter" 
    69   
     
    3639      vmargs = [ '-Xms256m', '-Xmx1024m' ] 
    3740      vmargs << ('-Dinfo.aduna.platform.appdata.basedir=' + @sesamedir) 
    38    Rjb::load sesame_jars , vmargs 
    39        
     41 
     42      if RUBY_PLATFORM =~ /java/ 
     43        sesame_jars = sesame_jars.split(File::PATH_SEPARATOR) 
     44        sesame_jars.each{ |v| require v } 
     45      else       
     46        Rjb::load sesame_jars , vmargs 
     47      end 
     48             
    4049    rescue => ex 
    41       raise ex, "Could not load Java Virtual Machine. Please, check if your JAVA_HOME environment variable is pointing to a valid JDK (1.4+)." 
     50      raise ex, "Could not load Java Virtual Machine. Please, check if your JAVA_HOME environment variable is pointing to a valid JDK (1.4+). #{ex}" 
    4251       
    4352    rescue LoadError => ex 
     
    4554    end         
    4655     
    47     @bridge = Rjb::import('br.tecweb.explorator.SesameApiRubyAdapter').new(@repository) 
     56    if RUBY_PLATFORM =~ /java/ 
     57      @bridge = (import 'br.tecweb.explorator.SesameApiRubyAdapter').new(@repository) 
     58    else 
     59      @bridge = Rjb::import('br.tecweb.explorator.SesameApiRubyAdapter').new(@repository)   
     60    end   
    4861  end   
    4962  def size 
     
    5467  # may be called with a block 
    5568  def query(query, &block)     
    56     puts "Quering .. #{@title} "  
    5769    qs = Query2SPARQL.translate(query) 
    5870      
     
    6577      end  
    6678    end 
    67      
    6879    result = execute_sparql_query(qs, &block) 
    69 #   puts result 
    7080    add_to_cache(qs, result) if @caching 
    7181    result = [] if result == "timeout" 
     
    7888  def execute_sparql_query(qs, header=nil, &block)     
    7989    response = '' 
    80     begin      
    81       response = @bridge.query(qs.to_s)       
    82 #        puts response 
     90    begin  
     91       
     92      response = @bridge.query(qs.to_s) 
     93       
     94      #  puts response 
    8395    rescue  
    8496      raise ActiveRdfError, "JAVA BRIDGE ERRO ON SPARQL ADAPTER" 
     
    122134    #     
    123135    quad = [s,p,o,c].collect {|r| r.nil? ? nil : internalise(r) } 
    124     
     136    puts quad[0] 
     137    puts quad[1] 
     138    puts quad[2] 
     139    puts quad[3] 
    125140    response = @bridge.delete(quad[0],quad[1],quad[2],quad[3]) 
    126141