sparql-client 0.0.11 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +1 -0
- data/README +1 -0
- data/VERSION +1 -1
- data/lib/sparql/client.rb +6 -4
- data/lib/sparql/client/query.rb +10 -0
- data/lib/sparql/client/version.rb +2 -5
- metadata +66 -115
data/CREDITS
CHANGED
data/README
CHANGED
@@ -114,6 +114,7 @@ Contributors
|
|
114
114
|
* [David Nielsen](http://github.com/drankard) - <http://github.com/drankard>
|
115
115
|
* [Thamaraiselvan Poomalai](http://github.com/selvan) - <http://softonaut.blogspot.com/>
|
116
116
|
* [Gregg Kellogg](http://github.com/gkellogg) - <http://kellogg-assoc.com/>
|
117
|
+
* [Michael Sokol](http://github.com/mikaa123) - <http://sokolmichael.com/>
|
117
118
|
|
118
119
|
Contributing
|
119
120
|
------------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/sparql/client.rb
CHANGED
@@ -155,7 +155,7 @@ module SPARQL
|
|
155
155
|
|
156
156
|
##
|
157
157
|
# @param [String, Hash] json
|
158
|
-
# @return [
|
158
|
+
# @return [<RDF::Query::Solutions>]
|
159
159
|
# @see http://www.w3.org/TR/rdf-sparql-json-res/#results
|
160
160
|
def self.parse_json_bindings(json, nodes = {})
|
161
161
|
require 'json' unless defined?(::JSON)
|
@@ -165,12 +165,13 @@ module SPARQL
|
|
165
165
|
when json['boolean']
|
166
166
|
json['boolean']
|
167
167
|
when json['results']
|
168
|
-
json['results']['bindings'].map do |row|
|
168
|
+
solutions = json['results']['bindings'].map do |row|
|
169
169
|
row = row.inject({}) do |cols, (name, value)|
|
170
170
|
cols.merge(name.to_sym => parse_json_value(value))
|
171
171
|
end
|
172
172
|
RDF::Query::Solution.new(row)
|
173
173
|
end
|
174
|
+
RDF::Query::Solutions.new(solutions)
|
174
175
|
end
|
175
176
|
end
|
176
177
|
|
@@ -194,7 +195,7 @@ module SPARQL
|
|
194
195
|
|
195
196
|
##
|
196
197
|
# @param [String, REXML::Element] xml
|
197
|
-
# @return [
|
198
|
+
# @return [<RDF::Query::Solutions>]
|
198
199
|
# @see http://www.w3.org/TR/rdf-sparql-json-res/#results
|
199
200
|
def self.parse_xml_bindings(xml, nodes = {})
|
200
201
|
xml.force_encoding(::Encoding::UTF_8) if xml.respond_to?(:force_encoding)
|
@@ -205,7 +206,7 @@ module SPARQL
|
|
205
206
|
when boolean = xml.elements['boolean']
|
206
207
|
boolean.text == 'true'
|
207
208
|
when results = xml.elements['results']
|
208
|
-
results.elements.map do |result|
|
209
|
+
solutions = results.elements.map do |result|
|
209
210
|
row = {}
|
210
211
|
result.elements.each do |binding|
|
211
212
|
name = binding.attributes['name'].to_sym
|
@@ -214,6 +215,7 @@ module SPARQL
|
|
214
215
|
end
|
215
216
|
RDF::Query::Solution.new(row)
|
216
217
|
end
|
218
|
+
RDF::Query::Solutions.new(solutions)
|
217
219
|
end
|
218
220
|
end
|
219
221
|
|
data/lib/sparql/client/query.rb
CHANGED
@@ -248,6 +248,16 @@ module SPARQL; class Client
|
|
248
248
|
result.each_statement(&block)
|
249
249
|
end
|
250
250
|
|
251
|
+
# Enumerates over each matching query solution.
|
252
|
+
#
|
253
|
+
# @yield [solution]
|
254
|
+
# @yieldparam [RDF::Query::Solution] solution
|
255
|
+
# @return [Enumerator]
|
256
|
+
def each_solution(&block)
|
257
|
+
@solutions = result
|
258
|
+
super
|
259
|
+
end
|
260
|
+
|
251
261
|
##
|
252
262
|
# @return [Object]
|
253
263
|
def result
|
@@ -1,10 +1,7 @@
|
|
1
1
|
module SPARQL; class Client
|
2
2
|
module VERSION
|
3
|
-
|
4
|
-
MINOR =
|
5
|
-
TINY = 11
|
6
|
-
EXTRA = nil
|
7
|
-
|
3
|
+
VERSION_FILE = File.expand_path("../../../../VERSION", __FILE__)
|
4
|
+
MAJOR, MINOR, TINY, EXTRA = File.read(VERSION_FILE).chop.split(".")
|
8
5
|
STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.')
|
9
6
|
|
10
7
|
##
|
metadata
CHANGED
@@ -1,128 +1,89 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparql-client
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 11
|
10
|
-
version: 0.0.11
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Arto Bendiken
|
14
9
|
- Ben Lavender
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-03-20 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: json_pure
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70308448484680 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 4
|
33
|
-
- 2
|
34
|
-
version: 1.4.2
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.6.5
|
35
23
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: rdf
|
39
24
|
prerelease: false
|
40
|
-
|
25
|
+
version_requirements: *70308448484680
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rdf
|
28
|
+
requirement: &70308448484160 !ruby/object:Gem::Requirement
|
41
29
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
- 3
|
49
|
-
- 4
|
50
|
-
version: 0.3.4
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.3.5
|
51
34
|
type: :runtime
|
52
|
-
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: net-http-persistent
|
55
35
|
prerelease: false
|
56
|
-
|
36
|
+
version_requirements: *70308448484160
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: net-http-persistent
|
39
|
+
requirement: &70308448483680 !ruby/object:Gem::Requirement
|
57
40
|
none: false
|
58
|
-
requirements:
|
41
|
+
requirements:
|
59
42
|
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
hash: 5
|
62
|
-
segments:
|
63
|
-
- 1
|
64
|
-
- 4
|
65
|
-
- 1
|
43
|
+
- !ruby/object:Gem::Version
|
66
44
|
version: 1.4.1
|
67
45
|
type: :runtime
|
68
|
-
version_requirements: *id003
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: yard
|
71
46
|
prerelease: false
|
72
|
-
|
47
|
+
version_requirements: *70308448483680
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: yard
|
50
|
+
requirement: &70308448482980 !ruby/object:Gem::Requirement
|
73
51
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
segments:
|
79
|
-
- 0
|
80
|
-
- 6
|
81
|
-
- 0
|
82
|
-
version: 0.6.0
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.7.5
|
83
56
|
type: :development
|
84
|
-
version_requirements: *id004
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: rspec
|
87
57
|
prerelease: false
|
88
|
-
|
58
|
+
version_requirements: *70308448482980
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: rspec
|
61
|
+
requirement: &70308448482520 !ruby/object:Gem::Requirement
|
89
62
|
none: false
|
90
|
-
requirements:
|
91
|
-
- -
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
|
94
|
-
segments:
|
95
|
-
- 2
|
96
|
-
- 1
|
97
|
-
- 0
|
98
|
-
version: 2.1.0
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.8.0
|
99
67
|
type: :development
|
100
|
-
version_requirements: *id005
|
101
|
-
- !ruby/object:Gem::Dependency
|
102
|
-
name: rdf-spec
|
103
68
|
prerelease: false
|
104
|
-
|
69
|
+
version_requirements: *70308448482520
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rdf-spec
|
72
|
+
requirement: &70308448481940 !ruby/object:Gem::Requirement
|
105
73
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
segments:
|
111
|
-
- 0
|
112
|
-
- 3
|
113
|
-
- 0
|
114
|
-
version: 0.3.0
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.3.5
|
115
78
|
type: :development
|
116
|
-
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *70308448481940
|
117
81
|
description: SPARQL client for RDF.rb.
|
118
82
|
email: public-rdf-ruby@w3.org
|
119
83
|
executables: []
|
120
|
-
|
121
84
|
extensions: []
|
122
|
-
|
123
85
|
extra_rdoc_files: []
|
124
|
-
|
125
|
-
files:
|
86
|
+
files:
|
126
87
|
- AUTHORS
|
127
88
|
- CREDITS
|
128
89
|
- README
|
@@ -133,39 +94,29 @@ files:
|
|
133
94
|
- lib/sparql/client/version.rb
|
134
95
|
- lib/sparql/client.rb
|
135
96
|
homepage: http://sparql.rubyforge.org/client/
|
136
|
-
licenses:
|
97
|
+
licenses:
|
137
98
|
- Public Domain
|
138
99
|
post_install_message:
|
139
100
|
rdoc_options: []
|
140
|
-
|
141
|
-
require_paths:
|
101
|
+
require_paths:
|
142
102
|
- lib
|
143
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
104
|
none: false
|
145
|
-
requirements:
|
146
|
-
- -
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
hash: 53
|
149
|
-
segments:
|
150
|
-
- 1
|
151
|
-
- 8
|
152
|
-
- 1
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
153
108
|
version: 1.8.1
|
154
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
110
|
none: false
|
156
|
-
requirements:
|
157
|
-
- -
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
|
160
|
-
segments:
|
161
|
-
- 0
|
162
|
-
version: "0"
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
163
115
|
requirements: []
|
164
|
-
|
165
116
|
rubyforge_project: sparql
|
166
|
-
rubygems_version: 1.8.
|
117
|
+
rubygems_version: 1.8.17
|
167
118
|
signing_key:
|
168
119
|
specification_version: 3
|
169
120
|
summary: SPARQL client for RDF.rb.
|
170
121
|
test_files: []
|
171
|
-
|
122
|
+
has_rdoc: false
|