json-ld 1.1.5 → 1.1.6

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.
@@ -68,7 +68,7 @@ describe JSON::LD::API do
68
68
  }.each_pair do |title, params|
69
69
  it title do
70
70
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
71
- jld.should produce(params[:output], @debug)
71
+ expect(jld).to produce(params[:output], @debug)
72
72
  end
73
73
  end
74
74
 
@@ -115,7 +115,7 @@ describe JSON::LD::API do
115
115
  }.each do |title, params|
116
116
  it title do
117
117
  jld = JSON::LD::API.expand(params[:input], :base => "http://example.org/", :debug => @debug)
118
- jld.should produce(params[:output], @debug)
118
+ expect(jld).to produce(params[:output], @debug)
119
119
  end
120
120
  end
121
121
  end
@@ -174,7 +174,7 @@ describe JSON::LD::API do
174
174
  }.each do |title, params|
175
175
  it title do
176
176
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
177
- jld.should produce(params[:output], @debug)
177
+ expect(jld).to produce(params[:output], @debug)
178
178
  end
179
179
  end
180
180
  end
@@ -229,7 +229,7 @@ describe JSON::LD::API do
229
229
  }.each do |title, params|
230
230
  it title do
231
231
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
232
- jld.should produce(params[:output], @debug)
232
+ expect(jld).to produce(params[:output], @debug)
233
233
  end
234
234
  end
235
235
  end
@@ -257,7 +257,7 @@ describe JSON::LD::API do
257
257
  }.each do |title, params|
258
258
  it title do
259
259
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
260
- jld.should produce(params[:output], @debug)
260
+ expect(jld).to produce(params[:output], @debug)
261
261
  end
262
262
  end
263
263
  end
@@ -301,7 +301,7 @@ describe JSON::LD::API do
301
301
  }.each do |title, params|
302
302
  it title do
303
303
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
304
- jld.should produce(params[:output], @debug)
304
+ expect(jld).to produce(params[:output], @debug)
305
305
  end
306
306
  end
307
307
  end
@@ -329,7 +329,7 @@ describe JSON::LD::API do
329
329
  }.each do |title, params|
330
330
  it title do
331
331
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
332
- jld.should produce(params[:output], @debug)
332
+ expect(jld).to produce(params[:output], @debug)
333
333
  end
334
334
  end
335
335
  end
@@ -397,7 +397,7 @@ describe JSON::LD::API do
397
397
  jld = JSON::LD::API.expand(params[:input],
398
398
  :base => "http://foo/bar/",
399
399
  :debug => @debug)
400
- jld.should produce(params[:output], @debug)
400
+ expect(jld).to produce(params[:output], @debug)
401
401
  end
402
402
  end
403
403
  end
@@ -452,7 +452,7 @@ describe JSON::LD::API do
452
452
  }.each do |title, params|
453
453
  it title do
454
454
  jld = JSON::LD::API.expand(params[:input], :debug => @debug, :base => 'http://example/')
455
- jld.should produce(params[:output], @debug)
455
+ expect(jld).to produce(params[:output], @debug)
456
456
  end
457
457
  end
458
458
  end
@@ -531,7 +531,7 @@ describe JSON::LD::API do
531
531
  }.each do |title, params|
532
532
  it title do
533
533
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
534
- jld.should produce(params[:output], @debug)
534
+ expect(jld).to produce(params[:output], @debug)
535
535
  end
536
536
  end
537
537
  end
@@ -584,7 +584,7 @@ describe JSON::LD::API do
584
584
  }.each do |title, params|
585
585
  it title do
586
586
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
587
- jld.should produce(params[:output], @debug)
587
+ expect(jld).to produce(params[:output], @debug)
588
588
  end
589
589
  end
590
590
  end
@@ -652,7 +652,7 @@ describe JSON::LD::API do
652
652
  }.each do |title, params|
653
653
  it title do
654
654
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
655
- jld.should produce(params[:output], @debug)
655
+ expect(jld).to produce(params[:output], @debug)
656
656
  end
657
657
  end
658
658
  end
@@ -749,7 +749,7 @@ describe JSON::LD::API do
749
749
  }.each do |title, params|
750
750
  it title do
751
751
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
752
- jld.should produce(params[:output], @debug)
752
+ expect(jld).to produce(params[:output], @debug)
753
753
  end
754
754
  end
755
755
  end
@@ -784,7 +784,7 @@ describe JSON::LD::API do
784
784
  }.each do |title, params|
785
785
  it title do
786
786
  jld = JSON::LD::API.expand(params[:input], :debug => @debug)
787
- jld.should produce(params[:output], @debug)
787
+ expect(jld).to produce(params[:output], @debug)
788
788
  end
789
789
  end
790
790
  end
@@ -849,7 +849,7 @@ describe JSON::LD::API do
849
849
  }.each do |title, params|
850
850
  it title do
851
851
  #JSON::LD::API.expand(params[:input], :debug => @debug).should produce([], @debug)
852
- lambda {JSON::LD::API.expand(params[:input])}.should raise_error(params[:exception])
852
+ expect {JSON::LD::API.expand(params[:input])}.to raise_error(params[:exception])
853
853
  end
854
854
  end
855
855
  end
@@ -215,7 +215,7 @@ describe JSON::LD::API do
215
215
  it title do
216
216
  @debug = []
217
217
  jld = JSON::LD::API.flatten(params[:input], nil, (params[:options] || {}).merge(:debug => @debug))
218
- jld.should produce(params[:output], @debug)
218
+ expect(jld).to produce(params[:output], @debug)
219
219
  end
220
220
  end
221
221
  end
@@ -20,7 +20,7 @@ describe JSON::LD::Format do
20
20
  {:content_type => 'application/x-ld+json'},
21
21
  ].each do |arg|
22
22
  it "discovers with #{arg.inspect}" do
23
- RDF::Format.for(arg).should == @format_class
23
+ expect(RDF::Format.for(arg)).to eq @format_class
24
24
  end
25
25
  end
26
26
 
@@ -31,17 +31,17 @@ describe JSON::LD::Format do
31
31
  :type => %({\n"@type": {),
32
32
  }.each do |sym, str|
33
33
  it "detects #{sym}" do
34
- @format_class.for {str}.should == @format_class
34
+ expect(@format_class.for {str}).to eq @format_class
35
35
  end
36
36
  end
37
37
 
38
38
  it "should discover 'jsonld'" do
39
- RDF::Format.for(:jsonld).reader.should == JSON::LD::Reader
39
+ expect(RDF::Format.for(:jsonld).reader).to eq JSON::LD::Reader
40
40
  end
41
41
  end
42
42
 
43
43
  describe "#to_sym" do
44
- specify {@format_class.to_sym.should == :jsonld}
44
+ specify {expect(@format_class.to_sym).to eq :jsonld}
45
45
  end
46
46
 
47
47
  describe ".detect" do
@@ -49,7 +49,7 @@ describe JSON::LD::Format do
49
49
  :jsonld => '{"@context" => "foo"}',
50
50
  }.each do |sym, str|
51
51
  it "detects #{sym}" do
52
- @format_class.detect(str).should be_true
52
+ expect(@format_class.detect(str)).to be_truthy
53
53
  end
54
54
  end
55
55
 
@@ -64,7 +64,7 @@ describe JSON::LD::Format do
64
64
  :turtle => "@prefix foo: <bar> .\n foo:a foo:b <c> .",
65
65
  }.each do |sym, str|
66
66
  it "does not detect #{sym}" do
67
- @format_class.detect(str).should be_false
67
+ expect(@format_class.detect(str)).to be_falsey
68
68
  end
69
69
  end
70
70
  end
@@ -504,7 +504,7 @@ describe JSON::LD::API do
504
504
  @debug = []
505
505
  begin
506
506
  jld = JSON::LD::API.frame(params[:input], params[:frame], :debug => @debug)
507
- jld.should produce(params[:output], @debug)
507
+ expect(jld).to produce(params[:output], @debug)
508
508
  rescue JSON::LD::JsonLdError, JSON::LD::JsonLdError, JSON::LD::InvalidFrame => e
509
509
  fail("#{e.class}: #{e.message}\n" +
510
510
  "#{@debug.join("\n")}\n" +
@@ -512,5 +512,58 @@ describe JSON::LD::API do
512
512
  end
513
513
  end
514
514
  end
515
+
516
+ describe "@reverse", skip:true do
517
+ {
518
+ "embed matched frames with @reverse" => {
519
+ :frame => {
520
+ "@context" => {"ex" => "http://example.org/"},
521
+ "@type" => "ex:Type1",
522
+ "@reverse" => {
523
+ "ex:includes" => {}
524
+ }
525
+ },
526
+ :input => [
527
+ {
528
+ "@context" => {"ex" => "http://example.org/"},
529
+ "@id" => "ex:Sub1",
530
+ "@type" => "ex:Type1"
531
+ },
532
+ {
533
+ "@context" => {"ex" => "http://example.org/"},
534
+ "@id" => "ex:Sub2",
535
+ "@type" => "ex:Type2",
536
+ "ex:includes" => {"@id" => "ex:Sub1"}
537
+ },
538
+ ],
539
+ :output =>{
540
+ "@context" => {"ex" => "http://example.org/"},
541
+ "@graph" => [{
542
+ "@id" => "ex:Sub1",
543
+ "@type" => "ex:Type1",
544
+ "@reverse" => {
545
+ "ex:includes" => {
546
+ "@id" => "ex:Sub2",
547
+ "@type" => "ex:Type2",
548
+ "ex:includes" => {"@id" => "ex:Sub1"}
549
+ }
550
+ }
551
+ }]
552
+ }
553
+ },
554
+ }.each do |title, params|
555
+ it title do
556
+ @debug = []
557
+ begin
558
+ jld = JSON::LD::API.frame(params[:input], params[:frame], :debug => @debug)
559
+ expect(jld).to produce(params[:output], @debug)
560
+ rescue JSON::LD::JsonLdError, JSON::LD::JsonLdError, JSON::LD::InvalidFrame => e
561
+ fail("#{e.class}: #{e.message}\n" +
562
+ "#{@debug.join("\n")}\n" +
563
+ "Backtrace:\n#{e.backtrace.join("\n")}")
564
+ end
565
+ end
566
+ end
567
+ end
515
568
  end
516
569
  end
@@ -8,7 +8,7 @@ describe JSON::LD::API do
8
8
  context "simple tests" do
9
9
  it "One subject IRI object" do
10
10
  input = %(<http://a/b> <http://a/c> <http://a/d> .)
11
- serialize(input).should produce([
11
+ expect(serialize(input)).to produce([
12
12
  {
13
13
  '@id' => "http://a/b",
14
14
  "http://a/c" => [{"@id" => "http://a/d"}]
@@ -18,8 +18,8 @@ describe JSON::LD::API do
18
18
 
19
19
  it "should generate object list" do
20
20
  input = %(@prefix : <http://example.com/> . :b :c :d, :e .)
21
- serialize(input).
22
- should produce([{
21
+ expect(serialize(input)).
22
+ to produce([{
23
23
  '@id' => "http://example.com/b",
24
24
  "http://example.com/c" => [
25
25
  {"@id" => "http://example.com/d"},
@@ -31,8 +31,8 @@ describe JSON::LD::API do
31
31
 
32
32
  it "should generate property list" do
33
33
  input = %(@prefix : <http://example.com/> . :b :c :d; :e :f .)
34
- serialize(input).
35
- should produce([{
34
+ expect(serialize(input)).
35
+ to produce([{
36
36
  '@id' => "http://example.com/b",
37
37
  "http://example.com/c" => [{"@id" => "http://example.com/d"}],
38
38
  "http://example.com/e" => [{"@id" => "http://example.com/f"}]
@@ -47,8 +47,8 @@ describe JSON::LD::API do
47
47
  <test-cases/0001> a :TestCase .
48
48
  <test-cases/0002> a :TestCase .
49
49
  )
50
- serialize(input).
51
- should produce([
50
+ expect(serialize(input)).
51
+ to produce([
52
52
  {'@id' => "test-cases/0001", '@type' => ["http://www.w3.org/2006/03/test-description#TestCase"]},
53
53
  {'@id' => "test-cases/0002", '@type' => ["http://www.w3.org/2006/03/test-description#TestCase"]},
54
54
  ], @debug)
@@ -59,7 +59,7 @@ describe JSON::LD::API do
59
59
  context "coercion" do
60
60
  it "typed literal" do
61
61
  input = %(@prefix ex: <http://example.com/> . ex:a ex:b "foo"^^ex:d .)
62
- serialize(input).should produce([
62
+ expect(serialize(input)).to produce([
63
63
  {
64
64
  '@id' => "http://example.com/a",
65
65
  "http://example.com/b" => [{"@value" => "foo", "@type" => "http://example.com/d"}]
@@ -69,7 +69,7 @@ describe JSON::LD::API do
69
69
 
70
70
  it "integer" do
71
71
  input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1 .)
72
- serialize(input, :useNativeTypes => true).should produce([{
72
+ expect(serialize(input, :useNativeTypes => true)).to produce([{
73
73
  '@id' => "http://example.com/a",
74
74
  "http://example.com/b" => [{"@value" => 1}]
75
75
  }], @debug)
@@ -77,7 +77,7 @@ describe JSON::LD::API do
77
77
 
78
78
  it "integer (non-native)" do
79
79
  input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1 .)
80
- serialize(input, :useNativeTypes => false).should produce([{
80
+ expect(serialize(input, :useNativeTypes => false)).to produce([{
81
81
  '@id' => "http://example.com/a",
82
82
  "http://example.com/b" => [{"@value" => "1","@type" => "http://www.w3.org/2001/XMLSchema#integer"}]
83
83
  }], @debug)
@@ -85,7 +85,7 @@ describe JSON::LD::API do
85
85
 
86
86
  it "boolean" do
87
87
  input = %(@prefix ex: <http://example.com/> . ex:a ex:b true .)
88
- serialize(input, :useNativeTypes => true).should produce([{
88
+ expect(serialize(input, :useNativeTypes => true)).to produce([{
89
89
  '@id' => "http://example.com/a",
90
90
  "http://example.com/b" => [{"@value" => true}]
91
91
  }], @debug)
@@ -93,7 +93,7 @@ describe JSON::LD::API do
93
93
 
94
94
  it "boolean (non-native)" do
95
95
  input = %(@prefix ex: <http://example.com/> . ex:a ex:b true .)
96
- serialize(input, :useNativeTypes => false).should produce([{
96
+ expect(serialize(input, :useNativeTypes => false)).to produce([{
97
97
  '@id' => "http://example.com/a",
98
98
  "http://example.com/b" => [{"@value" => "true","@type" => "http://www.w3.org/2001/XMLSchema#boolean"}]
99
99
  }], @debug)
@@ -101,7 +101,7 @@ describe JSON::LD::API do
101
101
 
102
102
  it "decmal" do
103
103
  input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1.0 .)
104
- serialize(input, :useNativeTypes => true).should produce([{
104
+ expect(serialize(input, :useNativeTypes => true)).to produce([{
105
105
  '@id' => "http://example.com/a",
106
106
  "http://example.com/b" => [{"@value" => "1.0", "@type" => "http://www.w3.org/2001/XMLSchema#decimal"}]
107
107
  }], @debug)
@@ -109,7 +109,7 @@ describe JSON::LD::API do
109
109
 
110
110
  it "double" do
111
111
  input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1.0e0 .)
112
- serialize(input, :useNativeTypes => true).should produce([{
112
+ expect(serialize(input, :useNativeTypes => true)).to produce([{
113
113
  '@id' => "http://example.com/a",
114
114
  "http://example.com/b" => [{"@value" => 1.0E0}]
115
115
  }], @debug)
@@ -117,7 +117,7 @@ describe JSON::LD::API do
117
117
 
118
118
  it "double (non-native)" do
119
119
  input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1.0e0 .)
120
- serialize(input, :useNativeTypes => false).should produce([{
120
+ expect(serialize(input, :useNativeTypes => false)).to produce([{
121
121
  '@id' => "http://example.com/a",
122
122
  "http://example.com/b" => [{"@value" => "1.0E0","@type" => "http://www.w3.org/2001/XMLSchema#double"}]
123
123
  }], @debug)
@@ -139,7 +139,7 @@ describe JSON::LD::API do
139
139
  @prefix ex: <http://example.com/> .
140
140
  ex:a ex:b "#{v}"^^xsd:#{t} .
141
141
  )
142
- serialize(input, :useNativeTypes => false).should produce([{
142
+ expect(serialize(input, :useNativeTypes => false)).to produce([{
143
143
  '@id' => "http://example.com/a",
144
144
  "http://example.com/b" => [{"@value" => "#{v}","@type" => "http://www.w3.org/2001/XMLSchema##{t}"}]
145
145
  }], @debug)
@@ -149,7 +149,7 @@ describe JSON::LD::API do
149
149
 
150
150
  it "encodes language literal" do
151
151
  input = %(@prefix ex: <http://example.com/> . ex:a ex:b "foo"@en-us .)
152
- serialize(input).should produce([{
152
+ expect(serialize(input)).to produce([{
153
153
  '@id' => "http://example.com/a",
154
154
  "http://example.com/b" => [{"@value" => "foo", "@language" => "en-us"}]
155
155
  }], @debug)
@@ -159,7 +159,7 @@ describe JSON::LD::API do
159
159
  context "anons" do
160
160
  it "should generate bare anon" do
161
161
  input = %(@prefix : <http://example.com/> . _:a :a :b .)
162
- serialize(input).should produce([
162
+ expect(serialize(input)).to produce([
163
163
  {
164
164
  "@id" => "_:a",
165
165
  "http://example.com/a" => [{"@id" => "http://example.com/b"}]
@@ -169,7 +169,7 @@ describe JSON::LD::API do
169
169
 
170
170
  it "should generate anon as object" do
171
171
  input = %(@prefix : <http://example.com/> . :a :b _:a . _:a :c :d .)
172
- serialize(input).should produce([
172
+ expect(serialize(input)).to produce([
173
173
  {
174
174
  "@id" => "_:a",
175
175
  "http://example.com/c" => [{"@id" => "http://example.com/d"}]
@@ -181,66 +181,101 @@ describe JSON::LD::API do
181
181
  ], @debug)
182
182
  end
183
183
  end
184
-
184
+
185
185
  context "lists" do
186
- it "should generate literal list" do
187
- input = %(
188
- @prefix : <http://example.com/> .
189
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
190
- :a :b ("apple" "banana") .
191
- )
192
- serialize(input).should produce([{
193
- '@id' => "http://example.com/a",
194
- "http://example.com/b" => [{
195
- "@list" => [
196
- {"@value" => "apple"},
197
- {"@value" => "banana"}
198
- ]
186
+ {
187
+ "literal list" => [
188
+ %q(
189
+ @prefix : <http://example.com/> .
190
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
191
+ :a :b ("apple" "banana") .
192
+ ),
193
+ [{
194
+ '@id' => "http://example.com/a",
195
+ "http://example.com/b" => [{
196
+ "@list" => [
197
+ {"@value" => "apple"},
198
+ {"@value" => "banana"}
199
+ ]
200
+ }]
199
201
  }]
200
- }], @debug)
201
- end
202
-
203
- it "should generate iri list" do
204
- input = %(@prefix : <http://example.com/> . :a :b (:c) .)
205
- serialize(input).should produce([{
206
- '@id' => "http://example.com/a",
207
- "http://example.com/b" => [{
208
- "@list" => [
209
- {"@id" => "http://example.com/c"}
210
- ]
202
+ ],
203
+ "iri list" => [
204
+ %q(@prefix : <http://example.com/> . :a :b (:c) .),
205
+ [{
206
+ '@id' => "http://example.com/a",
207
+ "http://example.com/b" => [{
208
+ "@list" => [
209
+ {"@id" => "http://example.com/c"}
210
+ ]
211
+ }]
211
212
  }]
212
- }], @debug)
213
- end
214
-
215
- it "should generate empty list" do
216
- input = %(@prefix : <http://example.com/> . :a :b () .)
217
- serialize(input).should produce([{
218
- '@id' => "http://example.com/a",
219
- "http://example.com/b" => [{"@list" => []}]
220
- }], @debug)
221
- end
222
-
223
- it "should generate single element list" do
224
- input = %(@prefix : <http://example.com/> . :a :b ( "apple" ) .)
225
- serialize(input).should produce([{
226
- '@id' => "http://example.com/a",
227
- "http://example.com/b" => [{"@list" => [{"@value" => "apple"}]}]
228
- }], @debug)
229
- end
230
-
231
- it "should generate single element list without @type" do
232
- input = %(
233
- @prefix : <http://example.com/> . :a :b ( _:a ) . _:a :b "foo" .)
234
- serialize(input).should produce([
235
- {
236
- '@id' => "_:a",
237
- "http://example.com/b" => [{"@value" => "foo"}]
238
- },
239
- {
213
+ ],
214
+ "empty list" => [
215
+ %q(@prefix : <http://example.com/> . :a :b () .),
216
+ [{
240
217
  '@id' => "http://example.com/a",
241
- "http://example.com/b" => [{"@list" => [{"@id" => "_:a"}]}]
218
+ "http://example.com/b" => [{"@list" => []}]
219
+ }]
220
+ ],
221
+ "single element list" => [
222
+ %q(@prefix : <http://example.com/> . :a :b ( "apple" ) .),
223
+ [{
224
+ '@id' => "http://example.com/a",
225
+ "http://example.com/b" => [{"@list" => [{"@value" => "apple"}]}]
226
+ }]
227
+ ],
228
+ "single element list without @type" => [
229
+ %q(@prefix : <http://example.com/> . :a :b ( _:a ) . _:a :b "foo" .),
230
+ [
231
+ {
232
+ '@id' => "_:a",
233
+ "http://example.com/b" => [{"@value" => "foo"}]
234
+ },
235
+ {
236
+ '@id' => "http://example.com/a",
237
+ "http://example.com/b" => [{"@list" => [{"@id" => "_:a"}]}]
238
+ },
239
+ ]
240
+ ],
241
+ "multiple graphs with shared BNode" => [
242
+ %q(
243
+ <http://www.example.com/z> <http://www.example.com/q> _:z0 <http://www.example.com/G> .
244
+ _:z0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "cell-A" <http://www.example.com/G> .
245
+ _:z0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:z1 <http://www.example.com/G> .
246
+ _:z1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "cell-B" <http://www.example.com/G> .
247
+ _:z1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://www.example.com/G> .
248
+ <http://www.example.com/x> <http://www.example.com/p> _:z1 <http://www.example.com/G1> .
249
+ ),
250
+ [{
251
+ "@id" => "http://www.example.com/G",
252
+ "@graph" => [{
253
+ "@id" => "_:z0",
254
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" => [{"@value" => "cell-A"}],
255
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" => [{"@id" => "_:z1"}]
256
+ }, {
257
+ "@id" => "_:z1",
258
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" => [{"@value" => "cell-B"}],
259
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" => [{"@list" => []}]
260
+ }, {
261
+ "@id" => "http://www.example.com/z",
262
+ "http://www.example.com/q" => [{"@id" => "_:z0"}]
263
+ }]
242
264
  },
243
- ], @debug)
265
+ {
266
+ "@id" => "http://www.example.com/G1",
267
+ "@graph" => [{
268
+ "@id" => "http://www.example.com/x",
269
+ "http://www.example.com/p" => [{"@id" => "_:z1"}]
270
+ }]
271
+ }],
272
+ RDF::NQuads::Reader
273
+ ],
274
+ }.each do |name, (input, output, reader)|
275
+ it name do
276
+ r = serialize(input, :reader => reader)
277
+ expect(r).to produce(output, @debug)
278
+ end
244
279
  end
245
280
  end
246
281
 
@@ -333,7 +368,7 @@ describe JSON::LD::API do
333
368
  }.each_pair do |name, properties|
334
369
  it name do
335
370
  r = serialize(properties[:input], :reader => RDF::NQuads::Reader)
336
- r.should produce(properties[:output], @debug)
371
+ expect(r).to produce(properties[:output], @debug)
337
372
  end
338
373
  end
339
374
  end
@@ -356,14 +391,14 @@ describe JSON::LD::API do
356
391
  ],
357
392
  }.each do |t, (input, output)|
358
393
  it "#{t}" do
359
- serialize(input).should produce(output, @debug)
394
+ expect(serialize(input)).to produce(output, @debug)
360
395
  end
361
396
  end
362
397
  end
363
398
  end
364
399
 
365
400
  def parse(input, options = {})
366
- reader = options[:reader] || RDF::Turtle::Reader
401
+ reader = options[:reader] || RDF::TriG::Reader
367
402
  RDF::Repository.new << reader.new(input, options)
368
403
  end
369
404