sparql-client 0.1.1.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +15 -26
- data/VERSION +1 -1
- data/lib/sparql/client/query.rb +22 -2
- metadata +40 -39
data/README
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
SPARQL Client for RDF.rb
|
2
|
-
========================
|
1
|
+
#SPARQL Client for RDF.rb
|
3
2
|
|
4
3
|
This is a [Ruby][] implementation of a [SPARQL][] client for [RDF.rb][].
|
4
|
+
[![Build Status](https://secure.travis-ci.org/ruby-rdf/sparql-client.png?branch=master)](http://travis-ci.org/ruby-rdf/sparql-client)
|
5
5
|
|
6
6
|
* <http://github.com/bendiken/sparql-client>
|
7
7
|
|
8
|
-
Features
|
9
|
-
--------
|
8
|
+
##Features
|
10
9
|
|
11
10
|
* Executes queries against any SPARQL 1.0-compatible endpoints over HTTP.
|
12
11
|
* Provides a query builder [DSL][] for `ASK`, `SELECT`, `DESCRIBE` and
|
@@ -18,8 +17,7 @@ Features
|
|
18
17
|
* Supports accessing endpoints as read-only [`RDF::Repository`][RDF::Repository]
|
19
18
|
instances.
|
20
19
|
|
21
|
-
Examples
|
22
|
-
--------
|
20
|
+
##Examples
|
23
21
|
|
24
22
|
require 'sparql/client'
|
25
23
|
|
@@ -56,8 +54,7 @@ Examples
|
|
56
54
|
|
57
55
|
puts result.inspect #=> true or false
|
58
56
|
|
59
|
-
Documentation
|
60
|
-
-------------
|
57
|
+
##Documentation
|
61
58
|
|
62
59
|
<http://sparql.rubyforge.org/client/>
|
63
60
|
|
@@ -65,23 +62,20 @@ Documentation
|
|
65
62
|
* {SPARQL::Client::Query}
|
66
63
|
* {SPARQL::Client::Repository}
|
67
64
|
|
68
|
-
Dependencies
|
69
|
-
------------
|
65
|
+
##Dependencies
|
70
66
|
|
71
67
|
* [Ruby](http://ruby-lang.org/) (>= 1.8.7) or (>= 1.8.1 with [Backports][])
|
72
68
|
* [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.3.0)
|
73
69
|
* [JSON](http://rubygems.org/gems/json_pure) (>= 1.4.2)
|
74
70
|
|
75
|
-
Installation
|
76
|
-
------------
|
71
|
+
##Installation
|
77
72
|
|
78
73
|
The recommended installation method is via [RubyGems](http://rubygems.org/).
|
79
74
|
To install the latest official release of the `SPARQL::Client` gem, do:
|
80
75
|
|
81
76
|
% [sudo] gem install sparql-client
|
82
77
|
|
83
|
-
Download
|
84
|
-
--------
|
78
|
+
##Download
|
85
79
|
|
86
80
|
To get a local working copy of the development repository, do:
|
87
81
|
|
@@ -92,19 +86,16 @@ follows:
|
|
92
86
|
|
93
87
|
% wget http://github.com/bendiken/sparql-client/tarball/master
|
94
88
|
|
95
|
-
Mailing List
|
96
|
-
------------
|
89
|
+
##Mailing List
|
97
90
|
|
98
91
|
* <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
|
99
92
|
|
100
|
-
Authors
|
101
|
-
-------
|
93
|
+
##Authors
|
102
94
|
|
103
95
|
* [Arto Bendiken](http://github.com/bendiken) - <http://ar.to/>
|
104
96
|
* [Ben Lavender](http://github.com/bhuga) - <http://bhuga.net/>
|
105
97
|
|
106
|
-
Contributors
|
107
|
-
------------
|
98
|
+
##Contributors
|
108
99
|
|
109
100
|
* [Christoph Badura](http://github.com/b4d) - <http://github.com/b4d>
|
110
101
|
* [James Hetherington](http://github.com/jamespjh) - <http://twitter.com/jamespjh>
|
@@ -115,9 +106,9 @@ Contributors
|
|
115
106
|
* [Thamaraiselvan Poomalai](http://github.com/selvan) - <http://softonaut.blogspot.com/>
|
116
107
|
* [Gregg Kellogg](http://github.com/gkellogg) - <http://kellogg-assoc.com/>
|
117
108
|
* [Michael Sokol](http://github.com/mikaa123) - <http://sokolmichael.com/>
|
109
|
+
* [Yves Raimond](http://github.com/moustaki) - <http://moustaki.org/>
|
118
110
|
|
119
|
-
Contributing
|
120
|
-
------------
|
111
|
+
##Contributing
|
121
112
|
|
122
113
|
* Do your best to adhere to the existing coding conventions and idioms.
|
123
114
|
* Don't use hard tabs, and don't leave trailing whitespace on any line.
|
@@ -131,8 +122,7 @@ Contributing
|
|
131
122
|
of thumb, additions larger than about 15 lines of code), we need an
|
132
123
|
explicit [public domain dedication][PDD] on record from you.
|
133
124
|
|
134
|
-
Resources
|
135
|
-
---------
|
125
|
+
##Resources
|
136
126
|
|
137
127
|
* <http://sparql.rubyforge.org/client/>
|
138
128
|
* <http://github.com/bendiken/sparql-client>
|
@@ -141,8 +131,7 @@ Resources
|
|
141
131
|
* <http://raa.ruby-lang.org/project/sparql-client/>
|
142
132
|
* <http://www.ohloh.net/p/rdf>
|
143
133
|
|
144
|
-
License
|
145
|
-
-------
|
134
|
+
##License
|
146
135
|
|
147
136
|
This is free and unencumbered public domain software. For more information,
|
148
137
|
see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/sparql/client/query.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
module SPARQL; class Client
|
3
2
|
##
|
4
3
|
# A SPARQL query builder.
|
@@ -154,6 +153,17 @@ module SPARQL; class Client
|
|
154
153
|
|
155
154
|
alias_method :order_by, :order
|
156
155
|
|
156
|
+
##
|
157
|
+
# @param [Array<Symbol, String>] variables
|
158
|
+
# @return [Query]
|
159
|
+
# @see http://www.w3.org/TR/sparql11-query/#groupby
|
160
|
+
def group(*variables)
|
161
|
+
options[:group_by] = variables
|
162
|
+
self
|
163
|
+
end
|
164
|
+
|
165
|
+
alias_method :group_by, :group
|
166
|
+
|
157
167
|
##
|
158
168
|
# @return [Query]
|
159
169
|
# @see http://www.w3.org/TR/rdf-sparql-query/#modDistinct
|
@@ -226,7 +236,7 @@ module SPARQL; class Client
|
|
226
236
|
##
|
227
237
|
# @private
|
228
238
|
def filter(string)
|
229
|
-
(options[:filters] ||= []) << string
|
239
|
+
((options[:filters] ||= []) << string) if string and not string.empty
|
230
240
|
self
|
231
241
|
end
|
232
242
|
|
@@ -292,7 +302,12 @@ module SPARQL; class Client
|
|
292
302
|
when :select, :describe
|
293
303
|
buffer << 'DISTINCT' if options[:distinct]
|
294
304
|
buffer << 'REDUCED' if options[:reduced]
|
305
|
+
buffer << '( COUNT' if options[:count]
|
295
306
|
buffer << (values.empty? ? '*' : values.map { |v| serialize_value(v[1]) }.join(' '))
|
307
|
+
if options[:count]
|
308
|
+
var = options[:count]
|
309
|
+
buffer << 'AS ' + (var.is_a?(String) ? var : "?#{var}") + ' )'
|
310
|
+
end
|
296
311
|
when :construct
|
297
312
|
buffer << '{'
|
298
313
|
buffer += serialize_patterns(options[:template])
|
@@ -317,6 +332,11 @@ module SPARQL; class Client
|
|
317
332
|
buffer << '}'
|
318
333
|
end
|
319
334
|
|
335
|
+
if options[:group_by]
|
336
|
+
buffer << 'GROUP BY'
|
337
|
+
buffer += options[:group_by].map { |var| var.is_a?(String) ? var : "?#{var}" }
|
338
|
+
end
|
339
|
+
|
320
340
|
if options[:order_by]
|
321
341
|
buffer << 'ORDER BY'
|
322
342
|
buffer += options[:order_by].map { |var| var.is_a?(String) ? var : "?#{var}" }
|
metadata
CHANGED
@@ -1,113 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparql-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Arto Bendiken
|
9
9
|
- Ben Lavender
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-09-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json_pure
|
17
|
-
|
18
|
-
none: false
|
17
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
18
|
requirements:
|
20
19
|
- - ! '>='
|
21
20
|
- !ruby/object:Gem::Version
|
22
21
|
version: 1.6.5
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
22
|
none: false
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
27
24
|
requirements:
|
28
25
|
- - ! '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: 1.6.5
|
28
|
+
none: false
|
29
|
+
prerelease: false
|
30
|
+
type: :runtime
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: rdf
|
33
|
-
|
34
|
-
none: false
|
33
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
34
|
requirements:
|
36
35
|
- - ! '>='
|
37
36
|
- !ruby/object:Gem::Version
|
38
37
|
version: 0.3.5
|
39
|
-
type: :runtime
|
40
|
-
prerelease: false
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
42
38
|
none: false
|
39
|
+
requirement: !ruby/object:Gem::Requirement
|
43
40
|
requirements:
|
44
41
|
- - ! '>='
|
45
42
|
- !ruby/object:Gem::Version
|
46
43
|
version: 0.3.5
|
44
|
+
none: false
|
45
|
+
prerelease: false
|
46
|
+
type: :runtime
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: net-http-persistent
|
49
|
-
|
50
|
-
none: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
52
51
|
- - ! '>='
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: 1.4.1
|
55
|
-
type: :runtime
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: !ruby/object:Gem::Requirement
|
58
54
|
none: false
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
59
56
|
requirements:
|
60
57
|
- - ! '>='
|
61
58
|
- !ruby/object:Gem::Version
|
62
59
|
version: 1.4.1
|
60
|
+
none: false
|
61
|
+
prerelease: false
|
62
|
+
type: :runtime
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: yard
|
65
|
-
|
66
|
-
none: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
66
|
requirements:
|
68
67
|
- - ! '>='
|
69
68
|
- !ruby/object:Gem::Version
|
70
69
|
version: 0.7.5
|
71
|
-
type: :development
|
72
|
-
prerelease: false
|
73
|
-
version_requirements: !ruby/object:Gem::Requirement
|
74
70
|
none: false
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
75
72
|
requirements:
|
76
73
|
- - ! '>='
|
77
74
|
- !ruby/object:Gem::Version
|
78
75
|
version: 0.7.5
|
76
|
+
none: false
|
77
|
+
prerelease: false
|
78
|
+
type: :development
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
80
|
name: rspec
|
81
|
-
|
82
|
-
none: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
82
|
requirements:
|
84
83
|
- - ! '>='
|
85
84
|
- !ruby/object:Gem::Version
|
86
85
|
version: 2.10.0
|
87
|
-
type: :development
|
88
|
-
prerelease: false
|
89
|
-
version_requirements: !ruby/object:Gem::Requirement
|
90
86
|
none: false
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
91
88
|
requirements:
|
92
89
|
- - ! '>='
|
93
90
|
- !ruby/object:Gem::Version
|
94
91
|
version: 2.10.0
|
92
|
+
none: false
|
93
|
+
prerelease: false
|
94
|
+
type: :development
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: rdf-spec
|
97
|
-
|
98
|
-
none: false
|
97
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
98
|
requirements:
|
100
99
|
- - ! '>='
|
101
100
|
- !ruby/object:Gem::Version
|
102
101
|
version: 0.3.5
|
103
|
-
type: :development
|
104
|
-
prerelease: false
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
102
|
none: false
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
107
104
|
requirements:
|
108
105
|
- - ! '>='
|
109
106
|
- !ruby/object:Gem::Version
|
110
107
|
version: 0.3.5
|
108
|
+
none: false
|
109
|
+
prerelease: false
|
110
|
+
type: :development
|
111
111
|
description: SPARQL client for RDF.rb.
|
112
112
|
email: public-rdf-ruby@w3.org
|
113
113
|
executables: []
|
@@ -119,34 +119,35 @@ files:
|
|
119
119
|
- README
|
120
120
|
- UNLICENSE
|
121
121
|
- VERSION
|
122
|
+
- lib/sparql/client.rb
|
122
123
|
- lib/sparql/client/query.rb
|
123
124
|
- lib/sparql/client/repository.rb
|
124
125
|
- lib/sparql/client/version.rb
|
125
|
-
- lib/sparql/client.rb
|
126
126
|
homepage: http://github.com/ruby-rdf/sparql-client
|
127
127
|
licenses:
|
128
128
|
- Public Domain
|
129
|
-
post_install_message:
|
129
|
+
post_install_message:
|
130
130
|
rdoc_options: []
|
131
131
|
require_paths:
|
132
132
|
- lib
|
133
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
-
none: false
|
135
134
|
requirements:
|
136
135
|
- - ! '>='
|
137
136
|
- !ruby/object:Gem::Version
|
138
137
|
version: 1.8.1
|
139
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
138
|
none: false
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
140
|
requirements:
|
142
141
|
- - ! '>='
|
143
142
|
- !ruby/object:Gem::Version
|
144
143
|
version: '0'
|
144
|
+
none: false
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project: sparql
|
147
147
|
rubygems_version: 1.8.24
|
148
|
-
signing_key:
|
148
|
+
signing_key:
|
149
149
|
specification_version: 3
|
150
150
|
summary: SPARQL client for RDF.rb.
|
151
151
|
test_files: []
|
152
152
|
has_rdoc: false
|
153
|
+
...
|