sparql-client 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CREDITS +1 -0
- data/README +9 -6
- data/VERSION +1 -1
- data/lib/sparql/client.rb +1 -1
- data/lib/sparql/client/query.rb +9 -1
- metadata +5 -19
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZWRmNDMzMmY0MmFhNTI2MDc1NTdkNmM5YTk3YWJlYjhlOGI5NzM4OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Y2I2MTVhNDhlYzU3MDI0YWRmNjJjM2ZkOGI5NGI4ZTAyN2RiMWU0Nw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZjBlOTRmOTViNzY1ZGE5ZjVkMGI2NWMzM2MzNzVhNjNjNDMwYTRmMjVkYWQ4
|
10
|
+
MjBkNjRjNDAxNWFkNTA1MDYwMTczNTU4NzkzMmVjZGJjYWUwMmE4YjRkYzQw
|
11
|
+
Zjg2M2M0ODI5ODBiZjVlZmNhZjY3ZjU2ZGVkZWI1OGFjMWJhNmI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ODMyN2MzNjk0NWQyMzMwYmViNDNhYTgxODJhOGM3YjRkM2UwMjdlODA4ZDlk
|
14
|
+
MGVhNzk4NTY3NWUzN2U3OTkzZjIzMzc2MWYwNDI0MzNhMTI1MDBhNGQwYjNh
|
15
|
+
Y2E2NjM3YWU0MzBlY2UwYjY4NGY4N2YyM2VjMWM1YTEwNzQyMzI=
|
data/CREDITS
CHANGED
data/README
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
#SPARQL Client for RDF.rb
|
2
2
|
|
3
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
4
|
|
6
5
|
* <http://ruby-rdf.github.com/sparql-client/>
|
7
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
|
+
|
8
10
|
##Features
|
9
11
|
|
10
12
|
* Executes queries against any SPARQL 1.0-compatible endpoint over HTTP.
|
@@ -21,21 +23,21 @@ This is a [Ruby][] implementation of a [SPARQL][] client for [RDF.rb][].
|
|
21
23
|
##Examples
|
22
24
|
|
23
25
|
require 'sparql/client'
|
24
|
-
|
26
|
+
|
25
27
|
sparql = SPARQL::Client.new("http://dbpedia.org/sparql")
|
26
28
|
|
27
29
|
### Executing a boolean query and outputting the result
|
28
30
|
|
29
31
|
# ASK WHERE { ?s ?p ?o }
|
30
32
|
result = sparql.ask.whether([:s, :p, :o]).true?
|
31
|
-
|
33
|
+
|
32
34
|
puts result.inspect #=> true or false
|
33
35
|
|
34
36
|
### Executing a tuple query and iterating over the returned solutions
|
35
37
|
|
36
38
|
# SELECT * WHERE { ?s ?p ?o } OFFSET 100 LIMIT 10
|
37
39
|
query = sparql.select.where([:s, :p, :o]).offset(100).limit(10)
|
38
|
-
|
40
|
+
|
39
41
|
query.each_solution do |solution|
|
40
42
|
puts solution.inspect
|
41
43
|
end
|
@@ -44,7 +46,7 @@ This is a [Ruby][] implementation of a [SPARQL][] client for [RDF.rb][].
|
|
44
46
|
|
45
47
|
# CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o } LIMIT 10
|
46
48
|
query = sparql.construct([:s, :p, :o]).where([:s, :p, :o]).limit(10)
|
47
|
-
|
49
|
+
|
48
50
|
query.each_statement do |statement|
|
49
51
|
puts statement.inspect
|
50
52
|
end
|
@@ -52,7 +54,7 @@ This is a [Ruby][] implementation of a [SPARQL][] client for [RDF.rb][].
|
|
52
54
|
### Executing an arbitrary textual SPARQL query string
|
53
55
|
|
54
56
|
result = sparql.query("ASK WHERE { ?s ?p ?o }")
|
55
|
-
|
57
|
+
|
56
58
|
puts result.inspect #=> true or false
|
57
59
|
|
58
60
|
##Documentation
|
@@ -107,6 +109,7 @@ follows:
|
|
107
109
|
* [Thamaraiselvan Poomalai](http://github.com/selvan) - <http://softonaut.blogspot.com/>
|
108
110
|
* [Michael Sokol](http://github.com/mikaa123) - <http://sokolmichael.com/>
|
109
111
|
* [Yves Raimond](http://github.com/moustaki) - <http://moustaki.org/>
|
112
|
+
* [Thomas Feron](http://github.com/thoferon) - <http://github.com/thoferon>
|
110
113
|
|
111
114
|
##Contributing
|
112
115
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/sparql/client.rb
CHANGED
@@ -505,7 +505,7 @@ module SPARQL
|
|
505
505
|
request['Content-Type'] = 'application/sparql-' + (@op || :query).to_s
|
506
506
|
request.body = query.to_s
|
507
507
|
when '1.0'
|
508
|
-
request.set_form_data(:query => query.to_s)
|
508
|
+
request.set_form_data((@op || :query) => query.to_s)
|
509
509
|
else
|
510
510
|
raise ArgumentError, "unknown SPARQL protocol version: #{self.options[:protocol].inspect}"
|
511
511
|
end
|
data/lib/sparql/client/query.rb
CHANGED
@@ -83,6 +83,7 @@ module SPARQL; class Client
|
|
83
83
|
# @yield [query]
|
84
84
|
# @yieldparam [Query]
|
85
85
|
def initialize(form = :ask, options = {}, &block)
|
86
|
+
@subqueries = []
|
86
87
|
@form = form.respond_to?(:to_sym) ? form.to_sym : form.to_s.to_sym
|
87
88
|
super([], options, &block)
|
88
89
|
end
|
@@ -136,8 +137,10 @@ module SPARQL; class Client
|
|
136
137
|
# @param [Array<RDF::Query::Pattern, Array>] patterns
|
137
138
|
# @return [Query]
|
138
139
|
# @see http://www.w3.org/TR/sparql11-query/#GraphPattern
|
139
|
-
def where(*
|
140
|
+
def where(*patterns_queries)
|
141
|
+
subqueries, patterns = patterns_queries.partition {|pq| pq.is_a? SPARQL::Client::Query}
|
140
142
|
@patterns += build_patterns(patterns)
|
143
|
+
@subqueries += subqueries
|
141
144
|
self
|
142
145
|
end
|
143
146
|
|
@@ -341,6 +344,11 @@ module SPARQL; class Client
|
|
341
344
|
buffer << 'GRAPH ' + SPARQL::Client.serialize_value(options[:graph])
|
342
345
|
buffer << '{'
|
343
346
|
end
|
347
|
+
|
348
|
+
@subqueries.each do |sq|
|
349
|
+
buffer << "{ #{sq.to_s} } ."
|
350
|
+
end
|
351
|
+
|
344
352
|
buffer += serialize_patterns(patterns)
|
345
353
|
if options[:optionals]
|
346
354
|
options[:optionals].each do |patterns|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparql-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Arto Bendiken
|
@@ -11,12 +10,11 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2013-
|
13
|
+
date: 2013-06-05 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: rdf
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
19
|
- - ! '>='
|
22
20
|
- !ruby/object:Gem::Version
|
@@ -24,7 +22,6 @@ dependencies:
|
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
26
|
- - ! '>='
|
30
27
|
- !ruby/object:Gem::Version
|
@@ -32,7 +29,6 @@ dependencies:
|
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: net-http-persistent
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
33
|
- - ! '>='
|
38
34
|
- !ruby/object:Gem::Version
|
@@ -40,7 +36,6 @@ dependencies:
|
|
40
36
|
type: :runtime
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
40
|
- - ! '>='
|
46
41
|
- !ruby/object:Gem::Version
|
@@ -48,7 +43,6 @@ dependencies:
|
|
48
43
|
- !ruby/object:Gem::Dependency
|
49
44
|
name: json_pure
|
50
45
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
46
|
requirements:
|
53
47
|
- - ! '>='
|
54
48
|
- !ruby/object:Gem::Version
|
@@ -56,7 +50,6 @@ dependencies:
|
|
56
50
|
type: :runtime
|
57
51
|
prerelease: false
|
58
52
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
53
|
requirements:
|
61
54
|
- - ! '>='
|
62
55
|
- !ruby/object:Gem::Version
|
@@ -64,7 +57,6 @@ dependencies:
|
|
64
57
|
- !ruby/object:Gem::Dependency
|
65
58
|
name: rdf-spec
|
66
59
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
60
|
requirements:
|
69
61
|
- - ! '>='
|
70
62
|
- !ruby/object:Gem::Version
|
@@ -72,7 +64,6 @@ dependencies:
|
|
72
64
|
type: :development
|
73
65
|
prerelease: false
|
74
66
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
67
|
requirements:
|
77
68
|
- - ! '>='
|
78
69
|
- !ruby/object:Gem::Version
|
@@ -80,7 +71,6 @@ dependencies:
|
|
80
71
|
- !ruby/object:Gem::Dependency
|
81
72
|
name: rspec
|
82
73
|
requirement: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
74
|
requirements:
|
85
75
|
- - ! '>='
|
86
76
|
- !ruby/object:Gem::Version
|
@@ -88,7 +78,6 @@ dependencies:
|
|
88
78
|
type: :development
|
89
79
|
prerelease: false
|
90
80
|
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
81
|
requirements:
|
93
82
|
- - ! '>='
|
94
83
|
- !ruby/object:Gem::Version
|
@@ -96,7 +85,6 @@ dependencies:
|
|
96
85
|
- !ruby/object:Gem::Dependency
|
97
86
|
name: yard
|
98
87
|
requirement: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
88
|
requirements:
|
101
89
|
- - ! '>='
|
102
90
|
- !ruby/object:Gem::Version
|
@@ -104,7 +92,6 @@ dependencies:
|
|
104
92
|
type: :development
|
105
93
|
prerelease: false
|
106
94
|
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
95
|
requirements:
|
109
96
|
- - ! '>='
|
110
97
|
- !ruby/object:Gem::Version
|
@@ -128,27 +115,26 @@ files:
|
|
128
115
|
homepage: http://ruby-rdf.github.com/sparql-client/
|
129
116
|
licenses:
|
130
117
|
- Public Domain
|
118
|
+
metadata: {}
|
131
119
|
post_install_message:
|
132
120
|
rdoc_options: []
|
133
121
|
require_paths:
|
134
122
|
- lib
|
135
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
-
none: false
|
137
124
|
requirements:
|
138
125
|
- - ! '>='
|
139
126
|
- !ruby/object:Gem::Version
|
140
127
|
version: 1.8.1
|
141
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
-
none: false
|
143
129
|
requirements:
|
144
130
|
- - ! '>='
|
145
131
|
- !ruby/object:Gem::Version
|
146
132
|
version: '0'
|
147
133
|
requirements: []
|
148
134
|
rubyforge_project: sparql
|
149
|
-
rubygems_version:
|
135
|
+
rubygems_version: 2.0.3
|
150
136
|
signing_key:
|
151
|
-
specification_version:
|
137
|
+
specification_version: 4
|
152
138
|
summary: SPARQL client for RDF.rb.
|
153
139
|
test_files: []
|
154
140
|
has_rdoc: false
|