sparql-client 1.1.6 → 1.1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9cbfcd66988f16d017ebcabef5ab454d3d06ca46
4
- data.tar.gz: a11a2a6ec4df3ad78cf190250e5992d0ac9f4279
3
+ metadata.gz: 57358f3aa3d830c69f778b8d637da44e6ed0d655
4
+ data.tar.gz: 0bdf5710e498bfda68cce9dc00066b5ac4e1e6d0
5
5
  SHA512:
6
- metadata.gz: fa4d22153b5828a56da4d7b0bc648987be93ebdc31e3162f44a945f6536436715d2325090a27061997ab894f2e4c352d8620393736483981812a132c426858e5
7
- data.tar.gz: a953798c28628c65350ca3ce3d6819e4986a6dda587fd4ce1a926c1c1dcaf88cd229762ec1c2956eb89aa32191b98dfdcacfe9b96da9ffb52f8adc4cfc2731bd
6
+ metadata.gz: 4753774df3a37ac52f475db73b7e23257a75645e7482a41e4d6c932501437cd318b60c2ea1a60be0b3b84c5d194ef0fef0f04ef6fe3f53e59000c75ca48f2578
7
+ data.tar.gz: 1ea581c2b2238f58dd95d350c32ae50b904dea2c27a15051a7ce807ed28d2522212d2233d48d587611cb4e2bd31ba596c706931eddf941aaa2f6ab538b358bad
data/README CHANGED
@@ -6,6 +6,7 @@ This is a [Ruby][] implementation of a [SPARQL][] client for [RDF.rb][].
6
6
 
7
7
  [![Gem Version](https://badge.fury.io/rb/sparql-client.png)](http://badge.fury.io/rb/sparql-client)
8
8
  [![Build Status](https://travis-ci.org/ruby-rdf/sparql-client.png?branch=master)](http://travis-ci.org/ruby-rdf/sparql-client)
9
+ [![Coverage Status](https://coveralls.io/repos/ruby-rdf/sparql-client/badge.svg?branch=master&service=github)](https://coveralls.io/github/ruby-rdf/sparql-client?branch=master)
9
10
 
10
11
  ##Features
11
12
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.6
1
+ 1.1.6.1
@@ -153,7 +153,7 @@ module SPARQL
153
153
  #
154
154
  # @example Inserting data constructed ad-hoc
155
155
  # client.insert_data(RDF::Graph.new { |graph|
156
- # graph << [:jhacker, RDF::FOAF.name, "J. Random Hacker"]
156
+ # graph << [:jhacker, RDF::Vocab::FOAF.name, "J. Random Hacker"]
157
157
  # })
158
158
  #
159
159
  # @example Inserting data sourced from a file or URL
@@ -678,11 +678,11 @@ module SPARQL
678
678
 
679
679
  request.basic_auth(url.user, url.password) if url.user && !url.user.empty?
680
680
 
681
- response = @http.request(url, request)
681
+ response = @http.request(::URI.parse(url.to_s), request)
682
682
 
683
683
  10.times do
684
684
  if response.kind_of? Net::HTTPRedirection
685
- response = @http.request(RDF::URI(response['location']), request)
685
+ response = @http.request(::URI.parse(response['location']), request)
686
686
  else
687
687
  return block_given? ? block.call(response) : response
688
688
  end
@@ -211,7 +211,7 @@ module SPARQL; class Client
211
211
  # query.select.where([:s, :p, :o]).order.asc(:o)
212
212
  # query.select.where([:s, :p, :o]).asc(:o)
213
213
  #
214
- # @param [Array<Symbol, String>] variables
214
+ # @param [Array<Symbol, String>] var
215
215
  # @return [Query]
216
216
  # @see http://www.w3.org/TR/sparql11-query/#modOrderBy
217
217
  def asc(var)
@@ -224,7 +224,7 @@ module SPARQL; class Client
224
224
  # query.select.where([:s, :p, :o]).order.desc(:o)
225
225
  # query.select.where([:s, :p, :o]).desc(:o)
226
226
  #
227
- # @param [Array<Symbol, String>] variables
227
+ # @param [Array<Symbol, String>] var
228
228
  # @return [Query]
229
229
  # @see http://www.w3.org/TR/sparql11-query/#modOrderBy
230
230
  def desc(var)
@@ -336,7 +336,7 @@ module SPARQL; class Client
336
336
  ##
337
337
  # @example SELECT * WHERE \{ ?s ?p ?o . OPTIONAL \{ ?s a ?o . ?s \<http://purl.org/dc/terms/abstract\> ?o . \} \}
338
338
  # query.select.where([:s, :p, :o]).
339
- # optional([:s, RDF.type, :o], [:s, RDF::DC.abstract, :o])
339
+ # optional([:s, RDF.type, :o], [:s, RDF::Vocab::DC.abstract, :o])
340
340
  #
341
341
  # @return [Query]
342
342
  # @see http://www.w3.org/TR/sparql11-query/#optionals
@@ -10,10 +10,11 @@ module SPARQL; class Client
10
10
  ##
11
11
  # @param [String, #to_s] endpoint
12
12
  # @param [Hash{Symbol => Object}] options
13
- def initialize(endpoint, options = {})
13
+ def initialize(endpoint, options = {}, &block)
14
14
  @options = options.dup
15
15
  @update_client = SPARQL::Client.new(options.delete(:update_endpoint), options) if options[:update_endpoint]
16
16
  @client = SPARQL::Client.new(endpoint, options)
17
+ super(@options, &block)
17
18
  end
18
19
 
19
20
  ##
@@ -40,9 +41,10 @@ module SPARQL; class Client
40
41
  def supports?(feature)
41
42
  case feature.to_sym
42
43
  # statement contexts / named graphs
43
- when :context then false
44
- when :inference then false # forward-chaining inference
45
- when :validity then false
44
+ when :context then false
45
+ when :graph_name then false
46
+ when :inference then false # forward-chaining inference
47
+ when :validity then false
46
48
  else false
47
49
  end
48
50
  end
@@ -190,10 +192,27 @@ module SPARQL; class Client
190
192
  # considered to be a pattern, and used to query
191
193
  # self to find matching statements to delete.
192
194
  #
193
- # @param [Enumerable<RDF::Statement>] statements
194
- # @raise [TypeError] if `self` is immutable
195
- # @return [Mutable]
195
+ # @overload delete(*statements)
196
+ # @param [Array<RDF::Statement>] statements
197
+ # @raise [TypeError] if `self` is immutable
198
+ # @return [self]
199
+ #
200
+ # @overload delete(statements)
201
+ # @param [Enumerable<RDF::Statement>] statements
202
+ # @raise [TypeError] if `self` is immutable
203
+ # @return [self]
204
+ #
205
+ # @see RDF::Mutable#delete
196
206
  def delete(*statements)
207
+ statements.map! do |value|
208
+ if value.respond_to?(:each_statement)
209
+ delete_statements(value)
210
+ nil
211
+ else
212
+ value
213
+ end
214
+ end
215
+ statements.compact!
197
216
  delete_statements(statements) unless statements.empty?
198
217
  return self
199
218
  end
@@ -238,7 +257,7 @@ module SPARQL; class Client
238
257
  # @yield [statement]
239
258
  # @yieldparam [Statement]
240
259
  # @return [Enumerable<Statement>]
241
- def query_pattern(pattern, &block)
260
+ def query_pattern(pattern, options = {}, &block)
242
261
  pattern = pattern.dup
243
262
  pattern.subject ||= RDF::Query::Variable.new
244
263
  pattern.predicate ||= RDF::Query::Variable.new
@@ -261,7 +280,6 @@ module SPARQL; class Client
261
280
  # @param [RDF::Enumerable] statements
262
281
  # @return [void]
263
282
  def delete_statements(statements)
264
-
265
283
  constant = statements.all? do |value|
266
284
  # needs to be flattened... urgh
267
285
  !value.respond_to?(:each_statement) && begin
@@ -7,7 +7,7 @@ class SPARQL::Client
7
7
  #
8
8
  # @example INSERT DATA \{ <http://example.org/jhacker> <http://xmlns.com/foaf/0.1/name> \"J. Random Hacker\" .\}
9
9
  # data = RDF::Graph.new do |graph|
10
- # graph << [RDF::URI('http://example.org/jhacker'), RDF::FOAF.name, "J. Random Hacker"]
10
+ # graph << [RDF::URI('http://example.org/jhacker'), RDF::Vocab::FOAF.name, "J. Random Hacker"]
11
11
  # end
12
12
  # insert_data(data)
13
13
  #
@@ -25,7 +25,7 @@ class SPARQL::Client
25
25
  #
26
26
  # @example DELETE DATA \{ <http://example.org/jhacker> <http://xmlns.com/foaf/0.1/name> \"J. Random Hacker\" .\}
27
27
  # data = RDF::Graph.new do |graph|
28
- # graph << [RDF::URI('http://example.org/jhacker'), RDF::FOAF.name, "J. Random Hacker"]
28
+ # graph << [RDF::URI('http://example.org/jhacker'), RDF::Vocab::FOAF.name, "J. Random Hacker"]
29
29
  # end
30
30
  # delete_data(data)
31
31
  #
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.6
4
+ version: 1.1.6.1
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: 2015-08-28 00:00:00.000000000 Z
13
+ date: 2015-11-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdf
@@ -19,6 +19,9 @@ dependencies:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: '1.1'
22
+ - - "<"
23
+ - !ruby/object:Gem::Version
24
+ version: '1.99'
22
25
  type: :runtime
23
26
  prerelease: false
24
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,6 +29,9 @@ dependencies:
26
29
  - - "~>"
27
30
  - !ruby/object:Gem::Version
28
31
  version: '1.1'
32
+ - - "<"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.99'
29
35
  - !ruby/object:Gem::Dependency
30
36
  name: net-http-persistent
31
37
  requirement: !ruby/object:Gem::Requirement
@@ -50,6 +56,9 @@ dependencies:
50
56
  - - ">="
51
57
  - !ruby/object:Gem::Version
52
58
  version: 1.1.6
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.99'
53
62
  type: :development
54
63
  prerelease: false
55
64
  version_requirements: !ruby/object:Gem::Requirement
@@ -60,6 +69,9 @@ dependencies:
60
69
  - - ">="
61
70
  - !ruby/object:Gem::Version
62
71
  version: 1.1.6
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.99'
63
75
  - !ruby/object:Gem::Dependency
64
76
  name: rdf-spec
65
77
  requirement: !ruby/object:Gem::Requirement
@@ -67,6 +79,9 @@ dependencies:
67
79
  - - "~>"
68
80
  - !ruby/object:Gem::Version
69
81
  version: '1.1'
82
+ - - "<"
83
+ - !ruby/object:Gem::Version
84
+ version: '1.99'
70
85
  type: :development
71
86
  prerelease: false
72
87
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,6 +89,9 @@ dependencies:
74
89
  - - "~>"
75
90
  - !ruby/object:Gem::Version
76
91
  version: '1.1'
92
+ - - "<"
93
+ - !ruby/object:Gem::Version
94
+ version: '1.99'
77
95
  - !ruby/object:Gem::Dependency
78
96
  name: rspec
79
97
  requirement: !ruby/object:Gem::Requirement
@@ -170,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
188
  version: '0'
171
189
  requirements: []
172
190
  rubyforge_project: sparql-client
173
- rubygems_version: 2.4.7
191
+ rubygems_version: 2.4.5.1
174
192
  signing_key:
175
193
  specification_version: 4
176
194
  summary: SPARQL client for RDF.rb.