Class: Solis::Store::Sparql::Client::Query
- Inherits:
-
Object
- Object
- Solis::Store::Sparql::Client::Query
- Defined in:
- lib/solis/store/sparql/client/query.rb
Instance Method Summary collapse
-
#initialize(client) ⇒ Query
constructor
A new instance of Query.
- #run(query) ⇒ Object
Constructor Details
#initialize(client) ⇒ Query
Returns a new instance of Query.
6 7 8 |
# File 'lib/solis/store/sparql/client/query.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#run(query) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/solis/store/sparql/client/query.rb', line 10 def run(query) result = @client.query(query) if is_construct?(query) repository = RDF::Repository.new result.each { |s| repository << [s[:s], s[:p], s[:o]] } result = SPARQL::Client.new(repository) end result end |