Class: ActiveRubinstein::JosekiQuery

Inherits:
Base
  • Object
show all
Defined in:
lib/active_rubinstein/joseki_query.rb

Overview

Picks a server from the server pool and opens up the interface for queries.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#hello, #roll, set_language, #shuffle

Constructor Details

#initializeJosekiQuery

Returns a new instance of JosekiQuery.



40
41
42
43
44
45
46
47
48
49
# File 'lib/active_rubinstein/joseki_query.rb', line 40

def initialize
  server = $serverPool[ :joseki ].first
  @@log.debug $serverPool[ :joseki ].inspect
  if server.nil?
    @@log.error $!.message
  else
    @@joseki = server
    @@log.rubinstein "@@joseki = #{server.inspect}"
  end
end

Class Method Details

.execute(query, options = {}) ⇒ Object

analyzes the query to find the correct method to execute



56
57
58
59
60
# File 'lib/active_rubinstein/joseki_query.rb', line 56

def execute( query, options={} )
  # construct common SPARQL
  query = ActiveRubinstein::SparqlFormulator.construct( query, options )
  results = self.query( query, options ) if query
end

.serverObject

returns the server object



63
64
65
# File 'lib/active_rubinstein/joseki_query.rb', line 63

def server
  @@joseki
end