json-ld 3.2.0 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -7
  3. data/VERSION +1 -1
  4. data/lib/json/ld/api.rb +55 -16
  5. data/lib/json/ld/context.rb +7 -7
  6. data/lib/json/ld/expand.rb +2 -2
  7. data/lib/json/ld/format.rb +83 -116
  8. data/lib/json/ld/reader.rb +2 -2
  9. data/lib/json/ld/streaming_reader.rb +2 -1
  10. data/lib/json/ld/to_rdf.rb +9 -8
  11. data/lib/json/ld/writer.rb +9 -10
  12. data/lib/json/ld.rb +3 -0
  13. data/spec/api_spec.rb +67 -19
  14. data/spec/format_spec.rb +7 -3
  15. data/spec/frame_spec.rb +25 -1
  16. data/spec/reader_spec.rb +14 -14
  17. data/spec/suite_helper.rb +1 -0
  18. data/spec/test-files/{test-1-compacted.json → test-1-compacted.jsonld} +0 -0
  19. data/spec/test-files/{test-1-context.json → test-1-context.jsonld} +0 -0
  20. data/spec/test-files/{test-1-expanded.json → test-1-expanded.jsonld} +0 -0
  21. data/spec/test-files/{test-1-input.json → test-1-input.jsonld} +0 -0
  22. data/spec/test-files/{test-2-compacted.json → test-2-compacted.jsonld} +0 -0
  23. data/spec/test-files/{test-2-context.json → test-2-context.jsonld} +0 -0
  24. data/spec/test-files/{test-2-expanded.json → test-2-expanded.jsonld} +0 -0
  25. data/spec/test-files/{test-2-input.json → test-2-input.jsonld} +0 -0
  26. data/spec/test-files/{test-3-compacted.json → test-3-compacted.jsonld} +0 -0
  27. data/spec/test-files/{test-3-context.json → test-3-context.jsonld} +0 -0
  28. data/spec/test-files/{test-3-expanded.json → test-3-expanded.jsonld} +0 -0
  29. data/spec/test-files/{test-3-input.json → test-3-input.jsonld} +0 -0
  30. data/spec/test-files/{test-4-compacted.json → test-4-compacted.jsonld} +0 -0
  31. data/spec/test-files/{test-4-context.json → test-4-context.jsonld} +0 -0
  32. data/spec/test-files/{test-4-expanded.json → test-4-expanded.jsonld} +0 -0
  33. data/spec/test-files/{test-4-input.json → test-4-input.jsonld} +0 -0
  34. data/spec/test-files/{test-5-compacted.json → test-5-compacted.jsonld} +0 -0
  35. data/spec/test-files/{test-5-context.json → test-5-context.jsonld} +0 -0
  36. data/spec/test-files/{test-5-expanded.json → test-5-expanded.jsonld} +0 -0
  37. data/spec/test-files/{test-5-input.json → test-5-input.jsonld} +0 -0
  38. data/spec/test-files/{test-6-compacted.json → test-6-compacted.jsonld} +0 -0
  39. data/spec/test-files/{test-6-context.json → test-6-context.jsonld} +0 -0
  40. data/spec/test-files/{test-6-expanded.json → test-6-expanded.jsonld} +0 -0
  41. data/spec/test-files/{test-6-input.json → test-6-input.jsonld} +0 -0
  42. data/spec/test-files/{test-7-compacted.json → test-7-compacted.jsonld} +0 -0
  43. data/spec/test-files/{test-7-context.json → test-7-context.jsonld} +0 -0
  44. data/spec/test-files/{test-7-expanded.json → test-7-expanded.jsonld} +0 -0
  45. data/spec/test-files/{test-7-input.json → test-7-input.jsonld} +0 -0
  46. data/spec/test-files/{test-8-compacted.json → test-8-compacted.jsonld} +0 -0
  47. data/spec/test-files/{test-8-context.json → test-8-context.jsonld} +0 -0
  48. data/spec/test-files/{test-8-expanded.json → test-8-expanded.jsonld} +0 -0
  49. data/spec/test-files/{test-8-frame.json → test-8-frame.jsonld} +0 -0
  50. data/spec/test-files/{test-8-framed.json → test-8-framed.jsonld} +0 -0
  51. data/spec/test-files/{test-8-input.json → test-8-input.jsonld} +0 -0
  52. data/spec/test-files/{test-9-compacted.json → test-9-compacted.jsonld} +0 -0
  53. data/spec/test-files/{test-9-context.json → test-9-context.jsonld} +0 -0
  54. data/spec/test-files/{test-9-expanded.json → test-9-expanded.jsonld} +0 -0
  55. data/spec/test-files/{test-9-input.json → test-9-input.jsonld} +0 -0
  56. metadata +94 -89
  57. data/spec/test-files/test-1-normalized.json +0 -8
  58. data/spec/test-files/test-2-normalized.json +0 -32
  59. data/spec/test-files/test-3-normalized.json +0 -13
@@ -11,10 +11,11 @@ module JSON::LD
11
11
  ##
12
12
  # @param [Hash{String => Object}] item
13
13
  # @param [RDF::Resource] graph_name
14
+ # @param [Boolean] quoted emitted triples are quoted triples.
14
15
  # @yield statement
15
16
  # @yieldparam [RDF::Statement] statement
16
17
  # @return RDF::Resource the subject of this item
17
- def item_to_rdf(item, graph_name: nil, &block)
18
+ def item_to_rdf(item, graph_name: nil, quoted: false, &block)
18
19
  # Just return value object as Term
19
20
  return unless item
20
21
 
@@ -82,9 +83,9 @@ module JSON::LD
82
83
  when nil then node
83
84
  when String then as_resource(item['@id'])
84
85
  when Object
85
- # Embedded statement
86
+ # Embedded/quoted statement
86
87
  # (No error checking, as this is done in expansion)
87
- to_enum(:item_to_rdf, item['@id']).to_a.first
88
+ to_enum(:item_to_rdf, item['@id'], quoted: true).to_a.first
88
89
  end
89
90
 
90
91
  #log_debug("item_to_rdf") {"subject: #{subject.to_ntriples rescue 'malformed rdf'}"}
@@ -95,12 +96,12 @@ module JSON::LD
95
96
  values.each do |v|
96
97
  object = as_resource(v)
97
98
  #log_debug("item_to_rdf") {"type: #{object.to_ntriples rescue 'malformed rdf'}"}
98
- yield RDF::Statement(subject, RDF.type, object, graph_name: graph_name)
99
+ yield RDF::Statement(subject, RDF.type, object, graph_name: graph_name, quoted: quoted)
99
100
  end
100
101
  when '@graph'
101
102
  values = [values].compact unless values.is_a?(Array)
102
103
  values.each do |nd|
103
- item_to_rdf(nd, graph_name: subject, &block)
104
+ item_to_rdf(nd, graph_name: subject, quoted: quoted, &block)
104
105
  end
105
106
  when '@reverse'
106
107
  raise "Huh?" unless values.is_a?(Hash)
@@ -113,7 +114,7 @@ module JSON::LD
113
114
  object = item_to_rdf(v, graph_name: graph_name, &block)
114
115
  #log_debug("item_to_rdf") {"subject: #{object.to_ntriples rescue 'malformed rdf'}"}
115
116
  # yield subject, prediate, and literal to results.
116
- yield RDF::Statement(object, predicate, subject, graph_name: graph_name)
117
+ yield RDF::Statement(object, predicate, subject, graph_name: graph_name, quoted: quoted)
117
118
  end
118
119
  end
119
120
  when '@included'
@@ -136,13 +137,13 @@ module JSON::LD
136
137
  object = parse_list(v['@list'], graph_name: graph_name, &block)
137
138
 
138
139
  # Append a triple composed of subject, prediate, and object to results and add all triples from list_results to results.
139
- yield RDF::Statement(subject, predicate, object, graph_name: graph_name)
140
+ yield RDF::Statement(subject, predicate, object, graph_name: graph_name, quoted: quoted)
140
141
  else
141
142
  # Otherwise, item is a value object or a node definition. Generate object as the result of the Object Converstion algorithm passing item.
142
143
  object = item_to_rdf(v, graph_name: graph_name, &block)
143
144
  #log_debug("item_to_rdf") {"object: #{object.to_ntriples rescue 'malformed rdf'}"}
144
145
  # yield subject, prediate, and literal to results.
145
- yield RDF::Statement(subject, predicate, object, graph_name: graph_name)
146
+ yield RDF::Statement(subject, predicate, object, graph_name: graph_name, quoted: quoted)
146
147
  end
147
148
  end
148
149
  end
@@ -71,7 +71,7 @@ module JSON::LD
71
71
 
72
72
  ##
73
73
  # JSON-LD Writer options
74
- # @see http://www.rubydoc.info/github/ruby-rdf/rdf/RDF/Writer#options-class_method
74
+ # @see https://ruby-rdf.github.io/rdf/RDF/Writer#options-class_method
75
75
  def self.options
76
76
  super + [
77
77
  RDF::CLI::Option.new(
@@ -186,10 +186,6 @@ module JSON::LD
186
186
  # @return [Boolean]
187
187
  # @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
188
188
  def accept?(accept_params)
189
- # Profiles that aren't specific IANA relations represent the URL
190
- # of a context or frame that may be subject to black- or white-listing
191
- profile = accept_params[:profile].to_s.split(/\s+/)
192
-
193
189
  if block_given?
194
190
  yield(accept_params)
195
191
  else
@@ -229,6 +225,8 @@ module JSON::LD
229
225
  # frame to use when serializing.
230
226
  # @option options [Boolean] :unique_bnodes (false)
231
227
  # Use unique bnode identifiers, defaults to using the identifier which the node was originall initialized with (if any).
228
+ # @option options [Proc] serializer (JSON::LD::API.serializer)
229
+ # A Serializer method used for generating the JSON serialization of the result.
232
230
  # @option options [Boolean] :stream (false)
233
231
  # Do not attempt to optimize graph presentation, suitable for streaming large graphs.
234
232
  # @yield [writer] `self`
@@ -239,6 +237,7 @@ module JSON::LD
239
237
  def initialize(output = $stdout, **options, &block)
240
238
  options[:base_uri] ||= options[:base] if options.key?(:base)
241
239
  options[:base] ||= options[:base_uri] if options.key?(:base_uri)
240
+ @serializer = options.fetch(:serializer, JSON::LD::API.method(:serializer))
242
241
  super do
243
242
  @repo = RDF::Repository.new
244
243
 
@@ -300,7 +299,7 @@ module JSON::LD
300
299
  else
301
300
 
302
301
  log_debug("writer") { "serialize #{@repo.count} statements, #{@options.inspect}"}
303
- result = API.fromRdf(@repo, **@options)
302
+ result = API.fromRdf(@repo, **@options.merge(serializer: nil))
304
303
 
305
304
  # Some options may be indicated from accept parameters
306
305
  profile = @options.fetch(:accept_params, {}).fetch(:profile, "").split(' ')
@@ -322,20 +321,20 @@ module JSON::LD
322
321
 
323
322
  # Rename BNodes to uniquify them, if necessary
324
323
  if options[:unique_bnodes]
325
- result = API.flatten(result, context, **@options)
324
+ result = API.flatten(result, context, **@options.merge(serializer: nil))
326
325
  end
327
326
 
328
327
  if frame = @options[:frame]
329
328
  # Perform framing, if given a frame
330
329
  log_debug("writer") { "frame result"}
331
- result = API.frame(result, frame, **@options)
330
+ result = API.frame(result, frame, **@options.merge(serializer: nil))
332
331
  elsif context
333
332
  # Perform compaction, if we have a context
334
333
  log_debug("writer") { "compact result"}
335
- result = API.compact(result, context, **@options)
334
+ result = API.compact(result, context, **@options.merge(serializer: nil))
336
335
  end
337
336
 
338
- @output.write(result.to_json(JSON_STATE))
337
+ @output.write(@serializer.call(result, **@options))
339
338
  end
340
339
 
341
340
  super
data/lib/json/ld.rb CHANGED
@@ -46,6 +46,9 @@ module JSON
46
46
  # Default context when compacting without one being specified
47
47
  DEFAULT_CONTEXT = "http://schema.org"
48
48
 
49
+ # Acceptable MultiJson adapters
50
+ MUTLI_JSON_ADAPTERS = %i(oj json_gem json_pure ok_json yajl nsjsonseerialization)
51
+
49
52
  KEYWORDS = Set.new(%w(
50
53
  @annotation
51
54
  @base
data/spec/api_spec.rb CHANGED
@@ -48,30 +48,78 @@ describe JSON::LD::API do
48
48
  context "with MultiJson adapter #{adapter.inspect}" do
49
49
  Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), 'test-files/*-input.*'))) do |filename|
50
50
  test = File.basename(filename).sub(/-input\..*$/, '')
51
- frame = filename.sub(/-input\..*$/, '-frame.json')
52
- framed = filename.sub(/-input\..*$/, '-framed.json')
53
- compacted = filename.sub(/-input\..*$/, '-compacted.json')
54
- context = filename.sub(/-input\..*$/, '-context.json')
55
- expanded = filename.sub(/-input\..*$/, '-expanded.json')
51
+ frame = filename.sub(/-input\..*$/, '-frame.jsonld')
52
+ framed = filename.sub(/-input\..*$/, '-framed.jsonld')
53
+ compacted = filename.sub(/-input\..*$/, '-compacted.jsonld')
54
+ context = filename.sub(/-input\..*$/, '-context.jsonld')
55
+ expanded = filename.sub(/-input\..*$/, '-expanded.jsonld')
56
56
  ttl = filename.sub(/-input\..*$/, '-rdf.ttl')
57
57
 
58
58
  context test, skip: ("Not supported in JRuby" if RUBY_ENGINE == "jruby" && %w(oj yajl).include?(adapter.to_s)) do
59
- it "expands" do
60
- options = {logger: logger, adapter: adapter}
61
- options[:expandContext] = File.open(context) if context
62
- jld = described_class.expand(File.open(filename), **options)
63
- expect(jld).to produce_jsonld(JSON.load(File.open(expanded)), logger)
64
- end if File.exist?(expanded)
59
+ around do |example|
60
+ @file = File.open(filename)
61
+ case filename
62
+ when /.jsonld$/
63
+ @file.define_singleton_method(:content_type) {'application/ld+json'}
64
+ end
65
+ if context
66
+ @ctx_io = File.open(context)
67
+ case context
68
+ when /.jsonld$/
69
+ @ctx_io.define_singleton_method(:content_type) {'application/ld+json'}
70
+ end
71
+ end
72
+ example.run
73
+ @file.close
74
+ @ctx_io.close if @ctx_io
75
+ end
76
+
77
+ if File.exist?(expanded)
78
+ it "expands" do
79
+ options = {logger: logger, adapter: adapter}
80
+ options[:expandContext] = @ctx_io if context
81
+ jld = described_class.expand(@file, **options)
82
+ expect(jld).to produce_jsonld(JSON.parse(File.read(expanded)), logger)
83
+ end
84
+
85
+ it "expands with serializer" do
86
+ options = {logger: logger, adapter: adapter}
87
+ options[:expandContext] = @ctx_io if context
88
+ jld = described_class.expand(@file, serializer: JSON::LD::API.method(:serializer), **options)
89
+ expect(jld).to be_a(String)
90
+ expect(JSON.load(jld)).to produce_jsonld(JSON.parse(File.read(expanded)), logger)
91
+ end
92
+ end
65
93
 
66
- it "compacts" do
67
- jld = described_class.compact(File.open(filename), File.open(context), adapter: adapter, logger: logger)
68
- expect(jld).to produce_jsonld(JSON.load(File.open(compacted)), logger)
69
- end if File.exist?(compacted) && File.exist?(context)
94
+ if File.exist?(compacted) && File.exist?(context)
95
+ it "compacts" do
96
+ jld = described_class.compact(@file, @ctx_io, adapter: adapter, logger: logger)
97
+ expect(jld).to produce_jsonld(JSON.parse(File.read(compacted)), logger)
98
+ end
99
+
100
+ it "compacts with serializer" do
101
+ jld = described_class.compact(@file, @ctx_io, serializer: JSON::LD::API.method(:serializer), adapter: adapter, logger: logger)
102
+ expect(jld).to be_a(String)
103
+ expect(JSON.load(jld)).to produce_jsonld(JSON.parse(File.read(compacted)), logger)
104
+ end
105
+ end
70
106
 
71
- it "frame" do
72
- jld = described_class.frame(File.open(filename), File.open(frame), adapter: adapter, logger: logger)
73
- expect(jld).to produce_jsonld(JSON.load(File.open(framed)), logger)
74
- end if File.exist?(framed) && File.exist?(frame)
107
+ if File.exist?(framed) && File.exist?(frame)
108
+ it "frames" do
109
+ File.open(frame) do |frame_io|
110
+ jld = described_class.frame(@file, frame_io, adapter: adapter, logger: logger)
111
+ expect(jld).to produce_jsonld(JSON.parse(File.read(framed)), logger)
112
+ end
113
+ end
114
+
115
+ it "frames with serializer" do
116
+ File.open(frame) do |frame_io|
117
+ jld = described_class.frame(@file, frame_io, serializer: JSON::LD::API.method(:serializer), adapter: adapter, logger: logger)
118
+ expect(jld).to be_a(String)
119
+ expect(JSON.load(jld)).to produce_jsonld(JSON.parse(File.read(framed)), logger)
120
+ end
121
+ end
122
+ end
75
123
 
76
124
  it "toRdf" do
77
125
  expect(RDF::Repository.load(filename, format: :jsonld, adapter: adapter, logger: logger)).to be_equivalent_graph(RDF::Repository.load(ttl), logger: logger)
data/spec/format_spec.rb CHANGED
@@ -41,6 +41,10 @@ describe JSON::LD::Format do
41
41
  specify {expect(described_class.to_sym).to eq :jsonld}
42
42
  end
43
43
 
44
+ describe "#to_uri" do
45
+ specify {expect(described_class.to_uri).to eq RDF::URI('http://www.w3.org/ns/formats/JSON-LD')}
46
+ end
47
+
44
48
  describe ".detect" do
45
49
  {
46
50
  jsonld: '{"@context" => "foo"}',
@@ -66,11 +70,11 @@ describe JSON::LD::Format do
66
70
  end
67
71
  end
68
72
 
69
- describe ".cli_commands" do
73
+ describe ".cli_commands", skip: Gem.win_platform? do
70
74
  require 'rdf/cli'
71
75
  let(:ttl) {File.expand_path("../test-files/test-1-rdf.ttl", __FILE__)}
72
- let(:json) {File.expand_path("../test-files/test-1-input.json", __FILE__)}
73
- let(:context) {File.expand_path("../test-files/test-1-context.json", __FILE__)}
76
+ let(:json) {File.expand_path("../test-files/test-1-input.jsonld", __FILE__)}
77
+ let(:context) {File.expand_path("../test-files/test-1-context.jsonld", __FILE__)}
74
78
 
75
79
  describe "#expand" do
76
80
  it "expands RDF" do
data/spec/frame_spec.rb CHANGED
@@ -2438,7 +2438,31 @@ describe JSON::LD::API do
2438
2438
  "@id": "ex:entity1"
2439
2439
  }),
2440
2440
  processingMode: "json-ld-1.1"
2441
- }
2441
+ },
2442
+ "don't embed list elements": {
2443
+ frame: %({
2444
+ "@context": {"ex": "http://example.org/"},
2445
+ "ex:embed": {
2446
+ "@list": [{"@embed": "@never"}]
2447
+ }
2448
+ }),
2449
+ input: %({
2450
+ "@context": {"ex": "http://example.org/"},
2451
+ "@id": "ex:Sub1",
2452
+ "ex:embed": {
2453
+ "@list": [{
2454
+ "@id": "ex:Sub2",
2455
+ "ex:prop": "property"
2456
+ }]
2457
+ }
2458
+ }),
2459
+ output: %({
2460
+ "@context": {"ex": "http://example.org/"},
2461
+ "@id": "ex:Sub1",
2462
+ "ex:embed": {"@list": [{"@id": "ex:Sub2"}]}
2463
+ }),
2464
+ processingMode: "json-ld-1.1"
2465
+ },
2442
2466
  }.each do |title, params|
2443
2467
  it title do
2444
2468
  do_frame(params)
data/spec/reader_spec.rb CHANGED
@@ -131,7 +131,7 @@ describe JSON::LD::Reader do
131
131
  {
132
132
  "@context": {"@base": "http://a/bb/ccc/d;p?q", "urn:ex:p": {"@type": "@id"}},
133
133
  "@graph": [
134
- {"@id": "urn:ex:s001", "urn:ex:p": "g:h"},
134
+ {"@id": "urn:ex:s001", "urn:ex:p": "gg:h"},
135
135
  {"@id": "urn:ex:s002", "urn:ex:p": "g"},
136
136
  {"@id": "urn:ex:s003", "urn:ex:p": "./g"},
137
137
  {"@id": "urn:ex:s004", "urn:ex:p": "g/"},
@@ -183,7 +183,7 @@ describe JSON::LD::Reader do
183
183
  {
184
184
  "@context": {"@base": "http://a/bb/ccc/d/", "urn:ex:p": {"@type": "@id"}},
185
185
  "@graph": [
186
- {"@id": "urn:ex:s043", "urn:ex:p": "g:h"},
186
+ {"@id": "urn:ex:s043", "urn:ex:p": "gg:h"},
187
187
  {"@id": "urn:ex:s044", "urn:ex:p": "g"},
188
188
  {"@id": "urn:ex:s045", "urn:ex:p": "./g"},
189
189
  {"@id": "urn:ex:s046", "urn:ex:p": "g/"},
@@ -235,7 +235,7 @@ describe JSON::LD::Reader do
235
235
  {
236
236
  "@context": {"@base": "http://a/bb/ccc/./d;p?q", "urn:ex:p": {"@type": "@id"}},
237
237
  "@graph": [
238
- {"@id": "urn:ex:s085", "urn:ex:p": "g:h"},
238
+ {"@id": "urn:ex:s085", "urn:ex:p": "gg:h"},
239
239
  {"@id": "urn:ex:s086", "urn:ex:p": "g"},
240
240
  {"@id": "urn:ex:s087", "urn:ex:p": "./g"},
241
241
  {"@id": "urn:ex:s088", "urn:ex:p": "g/"},
@@ -287,7 +287,7 @@ describe JSON::LD::Reader do
287
287
  {
288
288
  "@context": {"@base": "http://a/bb/ccc/../d;p?q", "urn:ex:p": {"@type": "@id"}},
289
289
  "@graph": [
290
- {"@id": "urn:ex:s127", "urn:ex:p": "g:h"},
290
+ {"@id": "urn:ex:s127", "urn:ex:p": "gg:h"},
291
291
  {"@id": "urn:ex:s128", "urn:ex:p": "g"},
292
292
  {"@id": "urn:ex:s129", "urn:ex:p": "./g"},
293
293
  {"@id": "urn:ex:s130", "urn:ex:p": "g/"},
@@ -339,7 +339,7 @@ describe JSON::LD::Reader do
339
339
  {
340
340
  "@context": {"@base": "http://a/bb/ccc/.", "urn:ex:p": {"@type": "@id"}},
341
341
  "@graph": [
342
- {"@id": "urn:ex:s169", "urn:ex:p": "g:h"},
342
+ {"@id": "urn:ex:s169", "urn:ex:p": "gg:h"},
343
343
  {"@id": "urn:ex:s170", "urn:ex:p": "g"},
344
344
  {"@id": "urn:ex:s171", "urn:ex:p": "./g"},
345
345
  {"@id": "urn:ex:s172", "urn:ex:p": "g/"},
@@ -391,7 +391,7 @@ describe JSON::LD::Reader do
391
391
  {
392
392
  "@context": {"@base": "http://a/bb/ccc/..", "urn:ex:p": {"@type": "@id"}},
393
393
  "@graph": [
394
- {"@id": "urn:ex:s211", "urn:ex:p": "g:h"},
394
+ {"@id": "urn:ex:s211", "urn:ex:p": "gg:h"},
395
395
  {"@id": "urn:ex:s212", "urn:ex:p": "g"},
396
396
  {"@id": "urn:ex:s213", "urn:ex:p": "./g"},
397
397
  {"@id": "urn:ex:s214", "urn:ex:p": "g/"},
@@ -443,7 +443,7 @@ describe JSON::LD::Reader do
443
443
  {
444
444
  "@context": {"@base": "file:///a/bb/ccc/d;p?q", "urn:ex:p": {"@type": "@id"}},
445
445
  "@graph": [
446
- {"@id": "urn:ex:s253", "urn:ex:p": "g:h"},
446
+ {"@id": "urn:ex:s253", "urn:ex:p": "gg:h"},
447
447
  {"@id": "urn:ex:s254", "urn:ex:p": "g"},
448
448
  {"@id": "urn:ex:s255", "urn:ex:p": "./g"},
449
449
  {"@id": "urn:ex:s256", "urn:ex:p": "g/"},
@@ -523,7 +523,7 @@ describe JSON::LD::Reader do
523
523
  let(:nt) {%q{
524
524
  # RFC3986 normal examples
525
525
 
526
- <urn:ex:s001> <urn:ex:p> <g:h>.
526
+ <urn:ex:s001> <urn:ex:p> <gg:h>.
527
527
  <urn:ex:s002> <urn:ex:p> <http://a/bb/ccc/g>.
528
528
  <urn:ex:s003> <urn:ex:p> <http://a/bb/ccc/g>.
529
529
  <urn:ex:s004> <urn:ex:p> <http://a/bb/ccc/g/>.
@@ -571,7 +571,7 @@ describe JSON::LD::Reader do
571
571
 
572
572
  # RFC3986 normal examples with trailing slash in base IRI
573
573
 
574
- <urn:ex:s043> <urn:ex:p> <g:h>.
574
+ <urn:ex:s043> <urn:ex:p> <gg:h>.
575
575
  <urn:ex:s044> <urn:ex:p> <http://a/bb/ccc/d/g>.
576
576
  <urn:ex:s045> <urn:ex:p> <http://a/bb/ccc/d/g>.
577
577
  <urn:ex:s046> <urn:ex:p> <http://a/bb/ccc/d/g/>.
@@ -619,7 +619,7 @@ describe JSON::LD::Reader do
619
619
 
620
620
  # RFC3986 normal examples with /. in the base IRI
621
621
 
622
- <urn:ex:s085> <urn:ex:p> <g:h>.
622
+ <urn:ex:s085> <urn:ex:p> <gg:h>.
623
623
  <urn:ex:s086> <urn:ex:p> <http://a/bb/ccc/g>.
624
624
  <urn:ex:s087> <urn:ex:p> <http://a/bb/ccc/g>.
625
625
  <urn:ex:s088> <urn:ex:p> <http://a/bb/ccc/g/>.
@@ -667,7 +667,7 @@ describe JSON::LD::Reader do
667
667
 
668
668
  # RFC3986 normal examples with /.. in the base IRI
669
669
 
670
- <urn:ex:s127> <urn:ex:p> <g:h>.
670
+ <urn:ex:s127> <urn:ex:p> <gg:h>.
671
671
  <urn:ex:s128> <urn:ex:p> <http://a/bb/g>.
672
672
  <urn:ex:s129> <urn:ex:p> <http://a/bb/g>.
673
673
  <urn:ex:s130> <urn:ex:p> <http://a/bb/g/>.
@@ -715,7 +715,7 @@ describe JSON::LD::Reader do
715
715
 
716
716
  # RFC3986 normal examples with trailing /. in the base IRI
717
717
 
718
- <urn:ex:s169> <urn:ex:p> <g:h>.
718
+ <urn:ex:s169> <urn:ex:p> <gg:h>.
719
719
  <urn:ex:s170> <urn:ex:p> <http://a/bb/ccc/g>.
720
720
  <urn:ex:s171> <urn:ex:p> <http://a/bb/ccc/g>.
721
721
  <urn:ex:s172> <urn:ex:p> <http://a/bb/ccc/g/>.
@@ -763,7 +763,7 @@ describe JSON::LD::Reader do
763
763
 
764
764
  # RFC3986 normal examples with trailing /.. in the base IRI
765
765
 
766
- <urn:ex:s211> <urn:ex:p> <g:h>.
766
+ <urn:ex:s211> <urn:ex:p> <gg:h>.
767
767
  <urn:ex:s212> <urn:ex:p> <http://a/bb/ccc/g>.
768
768
  <urn:ex:s213> <urn:ex:p> <http://a/bb/ccc/g>.
769
769
  <urn:ex:s214> <urn:ex:p> <http://a/bb/ccc/g/>.
@@ -811,7 +811,7 @@ describe JSON::LD::Reader do
811
811
 
812
812
  # RFC3986 normal examples with file path
813
813
 
814
- <urn:ex:s253> <urn:ex:p> <g:h>.
814
+ <urn:ex:s253> <urn:ex:p> <gg:h>.
815
815
  <urn:ex:s254> <urn:ex:p> <file:///a/bb/ccc/g>.
816
816
  <urn:ex:s255> <urn:ex:p> <file:///a/bb/ccc/g>.
817
817
  <urn:ex:s256> <urn:ex:p> <file:///a/bb/ccc/g/>.
data/spec/suite_helper.rb CHANGED
@@ -60,6 +60,7 @@ module RDF::Util
60
60
  document_options[:headers][:content_type] = options[:contentType] if options[:contentType]
61
61
 
62
62
  remote_document = RDF::Util::File::RemoteDocument.new(response.read, **document_options)
63
+ response.close
63
64
  if block_given?
64
65
  return yield remote_document
65
66
  else