Class: AllegroGraph::Proxy::Query
- Inherits:
-
Object
- Object
- AllegroGraph::Proxy::Query
- Defined in:
- lib/allegro_graph/proxy/query.rb
Overview
The Query class acts as proxy that bypasses SparQL and Prolog queries to the AllegroGraph server.
Constant Summary collapse
- LANGUAGES =
[ :sparql, :prolog ].freeze
Instance Attribute Summary collapse
-
#language ⇒ Object
Returns the value of attribute language.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
-
#initialize(resource) ⇒ Query
constructor
A new instance of Query.
- #path ⇒ Object
- #perform(query) ⇒ Object
Constructor Details
#initialize(resource) ⇒ Query
Returns a new instance of Query.
15 16 17 18 |
# File 'lib/allegro_graph/proxy/query.rb', line 15 def initialize(resource) @resource = resource @language = :sparql end |
Instance Attribute Details
#language ⇒ Object
Returns the value of attribute language.
13 14 15 |
# File 'lib/allegro_graph/proxy/query.rb', line 13 def language @language end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
12 13 14 |
# File 'lib/allegro_graph/proxy/query.rb', line 12 def resource @resource end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
11 12 13 |
# File 'lib/allegro_graph/proxy/query.rb', line 11 def server @server end |
Instance Method Details
#path ⇒ Object
20 21 22 |
# File 'lib/allegro_graph/proxy/query.rb', line 20 def path @resource.path end |
#perform(query) ⇒ Object
30 31 32 33 |
# File 'lib/allegro_graph/proxy/query.rb', line 30 def perform(query) parameters = { :query => query, :queryLn => @language.to_s } @resource.request_json :get, self.path, :parameters => parameters, :expected_status_code => 200 end |