sparql-client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +2 -2
- data/VERSION +1 -1
- data/lib/sparql/client.rb +7 -6
- data/lib/sparql/client/query.rb +18 -6
- data/lib/sparql/client/repository.rb +3 -3
- metadata +48 -18
data/README
CHANGED
@@ -151,9 +151,9 @@ see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
|
151
151
|
[RDF]: http://www.w3.org/RDF/
|
152
152
|
[SPARQL]: http://en.wikipedia.org/wiki/SPARQL
|
153
153
|
[SPARQL JSON]: http://www.w3.org/TR/rdf-sparql-json-res/
|
154
|
-
[RDF.rb]: http://
|
154
|
+
[RDF.rb]: http://rubygems.org/gems/rdf
|
155
155
|
[RDF.rb model]: http://blog.datagraph.org/2010/03/rdf-for-ruby
|
156
|
-
[RDF::Repository]: http://
|
156
|
+
[RDF::Repository]: http://rubydoc.info/github/ruby-rdf/rdf/RDF/Repository
|
157
157
|
[DSL]: http://en.wikipedia.org/wiki/Domain-specific_language
|
158
158
|
"domain-specific language"
|
159
159
|
[YARD]: http://yardoc.org/
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/sparql/client.rb
CHANGED
@@ -57,7 +57,7 @@ module SPARQL
|
|
57
57
|
##
|
58
58
|
# Executes a tuple `SELECT` query.
|
59
59
|
#
|
60
|
-
# @param [Array<Symbol>]
|
60
|
+
# @param [Array<Symbol>] args
|
61
61
|
# @return [Query]
|
62
62
|
def select(*args)
|
63
63
|
call_query_method(:select, *args)
|
@@ -66,7 +66,7 @@ module SPARQL
|
|
66
66
|
##
|
67
67
|
# Executes a `DESCRIBE` query.
|
68
68
|
#
|
69
|
-
# @param [Array<Symbol, RDF::URI>]
|
69
|
+
# @param [Array<Symbol, RDF::URI>] args
|
70
70
|
# @return [Query]
|
71
71
|
def describe(*args)
|
72
72
|
call_query_method(:describe, *args)
|
@@ -75,7 +75,7 @@ module SPARQL
|
|
75
75
|
##
|
76
76
|
# Executes a graph `CONSTRUCT` query.
|
77
77
|
#
|
78
|
-
# @param [Array<Symbol>]
|
78
|
+
# @param [Array<Symbol>] args
|
79
79
|
# @return [Query]
|
80
80
|
def construct(*args)
|
81
81
|
call_query_method(:construct, *args)
|
@@ -102,7 +102,7 @@ module SPARQL
|
|
102
102
|
##
|
103
103
|
# Executes a SPARQL query and returns parsed results.
|
104
104
|
#
|
105
|
-
# @param [String, #to_s]
|
105
|
+
# @param [String, #to_s] query
|
106
106
|
# @param [Hash{Symbol => Object}] options
|
107
107
|
# @option options [String] :content_type
|
108
108
|
# @option options [Hash] :headers
|
@@ -114,7 +114,7 @@ module SPARQL
|
|
114
114
|
##
|
115
115
|
# Executes a SPARQL query and returns the Net::HTTP::Response of the result.
|
116
116
|
#
|
117
|
-
# @param [String, #to_s]
|
117
|
+
# @param [String, #to_s] query
|
118
118
|
# @param [Hash{Symbol => Object}] options
|
119
119
|
# @option options [String] :content_type
|
120
120
|
# @option options [Hash] :headers
|
@@ -293,7 +293,8 @@ module SPARQL
|
|
293
293
|
# @return [Net::HTTPResponse]
|
294
294
|
def get(query, headers = {}, &block)
|
295
295
|
url = self.url.dup
|
296
|
-
url.query_values
|
296
|
+
url.query_values ||= {}
|
297
|
+
url.query_values.merge!({:query => query.to_s})
|
297
298
|
|
298
299
|
request = Net::HTTP::Get.new(url.request_uri, @headers.merge(headers))
|
299
300
|
request.basic_auth url.user, url.password if url.user && !url.user.empty?
|
data/lib/sparql/client/query.rb
CHANGED
@@ -34,8 +34,11 @@ module SPARQL; class Client
|
|
34
34
|
# Creates a tuple `SELECT` query.
|
35
35
|
#
|
36
36
|
# @param [Array<Symbol>] variables
|
37
|
-
# @param [Hash{Symbol => Object}] options
|
38
37
|
# @return [Query]
|
38
|
+
#
|
39
|
+
# @overload self.select(*variables, options)
|
40
|
+
# @param [Array<Symbol>] variables
|
41
|
+
# @return [Query]
|
39
42
|
# @see http://www.w3.org/TR/rdf-sparql-query/#select
|
40
43
|
def self.select(*variables)
|
41
44
|
options = variables.last.is_a?(Hash) ? variables.pop : {}
|
@@ -46,8 +49,11 @@ module SPARQL; class Client
|
|
46
49
|
# Creates a `DESCRIBE` query.
|
47
50
|
#
|
48
51
|
# @param [Array<Symbol, RDF::URI>] variables
|
49
|
-
# @param [Hash{Symbol => Object}] options
|
50
52
|
# @return [Query]
|
53
|
+
#
|
54
|
+
# @overload self.describe(*variables, options)
|
55
|
+
# @param [Array<Symbol, RDF::URI>] variables
|
56
|
+
# @return [Query]
|
51
57
|
# @see http://www.w3.org/TR/rdf-sparql-query/#describe
|
52
58
|
def self.describe(*variables)
|
53
59
|
options = variables.last.is_a?(Hash) ? variables.pop : {}
|
@@ -58,8 +64,12 @@ module SPARQL; class Client
|
|
58
64
|
# Creates a graph `CONSTRUCT` query.
|
59
65
|
#
|
60
66
|
# @param [Array<RDF::Query::Pattern, Array>] patterns
|
61
|
-
# @param [Hash{Symbol => Object}] options
|
62
67
|
# @return [Query]
|
68
|
+
#
|
69
|
+
# @overload self.construct(*variables, options)
|
70
|
+
# @param [Array<RDF::Query::Pattern, Array>] patterns
|
71
|
+
# @param [Hash{Symbol => Object}] options
|
72
|
+
# @return [Query]
|
63
73
|
# @see http://www.w3.org/TR/rdf-sparql-query/#construct
|
64
74
|
def self.construct(*patterns)
|
65
75
|
options = patterns.last.is_a?(Hash) ? patterns.pop : {}
|
@@ -68,7 +78,9 @@ module SPARQL; class Client
|
|
68
78
|
|
69
79
|
##
|
70
80
|
# @param [Symbol, #to_s] form
|
71
|
-
# @
|
81
|
+
# @overload self.construct(*variables, options)
|
82
|
+
# @param [Symbol, #to_s] form
|
83
|
+
# @param [Hash{Symbol => Object}] options
|
72
84
|
# @yield [query]
|
73
85
|
# @yieldparam [Query]
|
74
86
|
def initialize(form = :ask, options = {}, &block)
|
@@ -112,7 +124,7 @@ module SPARQL; class Client
|
|
112
124
|
self
|
113
125
|
end
|
114
126
|
|
115
|
-
# @param RDF::URI uri
|
127
|
+
# @param [RDF::URI] uri
|
116
128
|
# @return [Query]
|
117
129
|
# @see http://www.w3.org/TR/rdf-sparql-query/#specDataset
|
118
130
|
def from(uri)
|
@@ -345,7 +357,7 @@ module SPARQL; class Client
|
|
345
357
|
##
|
346
358
|
# Serializes an RDF::Value into a format appropriate for select, construct, and where clauses
|
347
359
|
#
|
348
|
-
# @param [RDF::Value]
|
360
|
+
# @param [RDF::Value] value
|
349
361
|
# @return [String]
|
350
362
|
# @private
|
351
363
|
def serialize_value(value)
|
@@ -33,7 +33,7 @@ module SPARQL; class Client
|
|
33
33
|
##
|
34
34
|
# Returns `true` if this repository contains the given subject.
|
35
35
|
#
|
36
|
-
# @param [RDF::Resource]
|
36
|
+
# @param [RDF::Resource] subject
|
37
37
|
# @return [Boolean]
|
38
38
|
# @see RDF::Repository#has_subject?
|
39
39
|
def has_subject?(subject)
|
@@ -43,7 +43,7 @@ module SPARQL; class Client
|
|
43
43
|
##
|
44
44
|
# Returns `true` if this repository contains the given predicate.
|
45
45
|
#
|
46
|
-
# @param [RDF::URI]
|
46
|
+
# @param [RDF::URI] predicate
|
47
47
|
# @return [Boolean]
|
48
48
|
# @see RDF::Repository#has_predicate?
|
49
49
|
def has_predicate?(predicate)
|
@@ -53,7 +53,7 @@ module SPARQL; class Client
|
|
53
53
|
##
|
54
54
|
# Returns `true` if this repository contains the given object.
|
55
55
|
#
|
56
|
-
# @param [RDF::Value]
|
56
|
+
# @param [RDF::Value] object
|
57
57
|
# @return [Boolean]
|
58
58
|
# @see RDF::Repository#has_object?
|
59
59
|
def has_object?(object)
|
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: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-06-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json_pure
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,15 @@ dependencies:
|
|
22
22
|
version: 1.6.5
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 1.6.5
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: rdf
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,21 +38,31 @@ dependencies:
|
|
33
38
|
version: 0.3.5
|
34
39
|
type: :runtime
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.3.5
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: net-http-persistent
|
39
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
|
-
- -
|
52
|
+
- - ! '>='
|
43
53
|
- !ruby/object:Gem::Version
|
44
54
|
version: 1.4.1
|
45
55
|
type: :runtime
|
46
56
|
prerelease: false
|
47
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.4.1
|
48
63
|
- !ruby/object:Gem::Dependency
|
49
64
|
name: yard
|
50
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
51
66
|
none: false
|
52
67
|
requirements:
|
53
68
|
- - ! '>='
|
@@ -55,21 +70,31 @@ dependencies:
|
|
55
70
|
version: 0.7.5
|
56
71
|
type: :development
|
57
72
|
prerelease: false
|
58
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 0.7.5
|
59
79
|
- !ruby/object:Gem::Dependency
|
60
80
|
name: rspec
|
61
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
62
82
|
none: false
|
63
83
|
requirements:
|
64
84
|
- - ! '>='
|
65
85
|
- !ruby/object:Gem::Version
|
66
|
-
version: 2.
|
86
|
+
version: 2.10.0
|
67
87
|
type: :development
|
68
88
|
prerelease: false
|
69
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 2.10.0
|
70
95
|
- !ruby/object:Gem::Dependency
|
71
96
|
name: rdf-spec
|
72
|
-
requirement:
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
73
98
|
none: false
|
74
99
|
requirements:
|
75
100
|
- - ! '>='
|
@@ -77,7 +102,12 @@ dependencies:
|
|
77
102
|
version: 0.3.5
|
78
103
|
type: :development
|
79
104
|
prerelease: false
|
80
|
-
version_requirements:
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.3.5
|
81
111
|
description: SPARQL client for RDF.rb.
|
82
112
|
email: public-rdf-ruby@w3.org
|
83
113
|
executables: []
|
@@ -93,7 +123,7 @@ files:
|
|
93
123
|
- lib/sparql/client/repository.rb
|
94
124
|
- lib/sparql/client/version.rb
|
95
125
|
- lib/sparql/client.rb
|
96
|
-
homepage: http://
|
126
|
+
homepage: http://github.com/ruby-rdf/sparql-client
|
97
127
|
licenses:
|
98
128
|
- Public Domain
|
99
129
|
post_install_message:
|
@@ -114,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
144
|
version: '0'
|
115
145
|
requirements: []
|
116
146
|
rubyforge_project: sparql
|
117
|
-
rubygems_version: 1.8.
|
147
|
+
rubygems_version: 1.8.24
|
118
148
|
signing_key:
|
119
149
|
specification_version: 3
|
120
150
|
summary: SPARQL client for RDF.rb.
|