tripod 0.10.9 → 0.10.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tripod.rb +3 -0
- data/lib/tripod/sparql_client.rb +18 -2
- data/lib/tripod/streaming.rb +7 -2
- data/lib/tripod/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17e09d56a300cfbce5e1e35feb3be1821a129eee
|
4
|
+
data.tar.gz: 8b149e9c78c869ec7f307e84d2e609840b0271fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c32107cb6bb6d0065f5584e08be54f54ac08222a63ebf8a9e4dbf88ccbcc01425bfb9e61d0c4f4aa938d76cf9439b22f44ee6387f80cb03f537f44b4f8e549e
|
7
|
+
data.tar.gz: 42054adedd9b7975e3ddef60678b7118f596e75982ff6d7cfd731c9ed745767bb382cc9f9326e552cdf98935efc7ab8afc1236ec8bc4aee9b2a492244b71ea13
|
data/lib/tripod.rb
CHANGED
data/lib/tripod/sparql_client.rb
CHANGED
@@ -16,7 +16,9 @@ module Tripod::SparqlClient
|
|
16
16
|
# @return [ RestClient::Response ]
|
17
17
|
def self.query(sparql, accept_header, extra_params={}, response_limit_bytes = :default)
|
18
18
|
|
19
|
-
|
19
|
+
non_sparql_params = (Tripod.extra_endpoint_params).merge(extra_params)
|
20
|
+
params_hash = {:query => sparql}.merge(non_sparql_params)
|
21
|
+
params = self.to_query(params_hash)
|
20
22
|
request_url = Tripod.query_endpoint
|
21
23
|
streaming_opts = {:accept => accept_header, :timeout_seconds => Tripod.timeout_seconds}
|
22
24
|
streaming_opts.merge!(_response_limit_options(response_limit_bytes)) if Tripod.response_limit_bytes
|
@@ -25,8 +27,8 @@ module Tripod::SparqlClient
|
|
25
27
|
stream_data = -> {
|
26
28
|
Tripod.logger.debug "TRIPOD: About to run query: #{sparql}"
|
27
29
|
Tripod.logger.debug "TRIPOD: Streaming from url: #{request_url}"
|
30
|
+
Tripod.logger.debug "TRIPOD: non sparql params #{non_sparql_params.to_s}"
|
28
31
|
Tripod.logger.debug "TRIPOD: Streaming opts: #{streaming_opts.inspect}"
|
29
|
-
|
30
32
|
Tripod::Streaming.get_data(request_url, params, streaming_opts)
|
31
33
|
}
|
32
34
|
|
@@ -43,6 +45,20 @@ module Tripod::SparqlClient
|
|
43
45
|
|
44
46
|
end
|
45
47
|
|
48
|
+
# Tripod helper to turn a hash to a query string, allowing multiple params in arrays
|
49
|
+
# e.g. :query=>'foo', :graph=>['bar', 'baz']
|
50
|
+
# -> query=foo&graph=bar&graph=baz
|
51
|
+
# based on the ActiveSupport implementation, but with different behaviour for arrays
|
52
|
+
def self.to_query hash
|
53
|
+
hash.collect_concat do |key, value|
|
54
|
+
if value.class == Array
|
55
|
+
value.collect { |v| v.to_query( key ) }
|
56
|
+
else
|
57
|
+
value.to_query(key)
|
58
|
+
end
|
59
|
+
end.sort * '&'
|
60
|
+
end
|
61
|
+
|
46
62
|
# Runs a SELECT +query+ against the endpoint. Returns a Hash of the results.
|
47
63
|
#
|
48
64
|
# @param [ String ] query The query to run
|
data/lib/tripod/streaming.rb
CHANGED
@@ -49,8 +49,13 @@ module Tripod
|
|
49
49
|
total_request_time = Time.now - request_start_time
|
50
50
|
end
|
51
51
|
|
52
|
-
Tripod.logger.debug
|
53
|
-
|
52
|
+
if Tripod.logger.debug?
|
53
|
+
Tripod.logger.debug "TRIPOD: #{total_bytes} bytes streamed in: #{stream_duration} secs"
|
54
|
+
time_str = "TRIPOD: total request time: #{total_request_time} secs"
|
55
|
+
time_str += "!!! SLOW !!! " if total_request_time >= 1.0
|
56
|
+
Tripod.logger.debug time_str
|
57
|
+
end
|
58
|
+
|
54
59
|
end
|
55
60
|
rescue Timeout::Error => timeout
|
56
61
|
raise Tripod::Errors::Timeout.new
|
data/lib/tripod/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tripod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ric Roberts
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|