rdf-do 1.1.0 → 1.99.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README +2 -2
- data/VERSION +1 -1
- data/lib/rdf/do.rb +23 -20
- data/lib/rdf/do/adapters/defaults.rb +6 -5
- metadata +50 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3802161e6db4773dc64f60c6b5b723dac84106ff
|
4
|
+
data.tar.gz: d6ebd5979c580823d612bc9846eefbad20eb1837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7501062411761e66bd694a42d753522013d9e3490d42283086d1c1d5b9d3e731ac905c5685113fbab1137679febb7dd4d2d849d2e105cca68d3bcab4c2708760
|
7
|
+
data.tar.gz: d54e69113b0f9e3a64473284acf5e0d03813cf399e07d3860ca8f2edb1e39eada8ed9f865fb3d178bdc92bf77bb3b7145918b4759bb52c44d82019d3bc0c2e15
|
data/README
CHANGED
@@ -73,13 +73,13 @@ Example:
|
|
73
73
|
#=> #<RDF::URI(http://datagraph.org/jhacker/foaf)>
|
74
74
|
|
75
75
|
# Delete everything to do with it
|
76
|
-
jhacker_statements = repo.query(:
|
76
|
+
jhacker_statements = repo.query(subject: jhacker)
|
77
77
|
repo.delete *jhacker_statements
|
78
78
|
repo.count
|
79
79
|
#=> 7
|
80
80
|
|
81
81
|
# with Postgres, we could have done this, but SQLite gives us a locking error:
|
82
|
-
# repo.delete(*repo.query(:
|
82
|
+
# repo.delete(*repo.query(subject: jhacker))
|
83
83
|
|
84
84
|
# Changed our mind--bring it back
|
85
85
|
repo.insert *jhacker_statements
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.99.0
|
data/lib/rdf/do.rb
CHANGED
@@ -59,7 +59,7 @@ module RDF
|
|
59
59
|
# @see RDF::Mutable#insert_statement
|
60
60
|
def supports?(feature)
|
61
61
|
case feature.to_sym
|
62
|
-
when :
|
62
|
+
when :graph_name then true
|
63
63
|
else false
|
64
64
|
end
|
65
65
|
end
|
@@ -124,14 +124,14 @@ module RDF
|
|
124
124
|
count = 0
|
125
125
|
statements.__send__(each) do |s|
|
126
126
|
count += 1
|
127
|
-
args += [serialize(s.subject),serialize(s.predicate), serialize(s.object), serialize(s.
|
127
|
+
args += [serialize(s.subject),serialize(s.predicate), serialize(s.object), serialize(s.graph_name)]
|
128
128
|
end
|
129
129
|
query = @adapter.multiple_insert_sql(count)
|
130
130
|
exec(query,*(args.flatten))
|
131
131
|
else
|
132
132
|
query = @adapter.insert_sql
|
133
133
|
statements.each do |s|
|
134
|
-
exec(query, serialize(s.subject),serialize(s.predicate), serialize(s.object), serialize(s.
|
134
|
+
exec(query, serialize(s.subject),serialize(s.predicate), serialize(s.object), serialize(s.graph_name))
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
@@ -145,7 +145,7 @@ module RDF
|
|
145
145
|
def delete_statements(statements)
|
146
146
|
query = @adapter.delete_sql
|
147
147
|
statements.each do |s|
|
148
|
-
exec(query, serialize(s.subject), serialize(s.predicate), serialize(s.object), serialize(s.
|
148
|
+
exec(query, serialize(s.subject), serialize(s.predicate), serialize(s.object), serialize(s.graph_name))
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
@@ -222,10 +222,10 @@ module RDF
|
|
222
222
|
reader = result(@adapter.each_sql)
|
223
223
|
while reader.next!
|
224
224
|
block.call(RDF::Statement.new(
|
225
|
-
:
|
226
|
-
:
|
227
|
-
:
|
228
|
-
:
|
225
|
+
subject: unserialize(reader.values[0]),
|
226
|
+
predicate: unserialize(reader.values[1]),
|
227
|
+
object: unserialize(reader.values[2]),
|
228
|
+
graph_name: unserialize(reader.values[3])))
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
@@ -275,18 +275,21 @@ module RDF
|
|
275
275
|
end
|
276
276
|
|
277
277
|
##
|
278
|
-
# Iterate over all RDF::Resource
|
278
|
+
# Iterate over all RDF::Resource graph names in this repository.
|
279
279
|
#
|
280
|
-
# @see RDF::Enumerable#
|
281
|
-
# @yield
|
282
|
-
# @yieldparam [RDF::
|
280
|
+
# @see RDF::Enumerable#each_graph
|
281
|
+
# @yield graph
|
282
|
+
# @yieldparam [RDF::Graph] graph
|
283
283
|
# @return [Enumerable::Enumerator, void]
|
284
|
-
def
|
285
|
-
return enum_for(:
|
284
|
+
def each_graph(&block)
|
285
|
+
return enum_for(:each_graph) unless block_given?
|
286
|
+
|
287
|
+
# Default graph
|
288
|
+
yield RDF::Graph.new(nil, data: self)
|
286
289
|
reader = result(@adapter.each_context_sql)
|
287
290
|
while reader.next!
|
288
|
-
|
289
|
-
|
291
|
+
graph_name = unserialize(reader.values[0])
|
292
|
+
yield RDF::Graph.new(graph_name, data: self)
|
290
293
|
end
|
291
294
|
end
|
292
295
|
|
@@ -320,10 +323,10 @@ module RDF
|
|
320
323
|
reader = @adapter.query(self,pattern.to_hash)
|
321
324
|
while reader.next!
|
322
325
|
yield RDF::Statement.new(
|
323
|
-
:
|
324
|
-
:
|
325
|
-
:
|
326
|
-
:
|
326
|
+
subject: unserialize(reader.values[0]),
|
327
|
+
predicate: unserialize(reader.values[1]),
|
328
|
+
object: unserialize(reader.values[2]),
|
329
|
+
graph_name: unserialize(reader.values[3]))
|
327
330
|
end
|
328
331
|
end
|
329
332
|
|
@@ -49,23 +49,24 @@ module RDF::DataObjects
|
|
49
49
|
# Supports `false` for a specifically nil value representing the default context.
|
50
50
|
#
|
51
51
|
# @example
|
52
|
-
# adapter.query(repository, :
|
52
|
+
# adapter.query(repository, predicate: predicate)
|
53
53
|
# @return [DataObjects::Result]
|
54
54
|
def query(repository, hash = {})
|
55
55
|
return repository.result(each_sql) if hash.empty?
|
56
56
|
conditions = []
|
57
57
|
params = []
|
58
|
-
[:subject, :predicate, :object, :
|
58
|
+
[:subject, :predicate, :object, :graph_name].each do |resource|
|
59
|
+
do_resource = resource == :graph_name ? :context : resource
|
59
60
|
unless hash[resource].nil?
|
60
61
|
case hash[resource]
|
61
62
|
when Symbol, RDF::Query::Variable
|
62
|
-
conditions << "#{
|
63
|
+
conditions << "#{do_resource} != 'nil'"
|
63
64
|
next
|
64
65
|
when false
|
65
|
-
conditions << "#{
|
66
|
+
conditions << "#{do_resource} = 'nil'"
|
66
67
|
next
|
67
68
|
else
|
68
|
-
conditions << "#{
|
69
|
+
conditions << "#{do_resource} = ?"
|
69
70
|
end
|
70
71
|
params << repository.serialize(hash[resource])
|
71
72
|
end
|
metadata
CHANGED
@@ -1,114 +1,128 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-do
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.99.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Lavender
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: '1.99'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: '1.99'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: data_objects
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.10
|
33
|
+
version: '0.10'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.10
|
40
|
+
version: '0.10'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: do_sqlite3
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.10
|
47
|
+
version: '0.10'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.10
|
54
|
+
version: '0.10'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: do_postgres
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.10
|
61
|
+
version: '0.10'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.10
|
68
|
+
version: '0.10'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdf-spec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.1
|
75
|
+
version: '1.1'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.1
|
82
|
+
version: '1.1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2
|
89
|
+
version: '3.2'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2
|
96
|
+
version: '3.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-its
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: yard
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.8
|
117
|
+
version: '0.8'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.8
|
111
|
-
description: RDF.rb
|
124
|
+
version: '0.8'
|
125
|
+
description: RDF.rb extension providing a DataObjects storage adapter.
|
112
126
|
email: public-rdf-ruby@w3.org
|
113
127
|
executables: []
|
114
128
|
extensions: []
|
@@ -118,11 +132,11 @@ files:
|
|
118
132
|
- README
|
119
133
|
- UNLICENSE
|
120
134
|
- VERSION
|
135
|
+
- lib/rdf/do.rb
|
121
136
|
- lib/rdf/do/adapters/defaults.rb
|
122
137
|
- lib/rdf/do/adapters/postgres.rb
|
123
138
|
- lib/rdf/do/adapters/sqlite3.rb
|
124
139
|
- lib/rdf/do/version.rb
|
125
|
-
- lib/rdf/do.rb
|
126
140
|
homepage: http://ruby-rdf.github.com/rdf-do
|
127
141
|
licenses:
|
128
142
|
- Public Domain
|
@@ -133,19 +147,19 @@ require_paths:
|
|
133
147
|
- lib
|
134
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
|
-
- -
|
150
|
+
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: 1.9.2
|
139
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
154
|
requirements:
|
141
|
-
- -
|
155
|
+
- - ">="
|
142
156
|
- !ruby/object:Gem::Version
|
143
157
|
version: '0'
|
144
158
|
requirements: []
|
145
159
|
rubyforge_project: rdf
|
146
|
-
rubygems_version: 2.1
|
160
|
+
rubygems_version: 2.4.5.1
|
147
161
|
signing_key:
|
148
162
|
specification_version: 4
|
149
|
-
summary: RDF.rb
|
163
|
+
summary: RDF.rb extension providing a DataObjects storage adapter.
|
150
164
|
test_files: []
|
151
165
|
has_rdoc: false
|