rdf-do 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +2 -0
- data/VERSION +1 -1
- data/lib/rdf/do.rb +13 -30
- data/lib/rdf/do/version.rb +1 -1
- metadata +12 -12
data/README
CHANGED
@@ -32,6 +32,8 @@ The greatly preferred installation method is via RubyGems:
|
|
32
32
|
|
33
33
|
Manual downloads are available at <http://github.com/bhuga/rdf-do/downloads>
|
34
34
|
|
35
|
+
Ruby 1.8.6 is not supported, but the tests pass with the backports gem. Godspeed.
|
36
|
+
|
35
37
|
## Connecting:
|
36
38
|
require 'do_postgres'
|
37
39
|
require 'do_sqlite3'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/rdf/do.rb
CHANGED
@@ -195,7 +195,7 @@ module RDF
|
|
195
195
|
# @param [Proc] &block
|
196
196
|
# @return [Enumerable::Enumerator, void]
|
197
197
|
def each(&block)
|
198
|
-
return
|
198
|
+
return enum_for(:each) unless block_given?
|
199
199
|
reader = result(@adapter.each_sql)
|
200
200
|
while reader.next!
|
201
201
|
block.call(RDF::Statement.new(
|
@@ -213,7 +213,7 @@ module RDF
|
|
213
213
|
# @param [Proc] &block
|
214
214
|
# @return [Enumerable::Enumerator, void]
|
215
215
|
def each_subject(&block)
|
216
|
-
return
|
216
|
+
return enum_for(:each_subject) unless block_given?
|
217
217
|
reader = result(@adapter.each_subject_sql)
|
218
218
|
while reader.next!
|
219
219
|
block.call(unserialize(reader.values[0]))
|
@@ -227,7 +227,7 @@ module RDF
|
|
227
227
|
# @param [Proc] &block
|
228
228
|
# @return [Enumerable::Enumerator, void]
|
229
229
|
def each_predicate(&block)
|
230
|
-
return
|
230
|
+
return enum_for(:each_predicate) unless block_given?
|
231
231
|
reader = result(@adapter.each_predicate_sql)
|
232
232
|
while reader.next!
|
233
233
|
block.call(unserialize(reader.values[0]))
|
@@ -241,7 +241,7 @@ module RDF
|
|
241
241
|
# @param [Proc] &block
|
242
242
|
# @return [Enumerable::Enumerator, void]
|
243
243
|
def each_object(&block)
|
244
|
-
return
|
244
|
+
return enum_for(:each_object) unless block_given?
|
245
245
|
reader = result(@adapter.each_object_sql)
|
246
246
|
while reader.next!
|
247
247
|
block.call(unserialize(reader.values[0]))
|
@@ -255,7 +255,7 @@ module RDF
|
|
255
255
|
# @param [Proc] &block
|
256
256
|
# @return [Enumerable::Enumerator, void]
|
257
257
|
def each_context(&block)
|
258
|
-
return
|
258
|
+
return enum_for(:each_context) unless block_given?
|
259
259
|
reader = result(@adapter.each_context_sql)
|
260
260
|
while reader.next!
|
261
261
|
context = unserialize(reader.values[0])
|
@@ -274,32 +274,15 @@ module RDF
|
|
274
274
|
# @param [RDF::Statement, Hash, Array] pattern
|
275
275
|
# @return [RDF::Enumerable, void]
|
276
276
|
# @see RDF::Queryable#query
|
277
|
-
def
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
reader = @adapter.query(self,pattern)
|
286
|
-
while reader.next!
|
287
|
-
statements << RDF::Statement.new(
|
288
|
-
:subject => unserialize(reader.values[0]),
|
289
|
-
:predicate => unserialize(reader.values[1]),
|
290
|
-
:object => unserialize(reader.values[2]),
|
291
|
-
:context => unserialize(reader.values[3]))
|
292
|
-
end
|
293
|
-
case block_given?
|
294
|
-
when true
|
295
|
-
statements.each(&block)
|
296
|
-
else
|
297
|
-
statements.extend(RDF::Enumerable, RDF::Queryable)
|
298
|
-
end
|
299
|
-
else
|
300
|
-
super(pattern)
|
277
|
+
def query_pattern(pattern, &block)
|
278
|
+
reader = @adapter.query(self,pattern.to_hash)
|
279
|
+
while reader.next!
|
280
|
+
yield RDF::Statement.new(
|
281
|
+
:subject => unserialize(reader.values[0]),
|
282
|
+
:predicate => unserialize(reader.values[1]),
|
283
|
+
:object => unserialize(reader.values[2]),
|
284
|
+
:context => unserialize(reader.values[3]))
|
301
285
|
end
|
302
|
-
|
303
286
|
end
|
304
287
|
|
305
288
|
##
|
data/lib/rdf/do/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ben Lavender
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-18 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -22,13 +22,13 @@ dependencies:
|
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
28
|
- 0
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 0.
|
29
|
+
- 2
|
30
|
+
- 0
|
31
|
+
version: 0.2.0
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
@@ -41,8 +41,8 @@ dependencies:
|
|
41
41
|
segments:
|
42
42
|
- 0
|
43
43
|
- 10
|
44
|
-
-
|
45
|
-
version: 0.10.
|
44
|
+
- 2
|
45
|
+
version: 0.10.2
|
46
46
|
type: :runtime
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
@@ -50,13 +50,13 @@ dependencies:
|
|
50
50
|
prerelease: false
|
51
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
segments:
|
56
56
|
- 0
|
57
|
-
-
|
57
|
+
- 2
|
58
58
|
- 6
|
59
|
-
version: 0.
|
59
|
+
version: 0.2.6
|
60
60
|
type: :development
|
61
61
|
version_requirements: *id003
|
62
62
|
- !ruby/object:Gem::Dependency
|