redlander 0.2.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +8 -4
- data/lib/redlander.rb +17 -22
- data/lib/redlander/error_container.rb +28 -27
- data/lib/redlander/model.rb +23 -11
- data/lib/redlander/model_proxy.rb +41 -29
- data/lib/redlander/node.rb +36 -29
- data/lib/redlander/parser.rb +15 -17
- data/lib/redlander/parser_proxy.rb +11 -10
- data/lib/redlander/serializer.rb +15 -10
- data/lib/redlander/statement.rb +47 -91
- data/lib/redlander/storage.rb +14 -36
- data/lib/redlander/stream.rb +57 -0
- data/lib/redlander/stream.rb~ +43 -0
- data/lib/redlander/stream_enumerator.rb +17 -0
- data/lib/redlander/stream_enumerator.rb~ +15 -0
- data/lib/redlander/uri.rb +29 -0
- data/lib/redlander/uri.rb~ +12 -0
- data/lib/redlander/version.rb +1 -1
- data/spec/integration/memory_leak_spec.rb +24 -0
- data/spec/integration/memory_leak_spec.rb~ +24 -0
- data/spec/redlander/model_spec.rb +6 -14
- data/spec/redlander/statement_spec.rb +0 -9
- metadata +43 -24
- data/ext/README +0 -1
- data/ext/extconf.rb +0 -17
- data/ext/redland-pre.i +0 -6
- data/ext/redland-types.i +0 -9
- data/ext/redland_wrap.c +0 -8052
- data/lib/redlander/statement_iterator.rb +0 -37
@@ -1,37 +0,0 @@
|
|
1
|
-
module Redlander
|
2
|
-
|
3
|
-
# Wrapper for a librdf_stream object.
|
4
|
-
module StatementIterator
|
5
|
-
|
6
|
-
include Enumerable
|
7
|
-
|
8
|
-
# Iterate over statements in the stream.
|
9
|
-
def each
|
10
|
-
# TODO: The options specify matching criteria: subj, pred, obj;
|
11
|
-
# if an option is not specified, it matches any value,
|
12
|
-
# so with no options given, all statements will be returned.
|
13
|
-
if block_given?
|
14
|
-
while Redland.librdf_stream_end(@rdf_stream).zero?
|
15
|
-
yield current
|
16
|
-
Redland.librdf_stream_next(@rdf_stream).zero?
|
17
|
-
end
|
18
|
-
else
|
19
|
-
raise ::LocalJumpError.new("no block given")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
# Get the current Statement in the stream.
|
27
|
-
def current
|
28
|
-
rdf_statement = Redland.librdf_stream_get_object(@rdf_stream)
|
29
|
-
statement = Statement.new(rdf_statement)
|
30
|
-
# not using Statement#model= in order to avoid re-adding the statement to the model
|
31
|
-
statement.instance_variable_set(:@model, @model)
|
32
|
-
statement
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|