lib/activerdf_sparql-1.3.6/lib/activerdf_sparql/sparql.rb
# query datastore with query string (SPARQL), returns array with query results
# may be called with a block
query datastore with query string (SPARQL), returns array with query results
may be called with a block
query datastore with query string ( SPARQL ) returns array with query results may be called with a block
def query(query, &block)    
    puts "Querying ...#{@title}"
    qs = Query2SPARQL.translate(query,@engine)   
    puts qs.to_s  
    if query.insert? || query.delete?     
      reset_cache()
      return execute_sparql_query(qs, header(query), query.select_clauses, &block)
    end
    if @caching 
      if is_into_cache(qs) 
        $activerdflog.debug "cache hit for query #{qs}"
        resp = query_cache(qs)
        return  resp
      end
    end    
    result = execute_sparql_query(qs, header(query), query.select_clauses, &block)
    add_to_cache(qs, result) if @caching
    result = [] if result == "timeout"
    return result
  end
def query ( query , & block ) puts "Querying ...#{@title}" qs = Query2SPARQL . translate ( query , @engine ) puts qs . to_s if query . insert? || query . delete? reset_cache ( ) return execute_sparql_query ( qs , header ( query ) , query . select_clauses , & block ) end if @caching if is_into_cache ( qs ) $activerdflog . debug "cache hit for query #{qs}" resp = query_cache ( qs ) return resp end end result = execute_sparql_query ( qs , header ( query ) , query . select_clauses , & block ) add_to_cache ( qs , result ) if @caching result = [ ] if result == "timeout" return result end
query datastore with query string (SPARQL), returns array with query results
may be called with a block
query datastore with query string ( SPARQL ) returns array with query results may be called with a block
query
block