Skip to content

Commit 9fa4bda

Browse files
committed
Use array rather than repository for from RDF statements due to scrambling of statements in new RDF::Repository.
1 parent 3e49303 commit 9fa4bda

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ rvm:
77
- 2.0
88
- 2.1
99
- 2.2.4
10+
- 2.3.0
1011
- jruby-9.0.4.0
1112
- rbx-2
1213
cache: bundler

spec/from_rdf_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@
401401

402402
def parse(input, options = {})
403403
reader = options[:reader] || RDF::TriG::Reader
404-
RDF::Repository.new << reader.new(input, options)
404+
reader.new(input, options, &:each_statement).to_a.extend(RDF::Enumerable)
405405
end
406406

407407
# Serialize ntstr to a string and compare against regexps

spec/streaming_writer_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
)
5252
obj = serialize(input)
5353
expect(parse(obj.to_json, format: :jsonld)).to be_equivalent_graph(parse(input), logger: logger)
54-
expect(obj).to eql JSON.parse(%{[
54+
expect(obj).to contain_exactly *JSON.parse(%{[
5555
{"@id": "http://example.com/test-cases/0001", "@type": ["http://www.w3.org/2006/03/test-description#TestCase"]},
5656
{"@id": "http://example.com/test-cases/0002", "@type": ["http://www.w3.org/2006/03/test-description#TestCase"]}
5757
]})
@@ -92,7 +92,7 @@
9292
context title do
9393
subject {serialize(input)}
9494
it "matches expected json" do
95-
expect(subject).to produce(JSON.parse(matches), logger)
95+
expect(subject).to contain_exactly *JSON.parse(matches)
9696
end
9797
end
9898
end

spec/suite_helper.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ def run(rspec_example = nil)
108108
when "jld:FrameTest"
109109
JSON::LD::API.frame(input_loc, frame_loc, options.merge(logger: logger))
110110
when "jld:FromRDFTest"
111-
repo = RDF::Repository.load(input_loc, format: :nquads)
111+
# Use an array, to preserve input order
112+
repo = RDF::NQuads::Reader.open(input_loc) do |reader|
113+
reader.each_statement.to_a
114+
end.extend(RDF::Enumerable)
112115
logger.info "repo: #{repo.dump(id == '#t0012' ? :nquads : :trig)}"
113116
JSON::LD::API.fromRdf(repo, options.merge(logger: logger))
114117
when "jld:ToRDFTest"

0 commit comments

Comments
 (0)