Class: RDF::Oxigraph::SPARQL::Client
- Inherits:
-
Object
- Object
- RDF::Oxigraph::SPARQL::Client
- Defined in:
- lib/rdf/oxigraph/sparql.rb
Overview
A small SPARQL::Client-shaped wrapper around a repository (anything that
responds to #sparql and #sparql_update). Covers the string-based query/update
surface; the chainable query-builder DSL of the sparql-client gem is out of scope.
Instance Attribute Summary collapse
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
-
#initialize(repository) ⇒ Client
constructor
A new instance of Client.
-
#query(query_string, **options) ⇒ Object
Execute a SPARQL query string.
-
#update(update_string) ⇒ Object
Execute a SPARQL Update string.
Constructor Details
#initialize(repository) ⇒ Client
Returns a new instance of Client.
47 48 49 |
# File 'lib/rdf/oxigraph/sparql.rb', line 47 def initialize(repository) @repository = repository end |
Instance Attribute Details
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
45 46 47 |
# File 'lib/rdf/oxigraph/sparql.rb', line 45 def repository @repository end |
Instance Method Details
#query(query_string, **options) ⇒ Object
Execute a SPARQL query string. update: true routes to #update (mirrors
the sparql-client gem's convention used by some callers).
53 54 55 56 |
# File 'lib/rdf/oxigraph/sparql.rb', line 53 def query(query_string, **) return update(query_string) if [:update] @repository.sparql(query_string) end |
#update(update_string) ⇒ Object
Execute a SPARQL Update string.
59 60 61 62 |
# File 'lib/rdf/oxigraph/sparql.rb', line 59 def update(update_string, **) @repository.sparql_update(update_string) self end |