sparql-client 1.1.3.1 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README +1 -1
- data/VERSION +1 -1
- data/lib/sparql/client.rb +10 -3
- data/lib/sparql/client/repository.rb +15 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24eb08925822a40dafa2fd3ddb20b5812bb0541f
|
4
|
+
data.tar.gz: ecd254327832d34c3f6fea043d28fc7e17dab96d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8bc568e26de651c7d2402ecec14505328099fe72bd340e5b375df1b2db75cd194f230a0915a617b9255310ac07a87e60ba3ee10ca46197f8ec03687ae1995b4
|
7
|
+
data.tar.gz: 4610e805ad5058e162ba2b58f4c60b9af78fd61e1474d4a32d74fe45373435dbc78493a81ce558be83cfdc76dcb05d3112478d5217e70f58e739058698fbd1f4
|
data/README
CHANGED
@@ -110,7 +110,7 @@ follows:
|
|
110
110
|
|
111
111
|
##Contributors
|
112
112
|
|
113
|
-
* [Christoph Badura](http://github.com/
|
113
|
+
* [Christoph Badura](http://github.com/bad) - <http://github.com/bad>
|
114
114
|
* [James Hetherington](http://github.com/jamespjh) - <http://twitter.com/jamespjh>
|
115
115
|
* [Gabriel Horner](http://github.com/cldwalker) - <http://tagaholic.me/>
|
116
116
|
* [Nicholas Humfrey](http://github.com/njh) - <http://www.aelius.com/njh/>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.4
|
data/lib/sparql/client.rb
CHANGED
@@ -659,8 +659,6 @@ module SPARQL
|
|
659
659
|
# @return [Net::HTTPResponse]
|
660
660
|
# @see http://www.w3.org/TR/sparql11-protocol/#query-operation
|
661
661
|
def request(query, headers = {}, &block)
|
662
|
-
method = (self.options[:method] || DEFAULT_METHOD).to_sym
|
663
|
-
|
664
662
|
# Make sure an appropriate Accept header is present
|
665
663
|
headers['Accept'] ||= if (query.respond_to?(:expects_statements?) ?
|
666
664
|
query.expects_statements? :
|
@@ -670,7 +668,7 @@ module SPARQL
|
|
670
668
|
RESULT_ALL
|
671
669
|
end
|
672
670
|
|
673
|
-
request = send("make_#{
|
671
|
+
request = send("make_#{request_method(query)}_request", query, headers)
|
674
672
|
|
675
673
|
request.basic_auth(url.user, url.password) if url.user && !url.user.empty?
|
676
674
|
|
@@ -686,6 +684,15 @@ module SPARQL
|
|
686
684
|
raise ServerError, "Infinite redirect at #{url}. Redirected more than 10 times."
|
687
685
|
end
|
688
686
|
|
687
|
+
##
|
688
|
+
# Return the HTTP verb for posting this request.
|
689
|
+
# this is useful if you need to override the HTTP verb based on the request being made.
|
690
|
+
# (e.g. Marmotta 3.3.0 requires GET for DELETE requests, but can accept POST for INSERT)
|
691
|
+
def request_method(query)
|
692
|
+
(options[:method] || DEFAULT_METHOD).to_sym
|
693
|
+
end
|
694
|
+
|
695
|
+
|
689
696
|
##
|
690
697
|
# Constructs an HTTP GET request according to the SPARQL Protocol.
|
691
698
|
#
|
@@ -12,9 +12,19 @@ module SPARQL; class Client
|
|
12
12
|
# @param [Hash{Symbol => Object}] options
|
13
13
|
def initialize(endpoint, options = {})
|
14
14
|
@options = options.dup
|
15
|
+
@update_client = SPARQL::Client.new(options.delete(:update_endpoint), options) if options[:update_endpoint]
|
15
16
|
@client = SPARQL::Client.new(endpoint, options)
|
16
17
|
end
|
17
18
|
|
19
|
+
##
|
20
|
+
# Returns the client for the update_endpoint if specified, otherwise the
|
21
|
+
# {client}.
|
22
|
+
#
|
23
|
+
# @return [SPARQL::Client]
|
24
|
+
def update_client
|
25
|
+
@update_client || @client
|
26
|
+
end
|
27
|
+
|
18
28
|
##
|
19
29
|
# Queries `self` using the given basic graph pattern (BGP) query,
|
20
30
|
# yielding each matched solution to the given block.
|
@@ -225,7 +235,7 @@ module SPARQL; class Client
|
|
225
235
|
# @private
|
226
236
|
# @see RDF::Mutable#clear
|
227
237
|
def clear_statements
|
228
|
-
|
238
|
+
update_client.clear(:all)
|
229
239
|
end
|
230
240
|
|
231
241
|
##
|
@@ -262,9 +272,9 @@ module SPARQL; class Client
|
|
262
272
|
end
|
263
273
|
|
264
274
|
if constant
|
265
|
-
|
275
|
+
update_client.delete_data(statements)
|
266
276
|
else
|
267
|
-
|
277
|
+
update_client.delete_insert(statements)
|
268
278
|
end
|
269
279
|
end
|
270
280
|
|
@@ -278,14 +288,14 @@ module SPARQL; class Client
|
|
278
288
|
# @return [void]
|
279
289
|
# @since 0.1.6
|
280
290
|
def insert_statements(statements)
|
281
|
-
|
291
|
+
update_client.insert_data(statements)
|
282
292
|
end
|
283
293
|
|
284
294
|
##
|
285
295
|
# @private
|
286
296
|
# @see RDF::Mutable#insert
|
287
297
|
def insert_statement(statement)
|
288
|
-
|
298
|
+
update_client.insert_data([statement])
|
289
299
|
end
|
290
300
|
|
291
301
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparql-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arto Bendiken
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rdf
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
166
|
rubyforge_project: sparql-client
|
167
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.4.3
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: SPARQL client for RDF.rb.
|