sparql-client 1.99.0 → 1.99.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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README +1 -0
  3. data/VERSION +1 -1
  4. data/lib/sparql/client.rb +17 -8
  5. metadata +92 -19
  6. data/README +0 -184
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12f0bfacb2a7bfbf5a747ffc5561c5115d4b02b6
4
- data.tar.gz: c9c678a46958115483e217b1ffc13e230ff133a0
3
+ metadata.gz: 4c5c7196d4275b09823389b5cc22bc3551130e64
4
+ data.tar.gz: f4f53a7788c7accc3e76e16511b172733ec831dd
5
5
  SHA512:
6
- metadata.gz: 00f5889614ffd403c945c02911ec75030805c44e90972ec11bda460bd053e4ab368ffbfca4218263158d004d428a2a6318ddd7088edbf33f8b82265fa335b39c
7
- data.tar.gz: cc39bc81745d9fb223532ed7480bd9d4dc16830cd4b1729565fa2711d446516d5b321d4474484317c9292ffb27ec2c7139beb529aa750cdfbc570894b313da2a
6
+ metadata.gz: ede0b17bbe385b932f271ee203fac2a4f079035f912b54cb9645feb4dd5549b2aff58508ef71e98f8605f823350667ed8ef706b20ccf649c8ddbc30116dae3c9
7
+ data.tar.gz: d579ae89a32cec7d420bda0302d7eb0b480c3bacbc6dd11b7ce41b7bd43f80fb49b092427376ead918ab73a7cd537483bf5577994c25715c6c9d75d29f23871b
data/README ADDED
@@ -0,0 +1 @@
1
+ README.md
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.99.0
1
+ 1.99.1
@@ -35,13 +35,13 @@ module SPARQL
35
35
  RESULT_JSON,
36
36
  RESULT_XML,
37
37
  RESULT_BOOL,
38
- "#{RESULT_TSV};p=0.8",
39
- "#{RESULT_CSV};p=0.2",
40
- '*/*;p=0.1'
38
+ "#{RESULT_TSV};q=0.8",
39
+ "#{RESULT_CSV};q=0.2",
40
+ '*/*;q=0.1'
41
41
  ].join(', ').freeze
42
42
  GRAPH_ALL = (
43
43
  RDF::Format.content_types.keys +
44
- ['*/*;p=0.1']
44
+ ['*/*;q=0.1']
45
45
  ).join(', ').freeze
46
46
 
47
47
  ACCEPT_JSON = {'Accept' => RESULT_JSON}.freeze
@@ -291,6 +291,7 @@ module SPARQL
291
291
  # @see http://www.w3.org/TR/sparql11-protocol/#query-operation
292
292
  def query(query, options = {})
293
293
  @op = :query
294
+ @alt_endpoint = options[:endpoint]
294
295
  case @url
295
296
  when RDF::Queryable
296
297
  require 'sparql' unless defined?(::SPARQL::Grammar)
@@ -317,13 +318,13 @@ module SPARQL
317
318
  # @see http://www.w3.org/TR/sparql11-protocol/#update-operation
318
319
  def update(query, options = {})
319
320
  @op = :update
320
- @alt_endpoint = options[:endpoint] unless options[:endpoint].nil?
321
+ @alt_endpoint = options[:endpoint]
321
322
  case @url
322
323
  when RDF::Queryable
323
324
  require 'sparql' unless defined?(::SPARQL::Grammar)
324
325
  SPARQL.execute(query, @url, options.merge(update: true))
325
326
  else
326
- parse_response(response(query, options), options)
327
+ response(query, options)
327
328
  end
328
329
  self
329
330
  end
@@ -360,6 +361,8 @@ module SPARQL
360
361
  # @return [Object]
361
362
  def parse_response(response, options = {})
362
363
  case options[:content_type] || response.content_type
364
+ when NilClass
365
+ response.body
363
366
  when RESULT_BOOL # Sesame-specific
364
367
  response.body == 'true'
365
368
  when RESULT_JSON
@@ -536,9 +539,11 @@ module SPARQL
536
539
  # @param [Hash{Symbol => Object}] options
537
540
  # @return [RDF::Enumerable]
538
541
  def parse_rdf_serialization(response, options = {})
539
- options = {:content_type => response.content_type} if options.empty?
542
+ options = {:content_type => response.content_type} unless options[:content_type]
540
543
  if reader = RDF::Reader.for(options)
541
544
  reader.new(response.body)
545
+ else
546
+ raise RDF::ReaderError, "no suitable rdf reader was found."
542
547
  end
543
548
  end
544
549
 
@@ -650,7 +655,7 @@ module SPARQL
650
655
  proxy_url = URI.parse(value) unless value.nil? || value.empty?
651
656
  end
652
657
  klass = Net::HTTP::Persistent.new(self.class.to_s, proxy_url)
653
- klass.keep_alive = 120 # increase to 2 minutes
658
+ klass.keep_alive = @options[:keep_alive] || 120
654
659
  klass.read_timeout = @options[:read_timeout] || 60
655
660
  klass
656
661
  end
@@ -678,8 +683,12 @@ module SPARQL
678
683
 
679
684
  request.basic_auth(url.user, url.password) if url.user && !url.user.empty?
680
685
 
686
+ pre_http_hook(request) if respond_to?(:pre_http_hook)
687
+
681
688
  response = @http.request(::URI.parse(url.to_s), request)
682
689
 
690
+ post_http_hook(response) if respond_to?(:post_http_hook)
691
+
683
692
  10.times do
684
693
  if response.kind_of? Net::HTTPRedirection
685
694
  response = @http.request(::URI.parse(response['location']), request)
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.99.0
4
+ version: 1.99.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arto Bendiken
@@ -10,22 +10,28 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-10-30 00:00:00.000000000 Z
13
+ date: 2016-09-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdf
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '1.1'
21
+ version: '1.99'
22
+ - - "<"
23
+ - !ruby/object:Gem::Version
24
+ version: '3'
22
25
  type: :runtime
23
26
  prerelease: false
24
27
  version_requirements: !ruby/object:Gem::Requirement
25
28
  requirements:
26
- - - "~>"
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '1.99'
32
+ - - "<"
27
33
  - !ruby/object:Gem::Version
28
- version: '1.1'
34
+ version: '3'
29
35
  - !ruby/object:Gem::Dependency
30
36
  name: net-http-persistent
31
37
  requirement: !ruby/object:Gem::Requirement
@@ -41,39 +47,93 @@ dependencies:
41
47
  - !ruby/object:Gem::Version
42
48
  version: '2.9'
43
49
  - !ruby/object:Gem::Dependency
44
- name: sparql
50
+ name: json
45
51
  requirement: !ruby/object:Gem::Requirement
46
52
  requirements:
47
53
  - - "~>"
48
54
  - !ruby/object:Gem::Version
49
- version: '1.1'
55
+ version: '1.8'
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.8'
63
+ - !ruby/object:Gem::Dependency
64
+ name: tins
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '='
68
+ - !ruby/object:Gem::Version
69
+ version: 1.6.0
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '='
75
+ - !ruby/object:Gem::Version
76
+ version: 1.6.0
77
+ - !ruby/object:Gem::Dependency
78
+ name: sparql
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
50
81
  - - ">="
51
82
  - !ruby/object:Gem::Version
52
- version: 1.1.6
83
+ version: '1.99'
84
+ - - "<"
85
+ - !ruby/object:Gem::Version
86
+ version: '3'
53
87
  type: :development
54
88
  prerelease: false
55
89
  version_requirements: !ruby/object:Gem::Requirement
56
90
  requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '1.1'
60
91
  - - ">="
61
92
  - !ruby/object:Gem::Version
62
- version: 1.1.6
93
+ version: '1.99'
94
+ - - "<"
95
+ - !ruby/object:Gem::Version
96
+ version: '3'
63
97
  - !ruby/object:Gem::Dependency
64
98
  name: rdf-spec
65
99
  requirement: !ruby/object:Gem::Requirement
66
100
  requirements:
67
- - - "~>"
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '1.99'
104
+ - - "<"
68
105
  - !ruby/object:Gem::Version
69
- version: '1.1'
106
+ version: '3'
70
107
  type: :development
71
108
  prerelease: false
72
109
  version_requirements: !ruby/object:Gem::Requirement
73
110
  requirements:
74
- - - "~>"
111
+ - - ">="
75
112
  - !ruby/object:Gem::Version
76
- version: '1.1'
113
+ version: '1.99'
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '3'
117
+ - !ruby/object:Gem::Dependency
118
+ name: rdf-turtle
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '1.99'
124
+ - - "<"
125
+ - !ruby/object:Gem::Version
126
+ version: '3'
127
+ type: :development
128
+ prerelease: false
129
+ version_requirements: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '1.99'
134
+ - - "<"
135
+ - !ruby/object:Gem::Version
136
+ version: '3'
77
137
  - !ruby/object:Gem::Dependency
78
138
  name: rspec
79
139
  requirement: !ruby/object:Gem::Requirement
@@ -130,6 +190,20 @@ dependencies:
130
190
  - - "~>"
131
191
  - !ruby/object:Gem::Version
132
192
  version: '0.8'
193
+ - !ruby/object:Gem::Dependency
194
+ name: rack
195
+ requirement: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - "~>"
198
+ - !ruby/object:Gem::Version
199
+ version: '0.8'
200
+ type: :development
201
+ prerelease: false
202
+ version_requirements: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - "~>"
205
+ - !ruby/object:Gem::Version
206
+ version: '0.8'
133
207
  description: |-
134
208
  Executes SPARQL queries and updates against a remote SPARQL 1.0 or 1.1 endpoint,
135
209
  or against a local repository. Generates SPARQL queries using a simple DSL.
@@ -170,9 +244,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
244
  version: '0'
171
245
  requirements: []
172
246
  rubyforge_project: sparql-client
173
- rubygems_version: 2.4.5.1
247
+ rubygems_version: 2.5.1
174
248
  signing_key:
175
249
  specification_version: 4
176
250
  summary: SPARQL client for RDF.rb.
177
251
  test_files: []
178
- has_rdoc: false
data/README DELETED
@@ -1,184 +0,0 @@
1
- #SPARQL Client for RDF.rb
2
-
3
- This is a [Ruby][] implementation of a [SPARQL][] client for [RDF.rb][].
4
-
5
- * <http://ruby-rdf.github.com/sparql-client/>
6
-
7
- [![Gem Version](https://badge.fury.io/rb/sparql-client.png)](http://badge.fury.io/rb/sparql-client)
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)
10
-
11
- ##Features
12
-
13
- * Executes queries against any SPARQL 1.0/1.1-compatible endpoint over HTTP,
14
- or against an `RDF::Queryable` instance, using the `SPARQL` gem.
15
- * Provides a query builder [DSL][] for `ASK`, `SELECT`, `DESCRIBE` and
16
- `CONSTRUCT` queries.
17
- * Includes preliminary support for some SPARQL 1.1 Update operations.
18
- * Supports tuple result sets in both XML, JSON, CSV and TSV formats, with JSON being
19
- the preferred default for content-negotiation purposes.
20
- * Supports graph results in any RDF serialization format understood by RDF.rb.
21
- * Returns results using the [RDF.rb object model][RDF.rb model].
22
- * Supports accessing endpoints as read/write [`RDF::Repository`][RDF::Repository]
23
- instances {SPARQL::Client::Repository}.
24
-
25
- ##Examples
26
-
27
- ### Querying a remote SPARQL endpoint
28
- require 'sparql/client'
29
-
30
- sparql = SPARQL::Client.new("http://dbpedia.org/sparql")
31
-
32
- ### Querying a `RDF::Repository` instance
33
-
34
- require 'rdf/trig'
35
- repository = RDF::Repository.load("http://example/dataset.trig")
36
-
37
- sparql = SPARQL::Client.new(repository)
38
-
39
- ### Executing a boolean query and outputting the result
40
-
41
- # ASK WHERE { ?s ?p ?o }
42
- result = sparql.ask.whether([:s, :p, :o]).true?
43
-
44
- puts result.inspect #=> true or false
45
-
46
- ### Executing a tuple query and iterating over the returned solutions
47
-
48
- # SELECT * WHERE { ?s ?p ?o } OFFSET 100 LIMIT 10
49
- query = sparql.select.where([:s, :p, :o]).offset(100).limit(10)
50
-
51
- query.each_solution do |solution|
52
- puts solution.inspect
53
- end
54
-
55
- ### Executing a graph query and iterating over the returned statements
56
-
57
- # CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o } LIMIT 10
58
- query = sparql.construct([:s, :p, :o]).where([:s, :p, :o]).limit(10)
59
-
60
- query.each_statement do |statement|
61
- puts statement.inspect
62
- end
63
-
64
- ### Executing an arbitrary textual SPARQL query string
65
-
66
- result = sparql.query("ASK WHERE { ?s ?p ?o }")
67
-
68
- puts result.inspect #=> true or false
69
-
70
- ### Inserting data into a graph
71
-
72
- # INSERT DATA { <http://example.org/jhacker> <http://xmlns.com/foaf/0.1/name> "J. Random Hacker" .}
73
- data = RDF::Graph.new do |graph|
74
- graph << [RDF::URI('http://example.org/jhacker'), RDF::FOAF.name, "J. Random Hacker"]
75
- end
76
- insert_data(data)
77
-
78
- ### Deleting data from a graph
79
-
80
- # DELETE DATA { <http://example.org/jhacker> <http://xmlns.com/foaf/0.1/name> "J. Random Hacker" .}
81
- data = RDF::Graph.new do |graph|
82
- graph << [RDF::URI('http://example.org/jhacker'), RDF::FOAF.name, "J. Random Hacker"]
83
- end
84
- delete_data(data)
85
-
86
- ##Documentation
87
-
88
- * {SPARQL::Client}
89
- * {SPARQL::Client::Query}
90
- * {SPARQL::Client::Repository}
91
- * {SPARQL::Client::Update}
92
-
93
- ##Dependencies
94
-
95
- * [Ruby](http://ruby-lang.org/) (>= 1.9.3)
96
- * [RDF.rb](http://rubygems.org/gems/rdf) (>= 1.1)
97
- * [Net::HTTP::Persistent](http://rubygems.org/gems/net-http-persistent) (>= 1.4)
98
- * Soft dependency on [SPARQL](http://rubygems.org/gems/sparql) (>= 1.1)
99
- * Soft dependency on [Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.5)
100
-
101
- ##Installation
102
-
103
- The recommended installation method is via [RubyGems](http://rubygems.org/).
104
- To install the latest official release of the `SPARQL::Client` gem, do:
105
-
106
- % [sudo] gem install sparql-client
107
-
108
- ##Download
109
-
110
- To get a local working copy of the development repository, do:
111
-
112
- % git clone git://github.com/ruby-rdf/sparql-client.git
113
-
114
- Alternatively, download the latest development version as a tarball as
115
- follows:
116
-
117
- % wget http://github.com/ruby-rdf/sparql-client/tarball/master
118
-
119
- ##Mailing List
120
-
121
- * <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
122
-
123
- ##Authors
124
-
125
- * [Arto Bendiken](http://github.com/bendiken) - <http://ar.to/>
126
- * [Ben Lavender](http://github.com/bhuga) - <http://bhuga.net/>
127
- * [Gregg Kellogg](http://github.com/gkellogg) - <http://greggkellogg.net/>
128
-
129
- ##Contributors
130
-
131
- * [Christoph Badura](http://github.com/bad) - <http://github.com/bad>
132
- * [James Hetherington](http://github.com/jamespjh) - <http://twitter.com/jamespjh>
133
- * [Gabriel Horner](http://github.com/cldwalker) - <http://tagaholic.me/>
134
- * [Nicholas Humfrey](http://github.com/njh) - <http://www.aelius.com/njh/>
135
- * [Fumihiro Kato](http://github.com/fumi) - <http://fumi.me/>
136
- * [David Nielsen](http://github.com/drankard) - <http://github.com/drankard>
137
- * [Thamaraiselvan Poomalai](http://github.com/selvan) - <http://softonaut.blogspot.com/>
138
- * [Michael Sokol](http://github.com/mikaa123) - <http://sokolmichael.com/>
139
- * [Yves Raimond](http://github.com/moustaki) - <http://moustaki.org/>
140
- * [Thomas Feron](http://github.com/thoferon) - <http://github.com/thoferon>
141
- * [Nick Gottlieb](http://github.com/ngottlieb) - <http://www.nicholasgottlieb.com>
142
-
143
- ##Contributing
144
- This repository uses [Git Flow](https://github.com/nvie/gitflow) to mange development and release activity. All submissions _must_ be on a feature branch based on the _develop_ branch to ease staging and integration.
145
-
146
- * Do your best to adhere to the existing coding conventions and idioms.
147
- * Don't use hard tabs, and don't leave trailing whitespace on any line.
148
- * Do document every method you add using [YARD][] annotations. Read the
149
- [tutorial][YARD-GS] or just look at the existing code for examples.
150
- * Don't touch the `.gemspec`, `VERSION` or `AUTHORS` files. If you need to
151
- change them, do so on your private branch only.
152
- * Do feel free to add yourself to the `CREDITS` file and the corresponding
153
- list in the the `README`. Alphabetical order applies.
154
- * Do note that in order for us to merge any non-trivial changes (as a rule
155
- of thumb, additions larger than about 15 lines of code), we need an
156
- explicit [public domain dedication][PDD] on record from you.
157
-
158
- ##Resources
159
-
160
- * <http://ruby-rdf.github.com/sparql-client/>
161
- * <http://github.com/ruby-rdf/sparql-client>
162
- * <http://rubygems.org/gems/sparql-client>
163
- * <http://rubyforge.org/projects/sparql/>
164
- * <http://raa.ruby-lang.org/project/sparql-client/>
165
- * <http://www.ohloh.net/p/rdf>
166
-
167
- ##License
168
-
169
- This is free and unencumbered public domain software. For more information,
170
- see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
171
-
172
- [Ruby]: http://ruby-lang.org/
173
- [RDF]: http://www.w3.org/RDF/
174
- [SPARQL]: http://en.wikipedia.org/wiki/SPARQL
175
- [SPARQL JSON]: http://www.w3.org/TR/rdf-sparql-json-res/
176
- [RDF.rb]: http://rubygems.org/gems/rdf
177
- [RDF.rb model]: http://blog.datagraph.org/2010/03/rdf-for-ruby
178
- [RDF::Repository]: http://rubydoc.info/github/ruby-rdf/rdf/RDF/Repository
179
- [DSL]: http://en.wikipedia.org/wiki/Domain-specific_language
180
- "domain-specific language"
181
- [YARD]: http://yardoc.org/
182
- [YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
183
- [PDD]: http://unlicense.org/#unlicensing-contributions
184
- [Backports]: http://rubygems.org/gems/backports