rdf-sesame 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHORS +1 -0
- data/README +6 -6
- data/VERSION +1 -1
- data/lib/rdf/sesame/repository.rb +38 -11
- data/lib/rdf/sesame/server.rb +3 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04a330d11664f4d2e8ad1899cccb73672c52909f
|
4
|
+
data.tar.gz: a5f1dc2b3688aa21efaac913008b1500d875e2f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfc6872515ac83c03eb27ea10feca2aa7bb67cfc06022da8f6cec9dd44422f09dc65ac0f18af86ba04792bff9336c7cbbf2c7ca60e72847f5910a80b9692f47b
|
7
|
+
data.tar.gz: 88bc76971e06250090f68d5cee02dfdceb7bcec6077541d1080f133cca4a082fa2804342f7fc884d02c75da643fc55f02bb0926daecd626ccc4c9825db5ad3fe
|
data/AUTHORS
CHANGED
data/README
CHANGED
@@ -36,7 +36,7 @@ Caveats
|
|
36
36
|
|
37
37
|
* Sesame rewrites blank node identifiers on inserted statements. For
|
38
38
|
example, if you supply a `_:foobar` identifier, it becomes something like
|
39
|
-
`_:node156oo6equx12769` as soon as you insert it into a Sesame repository.
|
39
|
+
`_:node156oo6equx12769` as soon as you insert it into a Sesame repository.
|
40
40
|
This means that you can't construct and insert a statement containing a
|
41
41
|
blank node term and then expect to successfully be able check for its
|
42
42
|
existence using the `Repository#has_statement?` method. This is also the
|
@@ -46,8 +46,8 @@ Caveats
|
|
46
46
|
Dependencies
|
47
47
|
------------
|
48
48
|
|
49
|
-
* [RDF.rb](http://rubygems.org/gems/rdf) (
|
50
|
-
* [JSON](http://rubygems.org/gems/json_pure) (
|
49
|
+
* [RDF.rb](http://rubygems.org/gems/rdf) (~> 1.1)
|
50
|
+
* [JSON](http://rubygems.org/gems/json_pure) (~> 1.8)
|
51
51
|
|
52
52
|
Installation
|
53
53
|
------------
|
@@ -62,12 +62,12 @@ Download
|
|
62
62
|
|
63
63
|
To get a local working copy of the development repository, do:
|
64
64
|
|
65
|
-
% git clone git://github.com/
|
65
|
+
% git clone git://github.com/ruby-rdf/rdf-sesame.git
|
66
66
|
|
67
67
|
Alternatively, download the latest development version as a tarball as
|
68
68
|
follows:
|
69
69
|
|
70
|
-
% wget
|
70
|
+
% wget https://github.com/ruby-rdf/rdf-sesame/tarball/master
|
71
71
|
|
72
72
|
Mailing List
|
73
73
|
------------
|
@@ -78,11 +78,11 @@ Author
|
|
78
78
|
------
|
79
79
|
|
80
80
|
* [Arto Bendiken](http://github.com/bendiken) - <http://ar.to/>
|
81
|
+
* [Aymeric Brisse](http://github.com/abrisse)
|
81
82
|
|
82
83
|
Contributors
|
83
84
|
------------
|
84
85
|
|
85
|
-
* [Aymeric Brisse](http://github.com/abrisse)
|
86
86
|
* [Slava Kravchenko](http://github.com/cordawyn)
|
87
87
|
|
88
88
|
License
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
@@ -44,6 +44,9 @@ module RDF::Sesame
|
|
44
44
|
# @return [String,Array]
|
45
45
|
attr_reader :context
|
46
46
|
|
47
|
+
# Maximum length for GET query
|
48
|
+
MAX_LENGTH_GET_QUERY = 2500
|
49
|
+
|
47
50
|
##
|
48
51
|
# Initializes this `Repository` instance.
|
49
52
|
#
|
@@ -279,12 +282,14 @@ module RDF::Sesame
|
|
279
282
|
end
|
280
283
|
|
281
284
|
##
|
282
|
-
# Returns all statements of the given query
|
285
|
+
# Returns all statements of the given query when the query
|
286
|
+
# is a READ query. Execute a WRITE query and returns the
|
287
|
+
# status of the query.
|
283
288
|
#
|
284
289
|
# @private
|
285
290
|
# @param [String, #to_s] query
|
286
291
|
# @param [String, #to_s] queryLn
|
287
|
-
# @return [RDF::Enumerator]
|
292
|
+
# @return [RDF::Enumerator, Boolean]
|
288
293
|
def raw_query(query, queryLn = 'sparql', options={}, &block)
|
289
294
|
options = { infer: true }.merge(options)
|
290
295
|
|
@@ -295,21 +300,34 @@ module RDF::Sesame
|
|
295
300
|
end
|
296
301
|
end
|
297
302
|
|
303
|
+
##
|
304
|
+
# Returns all statements of the given query.
|
305
|
+
#
|
306
|
+
# @private
|
307
|
+
# @param [String, #to_s] query
|
308
|
+
# @param [String, #to_s] queryLn
|
309
|
+
# @return [RDF::Enumerator]
|
298
310
|
def read_query(query, queryLn, options)
|
299
311
|
if queryLn == 'sparql' and options[:format].nil? and query =~ /\bconstruct\b/i
|
300
312
|
options[:format] = Server::ACCEPT_NTRIPLES
|
301
313
|
end
|
302
|
-
|
303
314
|
options[:format] = Server::ACCEPT_JSON unless options[:format]
|
304
315
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
316
|
+
parameters = { :query => query, :queryLn => queryLn, :infer => options[:infer] }
|
317
|
+
|
318
|
+
response = if query.size > MAX_LENGTH_GET_QUERY
|
319
|
+
headers = Server::CONTENT_TYPE_X_FORM.merge(options[:format])
|
320
|
+
server.post(path, Addressable::URI.form_encode(parameters), headers)
|
309
321
|
else
|
310
|
-
|
322
|
+
params = Addressable::URI.form_encode(parameters).gsub("+", "%20").to_s
|
323
|
+
url = Addressable::URI.parse(path)
|
324
|
+
unless url.normalize.query.nil?
|
325
|
+
url.query = [url.query, params].compact.join('&')
|
326
|
+
else
|
327
|
+
url.query = [url.query, params].compact.join('?')
|
328
|
+
end
|
329
|
+
server.get(url, options[:format])
|
311
330
|
end
|
312
|
-
response = server.get(url, options[:format])
|
313
331
|
|
314
332
|
results = parse_response(response)
|
315
333
|
if block_given?
|
@@ -319,10 +337,19 @@ module RDF::Sesame
|
|
319
337
|
end
|
320
338
|
end
|
321
339
|
|
340
|
+
##
|
341
|
+
# Execute a WRITE query against the repository.
|
342
|
+
# Returns true if the query was succesful.
|
343
|
+
#
|
344
|
+
# @private
|
345
|
+
# @param [String, #to_s] query
|
346
|
+
# @param [String, #to_s] queryLn
|
347
|
+
# @param [Hash] options
|
348
|
+
# @return [Boolean]
|
322
349
|
def write_query(query, queryLn, options)
|
323
350
|
parameters = {}
|
324
351
|
parameters[:update] = query
|
325
|
-
response = server.post(path(:statements), Addressable::URI.form_encode(parameters),
|
352
|
+
response = server.post(path(:statements), Addressable::URI.form_encode(parameters), Server::CONTENT_TYPE_X_FORM)
|
326
353
|
response.code == "204"
|
327
354
|
end
|
328
355
|
|
@@ -391,7 +418,7 @@ module RDF::Sesame
|
|
391
418
|
# @see http://www.openrdf.org/doc/sesame2/system/ch08.html#d0e304
|
392
419
|
def insert_statements(statements)
|
393
420
|
data = statements_to_text_plain(statements)
|
394
|
-
response = server.post(path(:statements, statements_options), data,
|
421
|
+
response = server.post(path(:statements, statements_options), data, Server::CONTENT_TYPE_TEXT)
|
395
422
|
response.code == "204"
|
396
423
|
end
|
397
424
|
|
data/lib/rdf/sesame/server.rb
CHANGED
@@ -54,6 +54,9 @@ module RDF::Sesame
|
|
54
54
|
ACCEPT_BINARY = {'Accept' => 'application/x-binary-rdf'}.freeze
|
55
55
|
ACCEPT_BINARY_TABLE = {'Accept' => 'application/x-binary-rdf-results-table'}.freeze
|
56
56
|
|
57
|
+
CONTENT_TYPE_TEXT = {'Content-Type' => 'text/plain'}.freeze
|
58
|
+
CONTENT_TYPE_X_FORM = {'Content-Type' => 'application/x-www-form-urlencoded' }.freeze
|
59
|
+
|
57
60
|
RESULT_BOOL = 'text/boolean'.freeze
|
58
61
|
RESULT_JSON = 'application/sparql-results+json'.freeze
|
59
62
|
RESULT_XML = 'application/sparql-results+xml'.freeze
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-sesame
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arto Bendiken
|
8
|
-
-
|
8
|
+
- Aymeric Brisse
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_pure
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project: rdf
|
135
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.4.4
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Sesame 2.0 adapter for RDF.rb.
|