Changeset 386

Show
Ignore:
Timestamp:
03/31/09 15:43:44 (9 years ago)
Author:
samuraraujo
Message:
 
Location:
Explorator/trunk/lib
Files:
1 added
3 modified

Legend:

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

    r376 r386  
    66#Author: Samur Araujo 
    77#Date: 25 jun 2008. 
    8  
    98require 'active_rdf'  
    109def createdir(dir) 
     
    2726$sesamedir.each  do |x|  
    2827   
    29   if x.rindex('.') == nil && x!= ('SYSTEM') && x!= ('INTERNAL')  
    30      
    31     adapter = ConnectionPool.add_data_source :type => :sparql_sesame_api, :title => x + '(Local)'  ,  :caching =>true, :repository => x, :dir => $sesamedir.path 
    32     
     28  if x.rindex('.') == nil && x!= ('SYSTEM') && x!= ('INTERNAL')      
     29    adapter = ConnectionPool.add_data_source :type => :sparql_sesame_api, :title => x + '(Local)'  ,  :caching =>true, :repository => x, :dir => $sesamedir.path    
     30  
    3331  end 
    3432end 
     
    9896Namespace.register(:mondial,"http://www.semwebtech.org/mondial/10/meta#") 
    9997 
     98  
    10099RDFS::Resource.find_all_predicates 
    101100 
  • Explorator/trunk/lib/libs.rb

    r352 r386  
    55require 'query_factory.rb' 
    66require 'explorator_application.rb' 
    7  
     7require 'endpointfinder.rb' 
    88 
    99#this adapter must be the last one added to the pool because It will be used as an write adapter by the activerdf 
  • Explorator/trunk/lib/query_builder.rb

    r368 r386  
    5353  #the same method as query, but it is able to treat arrays. 
    5454  #This methos 
    55   def spo(s,p,o,r=nil)       
    56      
     55  def spo(s,p,o,r=nil)           
    5756    result = Array.new  
    5857    s = resource_or_self(s,r).uniq 
     
    124123      q.distinct(:p)      if p.instance_of? Symbol 
    125124      q.distinct(:x,:y) 
    126       q.where (to_resource(s,:s),to_resource(p,:p),to_resource(o,:o))  .where(to_resource(p,:p),:x,:y) 
     125      q.where(to_resource(s,:s),to_resource(p,:p),to_resource(o,:o))  .where(to_resource(p,:p),:x,:y) 
    127126    elsif r.to_s == :o.to_s       
    128127      variables << :o if o.instance_of? Symbol 
     
    132131      q.distinct(:x,:y) 
    133132       
    134       q.where (to_resource(s,:s),to_resource(p,:p),to_resource(o,:o))  .where(to_resource(o,:o),:x,:y) 
     133      q.where(to_resource(s,:s),to_resource(p,:p),to_resource(o,:o))  .where(to_resource(o,:o),:x,:y) 
    135134    else      
    136135      variables << :s if s.instance_of? Symbol 
     
    146145        q.distinct(:o)      if o.instance_of? Symbol         
    147146      end 
    148       q.where (to_resource(s,:s),to_resource(p,:p),to_resource(o,:o))   
     147      q.where(to_resource(s,:s),to_resource(p,:p),to_resource(o,:o))   
    149148    end 
    150149    values = q.execute   
     
    261260        tmp = SemanticExpression.new.spo(Thread.current[:application].get(s).elements.collect{|s,p,o| eval(r.to_s)}.uniq,:p,:o).result 
    262261      else 
    263         tmp =Thread.current[:application].get(s).elements 
     262        tmp = Thread.current[:application].get(s).elements 
    264263      end 
    265264      #Intersection method, passed as parameter a triple expression 
     
    330329    self.result.collect {|s,p,o| eval(r.to_s)} 
    331330  end 
    332    
     331  def auto_enable_or_find_and_add_repository(uri) 
     332     
     333  end 
    333334  #The to_resource method is necessary because the ActiveRDF Query only accept a RDFS::Resource, a Literal(String) or a Ruby Symbol as parameter. 
    334335  #Convert a string to RDFS:Resource or symbol. The String should be in the format: "SOME TEXT"