sparql-client 1.1.6.1 → 1.99.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/sparql/client.rb +1 -1
- data/lib/sparql/client/query.rb +1 -1
- data/lib/sparql/client/repository.rb +8 -23
- data/lib/sparql/client/update.rb +2 -2
- metadata +2 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12f0bfacb2a7bfbf5a747ffc5561c5115d4b02b6
|
4
|
+
data.tar.gz: c9c678a46958115483e217b1ffc13e230ff133a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00f5889614ffd403c945c02911ec75030805c44e90972ec11bda460bd053e4ab368ffbfca4218263158d004d428a2a6318ddd7088edbf33f8b82265fa335b39c
|
7
|
+
data.tar.gz: cc39bc81745d9fb223532ed7480bd9d4dc16830cd4b1729565fa2711d446516d5b321d4474484317c9292ffb27ec2c7139beb529aa750cdfbc570894b313da2a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.99.0
|
data/lib/sparql/client.rb
CHANGED
@@ -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::
|
156
|
+
# graph << [:jhacker, RDF::FOAF.name, "J. Random Hacker"]
|
157
157
|
# })
|
158
158
|
#
|
159
159
|
# @example Inserting data sourced from a file or URL
|
data/lib/sparql/client/query.rb
CHANGED
@@ -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::
|
339
|
+
# optional([:s, RDF.type, :o], [:s, RDF::DC.abstract, :o])
|
340
340
|
#
|
341
341
|
# @return [Query]
|
342
342
|
# @see http://www.w3.org/TR/sparql11-query/#optionals
|
@@ -10,11 +10,10 @@ 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 = {})
|
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)
|
18
17
|
end
|
19
18
|
|
20
19
|
##
|
@@ -192,27 +191,10 @@ module SPARQL; class Client
|
|
192
191
|
# considered to be a pattern, and used to query
|
193
192
|
# self to find matching statements to delete.
|
194
193
|
#
|
195
|
-
# @
|
196
|
-
#
|
197
|
-
#
|
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
|
194
|
+
# @param [Enumerable<RDF::Statement>] statements
|
195
|
+
# @raise [TypeError] if `self` is immutable
|
196
|
+
# @return [Mutable]
|
206
197
|
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!
|
216
198
|
delete_statements(statements) unless statements.empty?
|
217
199
|
return self
|
218
200
|
end
|
@@ -257,7 +239,7 @@ module SPARQL; class Client
|
|
257
239
|
# @yield [statement]
|
258
240
|
# @yieldparam [Statement]
|
259
241
|
# @return [Enumerable<Statement>]
|
260
|
-
def query_pattern(pattern,
|
242
|
+
def query_pattern(pattern, &block)
|
261
243
|
pattern = pattern.dup
|
262
244
|
pattern.subject ||= RDF::Query::Variable.new
|
263
245
|
pattern.predicate ||= RDF::Query::Variable.new
|
@@ -280,6 +262,7 @@ module SPARQL; class Client
|
|
280
262
|
# @param [RDF::Enumerable] statements
|
281
263
|
# @return [void]
|
282
264
|
def delete_statements(statements)
|
265
|
+
|
283
266
|
constant = statements.all? do |value|
|
284
267
|
# needs to be flattened... urgh
|
285
268
|
!value.respond_to?(:each_statement) && begin
|
@@ -305,6 +288,7 @@ module SPARQL; class Client
|
|
305
288
|
# @return [void]
|
306
289
|
# @since 0.1.6
|
307
290
|
def insert_statements(statements)
|
291
|
+
raise ArgumentError, "Some statement is incomplete" if statements.any?(&:incomplete?)
|
308
292
|
update_client.insert_data(statements)
|
309
293
|
end
|
310
294
|
|
@@ -312,6 +296,7 @@ module SPARQL; class Client
|
|
312
296
|
# @private
|
313
297
|
# @see RDF::Mutable#insert
|
314
298
|
def insert_statement(statement)
|
299
|
+
raise ArgumentError, "Statement #{statement.inspect} is incomplete" if statement.incomplete?
|
315
300
|
update_client.insert_data([statement])
|
316
301
|
end
|
317
302
|
|
data/lib/sparql/client/update.rb
CHANGED
@@ -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::
|
10
|
+
# graph << [RDF::URI('http://example.org/jhacker'), RDF::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::
|
28
|
+
# graph << [RDF::URI('http://example.org/jhacker'), RDF::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.
|
4
|
+
version: 1.99.0
|
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-
|
13
|
+
date: 2015-10-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rdf
|
@@ -19,9 +19,6 @@ dependencies:
|
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '1.1'
|
22
|
-
- - "<"
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '1.99'
|
25
22
|
type: :runtime
|
26
23
|
prerelease: false
|
27
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,9 +26,6 @@ dependencies:
|
|
29
26
|
- - "~>"
|
30
27
|
- !ruby/object:Gem::Version
|
31
28
|
version: '1.1'
|
32
|
-
- - "<"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '1.99'
|
35
29
|
- !ruby/object:Gem::Dependency
|
36
30
|
name: net-http-persistent
|
37
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,9 +50,6 @@ dependencies:
|
|
56
50
|
- - ">="
|
57
51
|
- !ruby/object:Gem::Version
|
58
52
|
version: 1.1.6
|
59
|
-
- - "<"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.99'
|
62
53
|
type: :development
|
63
54
|
prerelease: false
|
64
55
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,9 +60,6 @@ dependencies:
|
|
69
60
|
- - ">="
|
70
61
|
- !ruby/object:Gem::Version
|
71
62
|
version: 1.1.6
|
72
|
-
- - "<"
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '1.99'
|
75
63
|
- !ruby/object:Gem::Dependency
|
76
64
|
name: rdf-spec
|
77
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,9 +67,6 @@ dependencies:
|
|
79
67
|
- - "~>"
|
80
68
|
- !ruby/object:Gem::Version
|
81
69
|
version: '1.1'
|
82
|
-
- - "<"
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: '1.99'
|
85
70
|
type: :development
|
86
71
|
prerelease: false
|
87
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -89,9 +74,6 @@ dependencies:
|
|
89
74
|
- - "~>"
|
90
75
|
- !ruby/object:Gem::Version
|
91
76
|
version: '1.1'
|
92
|
-
- - "<"
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: '1.99'
|
95
77
|
- !ruby/object:Gem::Dependency
|
96
78
|
name: rspec
|
97
79
|
requirement: !ruby/object:Gem::Requirement
|