Class: RDF::Marmotta::Client
- Inherits:
-
SPARQL::Client
- Object
- SPARQL::Client
- RDF::Marmotta::Client
- Defined in:
- lib/rdf/marmotta.rb
Constant Summary collapse
Instance Method Summary collapse
-
#initialize(url, options = {}, &block) ⇒ Client
constructor
A new instance of Client.
- #parse_rdf_serialization(response, options = {}) ⇒ Object
-
#request(query, headers = {}, &block) ⇒ Object
Limit to accepted content types per comment on RDF::Marmotta::CTYPES.
-
#request_method(query) ⇒ Object
Do HTTP POST if it’s an INSERT.
Constructor Details
#initialize(url, options = {}, &block) ⇒ Client
Returns a new instance of Client.
72 73 74 75 76 |
# File 'lib/rdf/marmotta.rb', line 72 def initialize(url, = {}, &block) [:method] ||= :get [:protocol] ||= '1.1' super end |
Instance Method Details
#parse_rdf_serialization(response, options = {}) ⇒ Object
91 92 93 94 |
# File 'lib/rdf/marmotta.rb', line 91 def parse_rdf_serialization(response, = {}) [:content_type] ||= 'text/turtle' if response.content_type.nil? super end |
#request(query, headers = {}, &block) ⇒ Object
Limit to accepted content types per comment on RDF::Marmotta::CTYPES
80 81 82 83 84 85 86 87 |
# File 'lib/rdf/marmotta.rb', line 80 def request(query, headers={}, &block) headers['Accept'] ||= MARMOTTA_GRAPH_ALL if (query.respond_to?(:expects_statements?) ? query.expects_statements? : (query =~ /CONSTRUCT|DESCRIBE|DELETE|CLEAR/)) super end |
#request_method(query) ⇒ Object
Do HTTP POST if it’s an INSERT
97 98 99 100 101 |
# File 'lib/rdf/marmotta.rb', line 97 def request_method(query) method = (self.[:method] || DEFAULT_METHOD).to_sym method = :post if query.to_s =~ /INSERT/ method end |