Changeset 213

Show
Ignore:
Timestamp:
12/13/08 11:53:05 (9 years ago)
Author:
samuraraujo
Message:
 
Location:
Explorator/trunk/lib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • Explorator/trunk/lib/dataload.rb

    r197 r213  
    2323#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://localhost:8181/org.semanticdesktop.services.rdfrepository/repositories/main", :results => :sparql_xml, :caching =>true 
    2424#adapter.title='NEPOMUK_SPARQL' 
     25 
     26 
     27adapter =ConnectionPool.add_data_source :type => :sparql_sesame_api ,  :caching =>true 
     28adapter.title='EXPLORATOR_DEFAULT' 
    2529 
    2630adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://localhost:8080/openrdf-sesame/repositories/NOKIA", :results => :sparql_xml, :caching =>true 
  • Explorator/trunk/lib/query_builder.rb

    r206 r213  
    1111#Date: 25 jun 2008. 
    1212require 'active_rdf' 
     13require 'rjb' 
    1314class SemanticExpression 
    1415  #:result - It is a array of RDFS::Resource. 
     
    6970  #adds keyword query to the expression 
    7071  def search (word) 
    71     begin        
    72       x = URI.parse(word)   
    73       x.schema 
     72    if  word.index('http://')      
    7473      k = RDFS::Resource.new(word) 
    7574      spo(k,:p,:o) 
    7675     # spo(:s,k,:o) 
    7776     # spo(:s,:p,k)     
    78     rescue  
     77  else 
    7978     #not URI 
    8079      @result = @result | Query.new.distinct(:s,:p,:o).where(:s,:p,:o).keyword_where(:o,word).execute     
    8180    end   
     81    self 
     82  end 
     83  def go(uri) 
     84    adapter = ConnectionPool.adapters.select {|adapter|  
     85       adapter.title == 'EXPLORATOR_DEFAULT' 
     86    } 
     87    adapter.first().bridge.loaduri(uri, false);    
     88    @result = @result | Query.new.distinct(:s,:p,:o).where(:s,:p,:o,RDFS::Resource.new(uri)).execute 
    8289    self 
    8390  end