json-ld 1.99.2 → 2.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
data/spec/compact_spec.rb CHANGED
@@ -3,7 +3,7 @@ $:.unshift "."
3
3
  require 'spec_helper'
4
4
 
5
5
  describe JSON::LD::API do
6
- before(:each) { @debug = []}
6
+ let(:logger) {RDF::Spec.logger}
7
7
 
8
8
  describe ".compact" do
9
9
  {
@@ -179,8 +179,8 @@ describe JSON::LD::API do
179
179
  },
180
180
  }.each_pair do |title, params|
181
181
  it title do
182
- jld = JSON::LD::API.compact(params[:input], params[:context], debug: @debug)
183
- expect(jld).to produce(params[:output], @debug)
182
+ jld = JSON::LD::API.compact(params[:input], params[:context], logger: logger)
183
+ expect(jld).to produce(params[:output], logger)
184
184
  end
185
185
  end
186
186
 
@@ -242,8 +242,8 @@ describe JSON::LD::API do
242
242
  },
243
243
  }.each do |title, params|
244
244
  it title do
245
- jld = JSON::LD::API.compact(params[:input], params[:context], debug: @debug)
246
- expect(jld).to produce(params[:output], @debug)
245
+ jld = JSON::LD::API.compact(params[:input], params[:context], logger: logger)
246
+ expect(jld).to produce(params[:output], logger)
247
247
  end
248
248
  end
249
249
  end
@@ -305,8 +305,8 @@ describe JSON::LD::API do
305
305
  input = params[:input].is_a?(String) ? JSON.parse(params[:input]) : params[:input]
306
306
  ctx = params[:context].is_a?(String) ? JSON.parse(params[:context]) : params[:context]
307
307
  output = params[:output].is_a?(String) ? JSON.parse(params[:output]) : params[:output]
308
- jld = JSON::LD::API.compact(input, ctx, debug: @debug)
309
- expect(jld).to produce(output, @debug)
308
+ jld = JSON::LD::API.compact(input, ctx, logger: logger)
309
+ expect(jld).to produce(output, logger)
310
310
  end
311
311
  end
312
312
  end
@@ -352,8 +352,8 @@ describe JSON::LD::API do
352
352
  input = params[:input].is_a?(String) ? JSON.parse(params[:input]) : params[:input]
353
353
  ctx = params[:context].is_a?(String) ? JSON.parse(params[:context]) : params[:context]
354
354
  output = params[:output].is_a?(String) ? JSON.parse(params[:output]) : params[:output]
355
- jld = JSON::LD::API.compact(input, ctx, debug: @debug)
356
- expect(jld).to produce(output, @debug)
355
+ jld = JSON::LD::API.compact(input, ctx, logger: logger)
356
+ expect(jld).to produce(output, logger)
357
357
  end
358
358
  end
359
359
  end
@@ -372,8 +372,8 @@ describe JSON::LD::API do
372
372
  },
373
373
  "foo" => "bar"
374
374
  }
375
- jld = JSON::LD::API.compact(input, ctx, debug: @debug, validate: true)
376
- expect(jld).to produce(expected, @debug)
375
+ jld = JSON::LD::API.compact(input, ctx, logger: logger, validate: true)
376
+ expect(jld).to produce(expected, logger)
377
377
  end
378
378
  end
379
379
 
@@ -390,8 +390,8 @@ describe JSON::LD::API do
390
390
  "b" => "c"
391
391
  }
392
392
  allow(JSON::LD::API).to receive(:documentLoader).with("http://example.com/context", anything).and_yield(remote_doc)
393
- jld = JSON::LD::API.compact(input, "http://example.com/context", debug: @debug, validate: true)
394
- expect(jld).to produce(expected, @debug)
393
+ jld = JSON::LD::API.compact(input, "http://example.com/context", logger: logger, validate: true)
394
+ expect(jld).to produce(expected, logger)
395
395
  end
396
396
  end
397
397
 
@@ -419,8 +419,8 @@ describe JSON::LD::API do
419
419
  },
420
420
  }.each_pair do |title, params|
421
421
  it title do
422
- jld = JSON::LD::API.compact(params[:input], params[:context], debug: @debug)
423
- expect(jld).to produce(params[:output], @debug)
422
+ jld = JSON::LD::API.compact(params[:input], params[:context], logger: logger)
423
+ expect(jld).to produce(params[:output], logger)
424
424
  end
425
425
  end
426
426
  end
@@ -456,8 +456,8 @@ describe JSON::LD::API do
456
456
  },
457
457
  }.each_pair do |title, params|
458
458
  it title do
459
- jld = JSON::LD::API.compact(params[:input], params[:context], debug: @debug)
460
- expect(jld).to produce(params[:output], @debug)
459
+ jld = JSON::LD::API.compact(params[:input], params[:context], logger: logger)
460
+ expect(jld).to produce(params[:output], logger)
461
461
  end
462
462
  end
463
463
  end
@@ -480,8 +480,8 @@ describe JSON::LD::API do
480
480
  },
481
481
  }.each_pair do |title, params|
482
482
  it title do
483
- jld = JSON::LD::API.compact(params[:input], params[:context], debug: @debug)
484
- expect(jld).to produce(params[:output], @debug)
483
+ jld = JSON::LD::API.compact(params[:input], params[:context], logger: logger)
484
+ expect(jld).to produce(params[:output], logger)
485
485
  end
486
486
  end
487
487
  end
data/spec/context_spec.rb CHANGED
@@ -23,10 +23,8 @@ class JSON::LD::Context
23
23
  end
24
24
 
25
25
  describe JSON::LD::Context do
26
- before(:each) {
27
- @debug = []
28
- }
29
- let(:context) {JSON::LD::Context.new(debug: @debug, validate: true)}
26
+ let(:logger) {RDF::Spec.logger}
27
+ let(:context) {JSON::LD::Context.new(logger: logger, validate: true)}
30
28
  let(:remote_doc) do
31
29
  JSON::LD::API::RemoteDocument.new("http://example.com/context", %q({
32
30
  "@context": {
@@ -45,7 +43,7 @@ describe JSON::LD::Context do
45
43
  it "retrieves and parses a remote context document" do
46
44
  expect(JSON::LD::API).to receive(:documentLoader).with("http://example.com/context", anything).and_yield(remote_doc)
47
45
  ec = subject.parse("http://example.com/context")
48
- expect(ec.provided_context).to produce("http://example.com/context", @debug)
46
+ expect(ec.provided_context).to produce("http://example.com/context", logger)
49
47
  end
50
48
 
51
49
  it "fails given a missing remote @context" do
@@ -61,7 +59,7 @@ describe JSON::LD::Context do
61
59
  "name" => "http://xmlns.com/foaf/0.1/name",
62
60
  "homepage" => "http://xmlns.com/foaf/0.1/homepage",
63
61
  "avatar" => "http://xmlns.com/foaf/0.1/avatar"
64
- }, @debug)
62
+ }, logger)
65
63
  end
66
64
 
67
65
  it "notes non-existing @context" do
@@ -78,7 +76,7 @@ describe JSON::LD::Context do
78
76
  "name" => "http://xmlns.com/foaf/0.1/name",
79
77
  "homepage" => "http://xmlns.com/foaf/0.1/homepage",
80
78
  "avatar" => "http://xmlns.com/foaf/0.1/avatar"
81
- }, @debug)
79
+ }, logger)
82
80
  end
83
81
 
84
82
  context "remote with local mappings" do
@@ -91,7 +89,7 @@ describe JSON::LD::Context do
91
89
  it "does not use passed context as provided_context" do
92
90
  expect(JSON::LD::API).to receive(:documentLoader).with("http://example.com/context", anything).and_yield(remote_doc)
93
91
  ec = subject.parse(ctx)
94
- expect(ec.provided_context).to produce(ctx, @debug)
92
+ expect(ec.provided_context).to produce(ctx, logger)
95
93
  end
96
94
  end
97
95
  end
@@ -109,25 +107,7 @@ describe JSON::LD::Context do
109
107
  expect(ec.send(:mappings)).to produce({
110
108
  "foo" => "http://example.com/foo",
111
109
  "bar" => "http://example.com/foo"
112
- }, @debug)
113
- end
114
-
115
- it "merges definitions from remote contexts" do
116
- expect(JSON::LD::API).to receive(:documentLoader).with("http://example.com/context", anything).and_yield(remote_doc)
117
- rd2 = JSON::LD::API::RemoteDocument.new("http://example.com/c2", %q({
118
- "@context": {
119
- "title": {"@id": "http://purl.org/dc/terms/title"}
120
- }
121
- }))
122
- expect(JSON::LD::API).to receive(:documentLoader).with("http://example.com/c2", anything).and_yield(rd2)
123
- ec = subject.parse(%w(http://example.com/context http://example.com/c2))
124
- expect(ec.send(:mappings)).to produce({
125
- "xsd" => "http://www.w3.org/2001/XMLSchema#",
126
- "name" => "http://xmlns.com/foaf/0.1/name",
127
- "homepage" => "http://xmlns.com/foaf/0.1/homepage",
128
- "avatar" => "http://xmlns.com/foaf/0.1/avatar",
129
- "title" => "http://purl.org/dc/terms/title"
130
- }, @debug)
110
+ }, logger)
131
111
  end
132
112
  end
133
113
 
@@ -135,13 +115,13 @@ describe JSON::LD::Context do
135
115
  it "extracts @language" do
136
116
  expect(subject.parse({
137
117
  "@language" => "en"
138
- }).default_language).to produce("en", @debug)
118
+ }).default_language).to produce("en", logger)
139
119
  end
140
120
 
141
121
  it "extracts @vocab" do
142
122
  expect(subject.parse({
143
123
  "@vocab" => "http://schema.org/"
144
- }).vocab).to produce("http://schema.org/", @debug)
124
+ }).vocab).to produce("http://schema.org/", logger)
145
125
  end
146
126
 
147
127
  it "maps term with IRI value" do
@@ -149,7 +129,7 @@ describe JSON::LD::Context do
149
129
  "foo" => "http://example.com/"
150
130
  }).send(:mappings)).to produce({
151
131
  "foo" => "http://example.com/"
152
- }, @debug)
132
+ }, logger)
153
133
  end
154
134
 
155
135
  it "maps term with @id" do
@@ -157,7 +137,7 @@ describe JSON::LD::Context do
157
137
  "foo" => {"@id" => "http://example.com/"}
158
138
  }).send(:mappings)).to produce({
159
139
  "foo" => "http://example.com/"
160
- }, @debug)
140
+ }, logger)
161
141
  end
162
142
 
163
143
  it "associates @list container mapping with predicate" do
@@ -165,7 +145,7 @@ describe JSON::LD::Context do
165
145
  "foo" => {"@id" => "http://example.com/", "@container" => "@list"}
166
146
  }).containers).to produce({
167
147
  "foo" => '@list'
168
- }, @debug)
148
+ }, logger)
169
149
  end
170
150
 
171
151
  it "associates @set container mapping with predicate" do
@@ -173,7 +153,7 @@ describe JSON::LD::Context do
173
153
  "foo" => {"@id" => "http://example.com/", "@container" => "@set"}
174
154
  }).containers).to produce({
175
155
  "foo" => '@set'
176
- }, @debug)
156
+ }, logger)
177
157
  end
178
158
 
179
159
  it "associates @id container mapping with predicate" do
@@ -181,7 +161,7 @@ describe JSON::LD::Context do
181
161
  "foo" => {"@id" => "http://example.com/", "@type" => "@id"}
182
162
  }).coercions).to produce({
183
163
  "foo" => "@id"
184
- }, @debug)
164
+ }, logger)
185
165
  end
186
166
 
187
167
  it "associates type mapping with predicate" do
@@ -189,7 +169,7 @@ describe JSON::LD::Context do
189
169
  "foo" => {"@id" => "http://example.com/", "@type" => RDF::XSD.string.to_s}
190
170
  }).coercions).to produce({
191
171
  "foo" => RDF::XSD.string
192
- }, @debug)
172
+ }, logger)
193
173
  end
194
174
 
195
175
  it "associates language mapping with predicate" do
@@ -197,7 +177,7 @@ describe JSON::LD::Context do
197
177
  "foo" => {"@id" => "http://example.com/", "@language" => "en"}
198
178
  }).send(:languages)).to produce({
199
179
  "foo" => "en"
200
- }, @debug)
180
+ }, logger)
201
181
  end
202
182
 
203
183
  it "expands chains of term definition/use with string values" do
@@ -209,7 +189,7 @@ describe JSON::LD::Context do
209
189
  "foo" => "http://example.com/",
210
190
  "bar" => "http://example.com/",
211
191
  "baz" => "http://example.com/"
212
- }, @debug)
192
+ }, logger)
213
193
  end
214
194
 
215
195
  it "expands terms using @vocab" do
@@ -218,7 +198,7 @@ describe JSON::LD::Context do
218
198
  "@vocab" => "http://example.com/"
219
199
  }).send(:mappings)).to produce({
220
200
  "foo" => "http://example.com/bar"
221
- }, @debug)
201
+ }, logger)
222
202
  end
223
203
 
224
204
  context "with null" do
@@ -230,7 +210,7 @@ describe JSON::LD::Context do
230
210
  {
231
211
  "@language" => nil
232
212
  }
233
- ]).default_language).to produce(nil, @debug)
213
+ ]).default_language).to produce(nil, logger)
234
214
  end
235
215
 
236
216
  it "removes @vocab if set to null" do
@@ -241,7 +221,7 @@ describe JSON::LD::Context do
241
221
  {
242
222
  "@vocab" => nil
243
223
  }
244
- ]).vocab).to produce(nil, @debug)
224
+ ]).vocab).to produce(nil, logger)
245
225
  end
246
226
 
247
227
  it "removes term if set to null with @vocab" do
@@ -250,7 +230,7 @@ describe JSON::LD::Context do
250
230
  "@vocab" => "http://schema.org/",
251
231
  "term" => nil
252
232
  }
253
- ]).send(:mappings)).to produce({"term" => nil}, @debug)
233
+ ]).send(:mappings)).to produce({"term" => nil}, logger)
254
234
  end
255
235
 
256
236
  it "loads initial context" do
@@ -290,7 +270,7 @@ describe JSON::LD::Context do
290
270
  it title do
291
271
  expect {
292
272
  ec = subject.parse(context)
293
- expect(ec.serialize).to produce({}, @debug)
273
+ expect(ec.serialize).to produce({}, logger)
294
274
  }.to raise_error(JSON::LD::JsonLdError)
295
275
  end
296
276
  end
@@ -299,14 +279,14 @@ describe JSON::LD::Context do
299
279
  it "does not redefine #{kw} as a string" do
300
280
  expect {
301
281
  ec = subject.parse({kw => "http://example.com/"})
302
- expect(ec.serialize).to produce({}, @debug)
282
+ expect(ec.serialize).to produce({}, logger)
303
283
  }.to raise_error(JSON::LD::JsonLdError)
304
284
  end
305
285
 
306
286
  it "does not redefine #{kw} with an @id" do
307
287
  expect {
308
288
  ec = subject.parse({kw => {"@id" => "http://example.com/"}})
309
- expect(ec.serialize).to produce({}, @debug)
289
+ expect(ec.serialize).to produce({}, logger)
310
290
  }.to raise_error(JSON::LD::JsonLdError)
311
291
  end
312
292
  end
@@ -339,7 +319,7 @@ describe JSON::LD::Context do
339
319
  ec = subject.parse("http://example.com/context")
340
320
  expect(ec.serialize).to produce({
341
321
  "@context" => "http://example.com/context"
342
- }, @debug)
322
+ }, logger)
343
323
  end
344
324
 
345
325
  it "context hash" do
@@ -348,7 +328,7 @@ describe JSON::LD::Context do
348
328
  ec = subject.parse(ctx)
349
329
  expect(ec.serialize).to produce({
350
330
  "@context" => ctx
351
- }, @debug)
331
+ }, logger)
352
332
  end
353
333
 
354
334
  it "@language" do
@@ -357,7 +337,7 @@ describe JSON::LD::Context do
357
337
  "@context" => {
358
338
  "@language" => "en"
359
339
  }
360
- }, @debug)
340
+ }, logger)
361
341
  end
362
342
 
363
343
  it "@vocab" do
@@ -366,7 +346,7 @@ describe JSON::LD::Context do
366
346
  "@context" => {
367
347
  "@vocab" => "http://example.com/"
368
348
  }
369
- }, @debug)
349
+ }, logger)
370
350
  end
371
351
 
372
352
  it "term mappings" do
@@ -376,7 +356,7 @@ describe JSON::LD::Context do
376
356
  "@context" => {
377
357
  "foo" => "http://example.com/"
378
358
  }
379
- }, @debug)
359
+ }, logger)
380
360
  end
381
361
 
382
362
  it "@type with dependent prefixes in a single context" do
@@ -390,7 +370,7 @@ describe JSON::LD::Context do
390
370
  "xsd" => RDF::XSD.to_uri.to_s,
391
371
  "homepage" => {"@id" => RDF::Vocab::FOAF.homepage.to_s, "@type" => "@id"}
392
372
  }
393
- }, @debug)
373
+ }, logger)
394
374
  end
395
375
 
396
376
  it "@list with @id definition in a single context" do
@@ -402,7 +382,7 @@ describe JSON::LD::Context do
402
382
  "@context" => {
403
383
  "knows" => {"@id" => RDF::Vocab::FOAF.knows.to_s, "@container" => "@list"}
404
384
  }
405
- }, @debug)
385
+ }, logger)
406
386
  end
407
387
 
408
388
  it "@set with @id definition in a single context" do
@@ -414,7 +394,7 @@ describe JSON::LD::Context do
414
394
  "@context" => {
415
395
  "knows" => {"@id" => RDF::Vocab::FOAF.knows.to_s, "@container" => "@set"}
416
396
  }
417
- }, @debug)
397
+ }, logger)
418
398
  end
419
399
 
420
400
  it "@language with @id definition in a single context" do
@@ -426,7 +406,7 @@ describe JSON::LD::Context do
426
406
  "@context" => {
427
407
  "name" => {"@id" => RDF::Vocab::FOAF.name.to_s, "@language" => "en"}
428
408
  }
429
- }, @debug)
409
+ }, logger)
430
410
  end
431
411
 
432
412
  it "@language with @id definition in a single context and equivalent default" do
@@ -440,7 +420,7 @@ describe JSON::LD::Context do
440
420
  "@language" => 'en',
441
421
  "name" => {"@id" => RDF::Vocab::FOAF.name.to_s, "@language" => 'en'}
442
422
  }
443
- }, @debug)
423
+ }, logger)
444
424
  end
445
425
 
446
426
  it "@language with @id definition in a single context and different default" do
@@ -454,7 +434,7 @@ describe JSON::LD::Context do
454
434
  "@language" => 'en',
455
435
  "name" => {"@id" => RDF::Vocab::FOAF.name.to_s, "@language" => "de"}
456
436
  }
457
- }, @debug)
437
+ }, logger)
458
438
  end
459
439
 
460
440
  it "null @language with @id definition in a single context and default" do
@@ -468,7 +448,7 @@ describe JSON::LD::Context do
468
448
  "@language" => 'en',
469
449
  "name" => {"@id" => RDF::Vocab::FOAF.name.to_s, "@language" => nil}
470
450
  }
471
- }, @debug)
451
+ }, logger)
472
452
  end
473
453
 
474
454
  it "prefix with @type and @list" do
@@ -480,7 +460,7 @@ describe JSON::LD::Context do
480
460
  "@context" => {
481
461
  "knows" => {"@id" => RDF::Vocab::FOAF.knows.to_s, "@type" => "@id", "@container" => "@list"}
482
462
  }
483
- }, @debug)
463
+ }, logger)
484
464
  end
485
465
 
486
466
  it "prefix with @type and @set" do
@@ -492,7 +472,7 @@ describe JSON::LD::Context do
492
472
  "@context" => {
493
473
  "knows" => {"@id" => RDF::Vocab::FOAF.knows.to_s, "@type" => "@id", "@container" => "@set"}
494
474
  }
495
- }, @debug)
475
+ }, logger)
496
476
  end
497
477
 
498
478
  it "CURIE with @type" do
@@ -510,7 +490,7 @@ describe JSON::LD::Context do
510
490
  "@container" => "@list"
511
491
  }
512
492
  }
513
- }, @debug)
493
+ }, logger)
514
494
  end
515
495
 
516
496
  it "does not use aliased @id in key position" do
@@ -524,7 +504,7 @@ describe JSON::LD::Context do
524
504
  "id" => "@id",
525
505
  "knows" => {"@id" => RDF::Vocab::FOAF.knows.to_s, "@container" => "@list"}
526
506
  }
527
- }, @debug)
507
+ }, logger)
528
508
  end
529
509
 
530
510
  it "does not use aliased @id in value position" do
@@ -544,7 +524,7 @@ describe JSON::LD::Context do
544
524
  "@type" => "@id"
545
525
  }
546
526
  }
547
- }, @debug)
527
+ }, logger)
548
528
  end
549
529
 
550
530
  it "does not use aliased @type" do
@@ -560,7 +540,7 @@ describe JSON::LD::Context do
560
540
  "type" => "@type",
561
541
  "foaf:homepage" => {"@type" => "@id"}
562
542
  }
563
- }, @debug)
543
+ }, logger)
564
544
  end
565
545
 
566
546
  it "does not use aliased @container" do
@@ -574,7 +554,7 @@ describe JSON::LD::Context do
574
554
  "container" => "@container",
575
555
  "knows" => {"@id" => RDF::Vocab::FOAF.knows.to_s, "@container" => "@list"}
576
556
  }
577
- }, @debug)
557
+ }, logger)
578
558
  end
579
559
 
580
560
  it "compacts IRIs to CURIEs" do
@@ -588,7 +568,7 @@ describe JSON::LD::Context do
588
568
  "ex" => 'http://example.org/',
589
569
  "term" => {"@id" => "ex:term", "@type" => "ex:datatype"}
590
570
  }
591
- }, @debug)
571
+ }, logger)
592
572
  end
593
573
 
594
574
  it "compacts IRIs using @vocab" do
@@ -602,7 +582,7 @@ describe JSON::LD::Context do
602
582
  "@vocab" => 'http://example.org/',
603
583
  "term" => {"@type" => "datatype"}
604
584
  }
605
- }, @debug)
585
+ }, logger)
606
586
  end
607
587
 
608
588
  context "extra keys or values" do
@@ -614,7 +594,7 @@ describe JSON::LD::Context do
614
594
  }.each do |title, params|
615
595
  it title do
616
596
  ec = subject.parse(params[:input])
617
- expect(ec.serialize).to produce(params[:result], @debug)
597
+ expect(ec.serialize).to produce(params[:result], logger)
618
598
  end
619
599
  end
620
600
  end
@@ -662,7 +642,7 @@ describe JSON::LD::Context do
662
642
  %w(id type).each do |kw|
663
643
  it "expands #{kw} to @#{kw}" do
664
644
  subject.set_mapping(kw, "@#{kw}")
665
- expect(subject.expand_iri(kw, vocab: true)).to produce("@#{kw}", @debug)
645
+ expect(subject.expand_iri(kw, vocab: true)).to produce("@#{kw}", logger)
666
646
  end
667
647
  end
668
648
  end
@@ -684,7 +664,7 @@ describe JSON::LD::Context do
684
664
  "_" => ["_", RDF::URI("_")],
685
665
  }.each do |title, (input, result)|
686
666
  it title do
687
- expect(subject.expand_iri(input)).to produce(result, @debug)
667
+ expect(subject.expand_iri(input)).to produce(result, logger)
688
668
  end
689
669
  end
690
670
  end
@@ -705,7 +685,7 @@ describe JSON::LD::Context do
705
685
  "_" => ["_", RDF::URI("http://base/_")],
706
686
  }.each do |title, (input, result)|
707
687
  it title do
708
- expect(subject.expand_iri(input, documentRelative: true)).to produce(result, @debug)
688
+ expect(subject.expand_iri(input, documentRelative: true)).to produce(result, logger)
709
689
  end
710
690
  end
711
691
  end
@@ -726,7 +706,7 @@ describe JSON::LD::Context do
726
706
  "_" => ["_", RDF::URI("http://underscore/")],
727
707
  }.each do |title, (input, result)|
728
708
  it title do
729
- expect(subject.expand_iri(input, vocab: true)).to produce(result, @debug)
709
+ expect(subject.expand_iri(input, vocab: true)).to produce(result, logger)
730
710
  end
731
711
  end
732
712
  end
@@ -747,7 +727,7 @@ describe JSON::LD::Context do
747
727
  'exp' => {'@id' => 'ex:pert'},
748
728
  'experts' => {'@id' => 'ex:perts'}
749
729
  })
750
- @debug.clear
730
+ logger.clear
751
731
  c
752
732
  }
753
733
 
@@ -763,7 +743,7 @@ describe JSON::LD::Context do
763
743
  "odd CURIE" => ["exp:s", "http://example.org/perts"]
764
744
  }.each do |title, (result, input)|
765
745
  it title do
766
- expect(subject.compact_iri(input)).to produce(result, @debug)
746
+ expect(subject.compact_iri(input)).to produce(result, logger)
767
747
  end
768
748
  end
769
749
 
@@ -779,7 +759,7 @@ describe JSON::LD::Context do
779
759
  "odd CURIE" => ["experts", "http://example.org/perts"]
780
760
  }.each do |title, (result, input)|
781
761
  it title do
782
- expect(subject.compact_iri(input, vocab: true)).to produce(result, @debug)
762
+ expect(subject.compact_iri(input, vocab: true)).to produce(result, logger)
783
763
  end
784
764
  end
785
765
  end
@@ -798,7 +778,7 @@ describe JSON::LD::Context do
798
778
  "odd CURIE" => ["experts", "http://example.org/perts"]
799
779
  }.each do |title, (result, input)|
800
780
  it title do
801
- expect(subject.compact_iri(input, vocab: true)).to produce(result, @debug)
781
+ expect(subject.compact_iri(input, vocab: true)).to produce(result, logger)
802
782
  end
803
783
  end
804
784
 
@@ -806,7 +786,7 @@ describe JSON::LD::Context do
806
786
  subject.set_mapping("name", "http://xmlns.com/foaf/0.1/name")
807
787
  subject.set_mapping("ex", nil)
808
788
  expect(subject.compact_iri("http://example.org/name", position: :predicate)).
809
- to produce("lex:name", @debug)
789
+ to produce("lex:name", logger)
810
790
  end
811
791
  end
812
792
 
@@ -837,7 +817,7 @@ describe JSON::LD::Context do
837
817
  "setid" => {"@id" => "http://example.com/id", "@type" => "@id", "@container" => "@set"},
838
818
  "langmap" => {"@id" => "http://example.com/langmap", "@container" => "@language"},
839
819
  })
840
- @debug.clear
820
+ logger.clear
841
821
  c
842
822
  end
843
823
 
@@ -850,7 +830,7 @@ describe JSON::LD::Context do
850
830
  values.each do |value|
851
831
  it "for #{value.inspect}" do
852
832
  expect(ctx.compact_iri("http://example.com/#{prop.sub('set', '')}", value: value, vocab: true)).
853
- to produce(prop, @debug)
833
+ to produce(prop, logger)
854
834
  end
855
835
  end
856
836
  end
@@ -879,7 +859,7 @@ describe JSON::LD::Context do
879
859
  values.each do |value|
880
860
  it "for #{{"@list" => value}.inspect}" do
881
861
  expect(ctx.compact_iri("http://example.com/#{prop.sub('list', '')}", value: {"@list" => value}, vocab: true)).
882
- to produce(prop, @debug)
862
+ to produce(prop, logger)
883
863
  end
884
864
  end
885
865
  end
@@ -902,7 +882,7 @@ describe JSON::LD::Context do
902
882
  "odd CURIE" => ["ex:perts", "http://example.org/perts"]
903
883
  }.each do |title, (result, input)|
904
884
  it title do
905
- expect(subject.compact_iri(input)).to produce(result, @debug)
885
+ expect(subject.compact_iri(input)).to produce(result, logger)
906
886
  end
907
887
  end
908
888
 
@@ -920,7 +900,7 @@ describe JSON::LD::Context do
920
900
  "odd CURIE" => ["experts", "http://example.org/perts"]
921
901
  }.each do |title, (result, input)|
922
902
  it title do
923
- expect(subject.compact_iri(input, vocab: true)).to produce(result, @debug)
903
+ expect(subject.compact_iri(input, vocab: true)).to produce(result, logger)
924
904
  end
925
905
  end
926
906
  end
@@ -1026,7 +1006,7 @@ describe JSON::LD::Context do
1026
1006
  [value].flatten.each do |v|
1027
1007
  it "Uses #{term} for #{v}" do
1028
1008
  expect(ctx.compact_iri("http://example.com/term", value: JSON.parse(v), vocab: true)).
1029
- to produce(term, @debug)
1009
+ to produce(term, logger)
1030
1010
  end
1031
1011
  end
1032
1012
  end
@@ -1041,7 +1021,7 @@ describe JSON::LD::Context do
1041
1021
  end
1042
1022
  it "Compact @id that is a property IRI when @container is @list" do
1043
1023
  expect(ctx.compact_iri("http://example.org/ns#property", position: :subject)).
1044
- to produce("ex:property", @debug)
1024
+ to produce("ex:property", logger)
1045
1025
  end
1046
1026
  end
1047
1027
 
@@ -1053,7 +1033,7 @@ describe JSON::LD::Context do
1053
1033
  expect(ctx.compact_iri("http://example.com/property", value: {
1054
1034
  "@list" => ["one item"],
1055
1035
  "@index" => "an annotation"
1056
- })).to produce("http://example.com/property", @debug)
1036
+ })).to produce("http://example.com/property", logger)
1057
1037
  end
1058
1038
  end
1059
1039
  end
@@ -1072,13 +1052,13 @@ describe JSON::LD::Context do
1072
1052
  "ex:double" => {"@type" => "xsd:double"},
1073
1053
  "ex:boolean" => {"@type" => "xsd:boolean"},
1074
1054
  })
1075
- @debug.clear
1055
+ logger.clear
1076
1056
  ctx
1077
1057
  }
1078
1058
 
1079
1059
  %w(boolean integer string dateTime date time).each do |dt|
1080
1060
  it "expands datatype xsd:#{dt}" do
1081
- expect(subject.expand_value("foo", RDF::XSD[dt])).to produce({"@id" => "http://www.w3.org/2001/XMLSchema##{dt}"}, @debug)
1061
+ expect(subject.expand_value("foo", RDF::XSD[dt])).to produce({"@id" => "http://www.w3.org/2001/XMLSchema##{dt}"}, logger)
1082
1062
  end
1083
1063
  end
1084
1064
 
@@ -1107,7 +1087,7 @@ describe JSON::LD::Context do
1107
1087
  "rdf float" => ["foo", RDF::Literal::Float.new(1.0), {"@value" => "1.0", "@type" => RDF::XSD.float}],
1108
1088
  }.each do |title, (key, compacted, expanded)|
1109
1089
  it title do
1110
- expect(subject.expand_value(key, compacted)).to produce(expanded, @debug)
1090
+ expect(subject.expand_value(key, compacted)).to produce(expanded, logger)
1111
1091
  end
1112
1092
  end
1113
1093
 
@@ -1122,7 +1102,7 @@ describe JSON::LD::Context do
1122
1102
  "native double" => ["foo", 1.1, {"@value" => 1.1}],
1123
1103
  }.each do |title, (key, compacted, expanded)|
1124
1104
  it title do
1125
- expect(subject.expand_value(key, compacted)).to produce(expanded, @debug)
1105
+ expect(subject.expand_value(key, compacted)).to produce(expanded, logger)
1126
1106
  end
1127
1107
  end
1128
1108
  end
@@ -1144,7 +1124,7 @@ describe JSON::LD::Context do
1144
1124
  "string-integer" => ["foaf:age", "foo", {"@value" => "foo", "@type" => RDF::XSD.integer.to_s}],
1145
1125
  }.each do |title, (key, compacted, expanded)|
1146
1126
  it title do
1147
- expect(subject.expand_value(key, compacted)).to produce(expanded, @debug)
1127
+ expect(subject.expand_value(key, compacted)).to produce(expanded, logger)
1148
1128
  end
1149
1129
  end
1150
1130
  end
@@ -1164,7 +1144,7 @@ describe JSON::LD::Context do
1164
1144
  "foaf:age" => {"@type" => RDF::XSD.integer.to_s},
1165
1145
  "foaf:knows" => {"@type" => "@id"},
1166
1146
  })
1167
- @debug.clear
1147
+ logger.clear
1168
1148
  c
1169
1149
  end
1170
1150
  subject {ctx}
@@ -1187,7 +1167,7 @@ describe JSON::LD::Context do
1187
1167
  "native double" => ["foo", 1.1e1, {"@value" => 1.1E1}],
1188
1168
  }.each do |title, (key, compacted, expanded)|
1189
1169
  it title do
1190
- expect(subject.compact_value(key, expanded)).to produce(compacted, @debug)
1170
+ expect(subject.compact_value(key, expanded)).to produce(compacted, logger)
1191
1171
  end
1192
1172
  end
1193
1173
 
@@ -1214,7 +1194,7 @@ describe JSON::LD::Context do
1214
1194
  }.each do |title, (key, compacted, expanded)|
1215
1195
  it title do
1216
1196
  subject.default_language = "en"
1217
- expect(subject.compact_value(key, expanded)).to produce(compacted, @debug)
1197
+ expect(subject.compact_value(key, expanded)).to produce(compacted, logger)
1218
1198
  end
1219
1199
  end
1220
1200
  end
@@ -1236,7 +1216,7 @@ describe JSON::LD::Context do
1236
1216
  "@value" => [{"literal" => "foo", "language" => "bar"}, {"@value" => "foo", "@language" => "bar"}],
1237
1217
  }.each do |title, (compacted, expanded)|
1238
1218
  it title do
1239
- expect(subject.compact_value("foo", expanded)).to produce(compacted, @debug)
1219
+ expect(subject.compact_value("foo", expanded)).to produce(compacted, logger)
1240
1220
  end
1241
1221
  end
1242
1222
  end
@@ -1254,7 +1234,7 @@ describe JSON::LD::Context do
1254
1234
  "set" => {"@id" => "ex:set", "@container" => "@set"},
1255
1235
  "ndx" => {"@id" => "ex:ndx", "@container" => "@index"},
1256
1236
  })
1257
- @debug.clear
1237
+ logger.clear
1258
1238
  ctx
1259
1239
  }
1260
1240
  it "uses TermDefinition" do
@@ -1279,7 +1259,7 @@ describe JSON::LD::Context do
1279
1259
  "nil" => {"@id" => "ex:nil", "@language" => nil},
1280
1260
  "en" => {"@id" => "ex:en", "@language" => "en"},
1281
1261
  })
1282
- @debug.clear
1262
+ logger.clear
1283
1263
  ctx
1284
1264
  }
1285
1265
  it "uses TermDefinition" do
@@ -1301,7 +1281,7 @@ describe JSON::LD::Context do
1301
1281
  "ex" => "http://example.org/",
1302
1282
  "reverse" => {"@reverse" => "ex:reverse"},
1303
1283
  })
1304
- @debug.clear
1284
+ logger.clear
1305
1285
  ctx
1306
1286
  }
1307
1287
  it "uses TermDefinition" do
@@ -1321,7 +1301,7 @@ describe JSON::LD::Context do
1321
1301
  "ex" => "http://example.org/",
1322
1302
  "reverse" => {"@reverse" => "ex"},
1323
1303
  })
1324
- @debug.clear
1304
+ logger.clear
1325
1305
  ctx
1326
1306
  }
1327
1307
  it "uses TermDefinition" do