json-ld 1.99.2 → 2.0.0.beta1
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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/VERSION +1 -1
- data/lib/json/ld.rb +0 -3
- data/lib/json/ld/api.rb +38 -21
- data/lib/json/ld/compact.rb +24 -24
- data/lib/json/ld/context.rb +80 -79
- data/lib/json/ld/expand.rb +30 -30
- data/lib/json/ld/flatten.rb +2 -2
- data/lib/json/ld/format.rb +126 -1
- data/lib/json/ld/frame.rb +3 -3
- data/lib/json/ld/from_rdf.rb +3 -3
- data/lib/json/ld/reader.rb +15 -5
- data/lib/json/ld/streaming_writer.rb +6 -6
- data/lib/json/ld/to_rdf.rb +75 -85
- data/lib/json/ld/utils.rb +1 -30
- data/lib/json/ld/writer.rb +86 -51
- data/spec/api_spec.rb +8 -8
- data/spec/compact_spec.rb +19 -19
- data/spec/context_spec.rb +76 -96
- data/spec/expand_spec.rb +30 -30
- data/spec/flatten_spec.rb +3 -4
- data/spec/format_spec.rb +43 -0
- data/spec/frame_spec.rb +7 -9
- data/spec/from_rdf_spec.rb +25 -24
- data/spec/reader_spec.rb +4 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/streaming_writer_spec.rb +18 -11
- data/spec/suite_helper.rb +29 -28
- data/spec/suite_to_rdf_spec.rb +0 -2
- data/spec/to_rdf_spec.rb +17 -18
- data/spec/writer_spec.rb +15 -11
- metadata +75 -35
- data/spec/matchers.rb +0 -67
data/spec/expand_spec.rb
CHANGED
@@ -3,7 +3,7 @@ $:.unshift "."
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe JSON::LD::API do
|
6
|
-
|
6
|
+
let(:logger) {RDF::Spec.logger}
|
7
7
|
|
8
8
|
describe ".expand" do
|
9
9
|
{
|
@@ -67,8 +67,8 @@ describe JSON::LD::API do
|
|
67
67
|
}
|
68
68
|
}.each_pair do |title, params|
|
69
69
|
it title do
|
70
|
-
jld = JSON::LD::API.expand(params[:input],
|
71
|
-
expect(jld).to produce(params[:output],
|
70
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
71
|
+
expect(jld).to produce(params[:output], logger)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -114,8 +114,8 @@ describe JSON::LD::API do
|
|
114
114
|
},
|
115
115
|
}.each do |title, params|
|
116
116
|
it title do
|
117
|
-
jld = JSON::LD::API.expand(params[:input], base: "http://example.org/",
|
118
|
-
expect(jld).to produce(params[:output],
|
117
|
+
jld = JSON::LD::API.expand(params[:input], base: "http://example.org/", logger: logger)
|
118
|
+
expect(jld).to produce(params[:output], logger)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
@@ -173,8 +173,8 @@ describe JSON::LD::API do
|
|
173
173
|
},
|
174
174
|
}.each do |title, params|
|
175
175
|
it title do
|
176
|
-
jld = JSON::LD::API.expand(params[:input],
|
177
|
-
expect(jld).to produce(params[:output],
|
176
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
177
|
+
expect(jld).to produce(params[:output], logger)
|
178
178
|
end
|
179
179
|
end
|
180
180
|
end
|
@@ -228,8 +228,8 @@ describe JSON::LD::API do
|
|
228
228
|
},
|
229
229
|
}.each do |title, params|
|
230
230
|
it title do
|
231
|
-
jld = JSON::LD::API.expand(params[:input],
|
232
|
-
expect(jld).to produce(params[:output],
|
231
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
232
|
+
expect(jld).to produce(params[:output], logger)
|
233
233
|
end
|
234
234
|
end
|
235
235
|
end
|
@@ -256,8 +256,8 @@ describe JSON::LD::API do
|
|
256
256
|
},
|
257
257
|
}.each do |title, params|
|
258
258
|
it title do
|
259
|
-
jld = JSON::LD::API.expand(params[:input],
|
260
|
-
expect(jld).to produce(params[:output],
|
259
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
260
|
+
expect(jld).to produce(params[:output], logger)
|
261
261
|
end
|
262
262
|
end
|
263
263
|
end
|
@@ -300,8 +300,8 @@ describe JSON::LD::API do
|
|
300
300
|
}
|
301
301
|
}.each do |title, params|
|
302
302
|
it title do
|
303
|
-
jld = JSON::LD::API.expand(params[:input],
|
304
|
-
expect(jld).to produce(params[:output],
|
303
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
304
|
+
expect(jld).to produce(params[:output], logger)
|
305
305
|
end
|
306
306
|
end
|
307
307
|
end
|
@@ -328,8 +328,8 @@ describe JSON::LD::API do
|
|
328
328
|
},
|
329
329
|
}.each do |title, params|
|
330
330
|
it title do
|
331
|
-
jld = JSON::LD::API.expand(params[:input],
|
332
|
-
expect(jld).to produce(params[:output],
|
331
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
332
|
+
expect(jld).to produce(params[:output], logger)
|
333
333
|
end
|
334
334
|
end
|
335
335
|
end
|
@@ -396,8 +396,8 @@ describe JSON::LD::API do
|
|
396
396
|
it title do
|
397
397
|
jld = JSON::LD::API.expand(params[:input],
|
398
398
|
base: "http://foo/bar/",
|
399
|
-
|
400
|
-
expect(jld).to produce(params[:output],
|
399
|
+
logger: logger)
|
400
|
+
expect(jld).to produce(params[:output], logger)
|
401
401
|
end
|
402
402
|
end
|
403
403
|
end
|
@@ -451,8 +451,8 @@ describe JSON::LD::API do
|
|
451
451
|
]}
|
452
452
|
}.each do |title, params|
|
453
453
|
it title do
|
454
|
-
jld = JSON::LD::API.expand(params[:input],
|
455
|
-
expect(jld).to produce(params[:output],
|
454
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger, base: 'http://example/')
|
455
|
+
expect(jld).to produce(params[:output], logger)
|
456
456
|
end
|
457
457
|
end
|
458
458
|
end
|
@@ -530,8 +530,8 @@ describe JSON::LD::API do
|
|
530
530
|
}
|
531
531
|
}.each do |title, params|
|
532
532
|
it title do
|
533
|
-
jld = JSON::LD::API.expand(params[:input],
|
534
|
-
expect(jld).to produce(params[:output],
|
533
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
534
|
+
expect(jld).to produce(params[:output], logger)
|
535
535
|
end
|
536
536
|
end
|
537
537
|
end
|
@@ -583,8 +583,8 @@ describe JSON::LD::API do
|
|
583
583
|
},
|
584
584
|
}.each do |title, params|
|
585
585
|
it title do
|
586
|
-
jld = JSON::LD::API.expand(params[:input],
|
587
|
-
expect(jld).to produce(params[:output],
|
586
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
587
|
+
expect(jld).to produce(params[:output], logger)
|
588
588
|
end
|
589
589
|
end
|
590
590
|
end
|
@@ -651,8 +651,8 @@ describe JSON::LD::API do
|
|
651
651
|
}
|
652
652
|
}.each do |title, params|
|
653
653
|
it title do
|
654
|
-
jld = JSON::LD::API.expand(params[:input],
|
655
|
-
expect(jld).to produce(params[:output],
|
654
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
655
|
+
expect(jld).to produce(params[:output], logger)
|
656
656
|
end
|
657
657
|
end
|
658
658
|
end
|
@@ -748,8 +748,8 @@ describe JSON::LD::API do
|
|
748
748
|
},
|
749
749
|
}.each do |title, params|
|
750
750
|
it title do
|
751
|
-
jld = JSON::LD::API.expand(params[:input],
|
752
|
-
expect(jld).to produce(params[:output],
|
751
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
752
|
+
expect(jld).to produce(params[:output], logger)
|
753
753
|
end
|
754
754
|
end
|
755
755
|
end
|
@@ -783,8 +783,8 @@ describe JSON::LD::API do
|
|
783
783
|
},
|
784
784
|
}.each do |title, params|
|
785
785
|
it title do
|
786
|
-
jld = JSON::LD::API.expand(params[:input],
|
787
|
-
expect(jld).to produce(params[:output],
|
786
|
+
jld = JSON::LD::API.expand(params[:input], logger: logger)
|
787
|
+
expect(jld).to produce(params[:output], logger)
|
788
788
|
end
|
789
789
|
end
|
790
790
|
end
|
@@ -848,7 +848,7 @@ describe JSON::LD::API do
|
|
848
848
|
}
|
849
849
|
}.each do |title, params|
|
850
850
|
it title do
|
851
|
-
#JSON::LD::API.expand(params[:input],
|
851
|
+
#JSON::LD::API.expand(params[:input], logger: logger).should produce([], logger)
|
852
852
|
expect {JSON::LD::API.expand(params[:input])}.to raise_error(params[:exception])
|
853
853
|
end
|
854
854
|
end
|
data/spec/flatten_spec.rb
CHANGED
@@ -3,7 +3,7 @@ $:.unshift "."
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe JSON::LD::API do
|
6
|
-
|
6
|
+
let(:logger) {RDF::Spec.logger}
|
7
7
|
|
8
8
|
describe ".flatten" do
|
9
9
|
{
|
@@ -213,9 +213,8 @@ describe JSON::LD::API do
|
|
213
213
|
}
|
214
214
|
}.each do |title, params|
|
215
215
|
it title do
|
216
|
-
|
217
|
-
jld
|
218
|
-
expect(jld).to produce(params[:output], @debug)
|
216
|
+
jld = JSON::LD::API.flatten(params[:input], nil, (params[:options] || {}).merge(logger: logger))
|
217
|
+
expect(jld).to produce(params[:output], logger)
|
219
218
|
end
|
220
219
|
end
|
221
220
|
end
|
data/spec/format_spec.rb
CHANGED
@@ -66,4 +66,47 @@ describe JSON::LD::Format do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
|
+
|
70
|
+
describe ".cli_commands" do
|
71
|
+
require 'rdf/cli'
|
72
|
+
let(:ttl) {File.expand_path("../test-files/test-1-rdf.ttl", __FILE__)}
|
73
|
+
let(:json) {File.expand_path("../test-files/test-1-input.json", __FILE__)}
|
74
|
+
let(:context) {File.expand_path("../test-files/test-1-context.json", __FILE__)}
|
75
|
+
|
76
|
+
describe "#expand" do
|
77
|
+
it "expands RDF" do
|
78
|
+
expect {RDF::CLI.exec_command("expand", [ttl], format: :ttl)}.to write.to(:output)
|
79
|
+
end
|
80
|
+
it "expands JSON" do
|
81
|
+
expect {RDF::CLI.exec_command("expand", [json], format: :jsonld)}.to write.to(:output)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "#compact" do
|
86
|
+
it "compacts RDF" do
|
87
|
+
expect {RDF::CLI.exec_command("compact", [ttl], context: context, format: :ttl)}.to write.to(:output)
|
88
|
+
end
|
89
|
+
it "compacts JSON" do
|
90
|
+
expect {RDF::CLI.exec_command("compact", [json], context: context, format: :jsonld)}.to write.to(:output)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe "#flatten" do
|
95
|
+
it "flattens RDF" do
|
96
|
+
expect {RDF::CLI.exec_command("flatten", [ttl], context: context, format: :ttl)}.to write.to(:output)
|
97
|
+
end
|
98
|
+
it "flattens JSON" do
|
99
|
+
expect {RDF::CLI.exec_command("flatten", [json], context: context, format: :jsonld)}.to write.to(:output)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "#frame" do
|
104
|
+
it "frames RDF" do
|
105
|
+
expect {RDF::CLI.exec_command("frame", [ttl], frame: context, format: :ttl)}.to write.to(:output)
|
106
|
+
end
|
107
|
+
it "frames JSON" do
|
108
|
+
expect {RDF::CLI.exec_command("frame", [json], frame: context, format: :jsonld)}.to write.to(:output)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
69
112
|
end
|
data/spec/frame_spec.rb
CHANGED
@@ -3,7 +3,7 @@ $:.unshift "."
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe JSON::LD::API do
|
6
|
-
|
6
|
+
let(:logger) {RDF::Spec.logger}
|
7
7
|
|
8
8
|
describe ".frame" do
|
9
9
|
{
|
@@ -501,13 +501,12 @@ describe JSON::LD::API do
|
|
501
501
|
}
|
502
502
|
}.each do |title, params|
|
503
503
|
it title do
|
504
|
-
@debug = []
|
505
504
|
begin
|
506
|
-
jld = JSON::LD::API.frame(params[:input], params[:frame],
|
507
|
-
expect(jld).to produce(params[:output],
|
505
|
+
jld = JSON::LD::API.frame(params[:input], params[:frame], logger: logger)
|
506
|
+
expect(jld).to produce(params[:output], logger)
|
508
507
|
rescue JSON::LD::JsonLdError, JSON::LD::JsonLdError, JSON::LD::InvalidFrame => e
|
509
508
|
fail("#{e.class}: #{e.message}\n" +
|
510
|
-
"#{
|
509
|
+
"#{logger}\n" +
|
511
510
|
"Backtrace:\n#{e.backtrace.join("\n")}")
|
512
511
|
end
|
513
512
|
end
|
@@ -553,13 +552,12 @@ describe JSON::LD::API do
|
|
553
552
|
},
|
554
553
|
}.each do |title, params|
|
555
554
|
it title do
|
556
|
-
@debug = []
|
557
555
|
begin
|
558
|
-
jld = JSON::LD::API.frame(params[:input], params[:frame],
|
559
|
-
expect(jld).to produce(params[:output],
|
556
|
+
jld = JSON::LD::API.frame(params[:input], params[:frame], logger: logger)
|
557
|
+
expect(jld).to produce(params[:output], logger)
|
560
558
|
rescue JSON::LD::JsonLdError, JSON::LD::JsonLdError, JSON::LD::InvalidFrame => e
|
561
559
|
fail("#{e.class}: #{e.message}\n" +
|
562
|
-
"#{
|
560
|
+
"#{logger}\n" +
|
563
561
|
"Backtrace:\n#{e.backtrace.join("\n")}")
|
564
562
|
end
|
565
563
|
end
|
data/spec/from_rdf_spec.rb
CHANGED
@@ -4,6 +4,8 @@ require 'spec_helper'
|
|
4
4
|
require 'rdf/spec/writer'
|
5
5
|
|
6
6
|
describe JSON::LD::API do
|
7
|
+
let(:logger) {RDF::Spec.logger}
|
8
|
+
|
7
9
|
describe ".fromRdf" do
|
8
10
|
context "simple tests" do
|
9
11
|
it "One subject IRI object" do
|
@@ -13,7 +15,7 @@ describe JSON::LD::API do
|
|
13
15
|
'@id' => "http://a/b",
|
14
16
|
"http://a/c" => [{"@id" => "http://a/d"}]
|
15
17
|
}
|
16
|
-
],
|
18
|
+
], logger)
|
17
19
|
end
|
18
20
|
|
19
21
|
it "should generate object list" do
|
@@ -26,7 +28,7 @@ describe JSON::LD::API do
|
|
26
28
|
{"@id" => "http://example.com/e"}
|
27
29
|
]
|
28
30
|
}
|
29
|
-
],
|
31
|
+
], logger)
|
30
32
|
end
|
31
33
|
|
32
34
|
it "should generate property list" do
|
@@ -37,7 +39,7 @@ describe JSON::LD::API do
|
|
37
39
|
"http://example.com/c" => [{"@id" => "http://example.com/d"}],
|
38
40
|
"http://example.com/e" => [{"@id" => "http://example.com/f"}]
|
39
41
|
}
|
40
|
-
],
|
42
|
+
], logger)
|
41
43
|
end
|
42
44
|
|
43
45
|
it "serializes multiple subjects" do
|
@@ -51,7 +53,7 @@ describe JSON::LD::API do
|
|
51
53
|
to produce([
|
52
54
|
{'@id' => "test-cases/0001", '@type' => ["http://www.w3.org/2006/03/test-description#TestCase"]},
|
53
55
|
{'@id' => "test-cases/0002", '@type' => ["http://www.w3.org/2006/03/test-description#TestCase"]},
|
54
|
-
],
|
56
|
+
], logger)
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
@@ -64,7 +66,7 @@ describe JSON::LD::API do
|
|
64
66
|
'@id' => "http://example.com/a",
|
65
67
|
"http://example.com/b" => [{"@value" => "foo", "@type" => "http://example.com/d"}]
|
66
68
|
}
|
67
|
-
],
|
69
|
+
], logger)
|
68
70
|
end
|
69
71
|
|
70
72
|
it "integer" do
|
@@ -72,7 +74,7 @@ describe JSON::LD::API do
|
|
72
74
|
expect(serialize(input, useNativeTypes: true)).to produce([{
|
73
75
|
'@id' => "http://example.com/a",
|
74
76
|
"http://example.com/b" => [{"@value" => 1}]
|
75
|
-
}],
|
77
|
+
}], logger)
|
76
78
|
end
|
77
79
|
|
78
80
|
it "integer (non-native)" do
|
@@ -80,7 +82,7 @@ describe JSON::LD::API do
|
|
80
82
|
expect(serialize(input, useNativeTypes: false)).to produce([{
|
81
83
|
'@id' => "http://example.com/a",
|
82
84
|
"http://example.com/b" => [{"@value" => "1","@type" => "http://www.w3.org/2001/XMLSchema#integer"}]
|
83
|
-
}],
|
85
|
+
}], logger)
|
84
86
|
end
|
85
87
|
|
86
88
|
it "boolean" do
|
@@ -88,7 +90,7 @@ describe JSON::LD::API do
|
|
88
90
|
expect(serialize(input, useNativeTypes: true)).to produce([{
|
89
91
|
'@id' => "http://example.com/a",
|
90
92
|
"http://example.com/b" => [{"@value" => true}]
|
91
|
-
}],
|
93
|
+
}], logger)
|
92
94
|
end
|
93
95
|
|
94
96
|
it "boolean (non-native)" do
|
@@ -96,7 +98,7 @@ describe JSON::LD::API do
|
|
96
98
|
expect(serialize(input, useNativeTypes: false)).to produce([{
|
97
99
|
'@id' => "http://example.com/a",
|
98
100
|
"http://example.com/b" => [{"@value" => "true","@type" => "http://www.w3.org/2001/XMLSchema#boolean"}]
|
99
|
-
}],
|
101
|
+
}], logger)
|
100
102
|
end
|
101
103
|
|
102
104
|
it "decmal" do
|
@@ -104,7 +106,7 @@ describe JSON::LD::API do
|
|
104
106
|
expect(serialize(input, useNativeTypes: true)).to produce([{
|
105
107
|
'@id' => "http://example.com/a",
|
106
108
|
"http://example.com/b" => [{"@value" => "1.0", "@type" => "http://www.w3.org/2001/XMLSchema#decimal"}]
|
107
|
-
}],
|
109
|
+
}], logger)
|
108
110
|
end
|
109
111
|
|
110
112
|
it "double" do
|
@@ -112,7 +114,7 @@ describe JSON::LD::API do
|
|
112
114
|
expect(serialize(input, useNativeTypes: true)).to produce([{
|
113
115
|
'@id' => "http://example.com/a",
|
114
116
|
"http://example.com/b" => [{"@value" => 1.0E0}]
|
115
|
-
}],
|
117
|
+
}], logger)
|
116
118
|
end
|
117
119
|
|
118
120
|
it "double (non-native)" do
|
@@ -120,7 +122,7 @@ describe JSON::LD::API do
|
|
120
122
|
expect(serialize(input, useNativeTypes: false)).to produce([{
|
121
123
|
'@id' => "http://example.com/a",
|
122
124
|
"http://example.com/b" => [{"@value" => "1.0E0","@type" => "http://www.w3.org/2001/XMLSchema#double"}]
|
123
|
-
}],
|
125
|
+
}], logger)
|
124
126
|
end
|
125
127
|
end
|
126
128
|
|
@@ -142,7 +144,7 @@ describe JSON::LD::API do
|
|
142
144
|
expect(serialize(input, useNativeTypes: false)).to produce([{
|
143
145
|
'@id' => "http://example.com/a",
|
144
146
|
"http://example.com/b" => [{"@value" => "#{v}","@type" => "http://www.w3.org/2001/XMLSchema##{t}"}]
|
145
|
-
}],
|
147
|
+
}], logger)
|
146
148
|
end
|
147
149
|
end
|
148
150
|
end
|
@@ -152,7 +154,7 @@ describe JSON::LD::API do
|
|
152
154
|
expect(serialize(input)).to produce([{
|
153
155
|
'@id' => "http://example.com/a",
|
154
156
|
"http://example.com/b" => [{"@value" => "foo", "@language" => "en-us"}]
|
155
|
-
}],
|
157
|
+
}], logger)
|
156
158
|
end
|
157
159
|
end
|
158
160
|
|
@@ -164,7 +166,7 @@ describe JSON::LD::API do
|
|
164
166
|
"@id" => "_:a",
|
165
167
|
"http://example.com/a" => [{"@id" => "http://example.com/b"}]
|
166
168
|
}
|
167
|
-
],
|
169
|
+
], logger)
|
168
170
|
end
|
169
171
|
|
170
172
|
it "should generate anon as object" do
|
@@ -178,7 +180,7 @@ describe JSON::LD::API do
|
|
178
180
|
"@id" => "http://example.com/a",
|
179
181
|
"http://example.com/b" => [{"@id" => "_:a"}]
|
180
182
|
}
|
181
|
-
],
|
183
|
+
], logger)
|
182
184
|
end
|
183
185
|
end
|
184
186
|
|
@@ -274,7 +276,7 @@ describe JSON::LD::API do
|
|
274
276
|
}.each do |name, (input, output, reader)|
|
275
277
|
it name do
|
276
278
|
r = serialize(input, reader: reader)
|
277
|
-
expect(r).to produce(output,
|
279
|
+
expect(r).to produce(output, logger)
|
278
280
|
end
|
279
281
|
end
|
280
282
|
end
|
@@ -368,7 +370,7 @@ describe JSON::LD::API do
|
|
368
370
|
}.each_pair do |name, properties|
|
369
371
|
it name do
|
370
372
|
r = serialize(properties[:input], reader: RDF::NQuads::Reader)
|
371
|
-
expect(r).to produce(properties[:output],
|
373
|
+
expect(r).to produce(properties[:output], logger)
|
372
374
|
end
|
373
375
|
end
|
374
376
|
end
|
@@ -391,7 +393,7 @@ describe JSON::LD::API do
|
|
391
393
|
],
|
392
394
|
}.each do |t, (input, output)|
|
393
395
|
it "#{t}" do
|
394
|
-
expect(serialize(input)).to produce(output,
|
396
|
+
expect(serialize(input)).to produce(output, logger)
|
395
397
|
end
|
396
398
|
end
|
397
399
|
end
|
@@ -399,16 +401,15 @@ describe JSON::LD::API do
|
|
399
401
|
|
400
402
|
def parse(input, options = {})
|
401
403
|
reader = options[:reader] || RDF::TriG::Reader
|
402
|
-
|
404
|
+
reader.new(input, options, &:each_statement).to_a.extend(RDF::Enumerable)
|
403
405
|
end
|
404
406
|
|
405
407
|
# Serialize ntstr to a string and compare against regexps
|
406
408
|
def serialize(ntstr, options = {})
|
407
|
-
|
408
|
-
@debug << ntstr if ntstr.is_a?(String)
|
409
|
+
logger.info ntstr if ntstr.is_a?(String)
|
409
410
|
g = ntstr.is_a?(String) ? parse(ntstr, options) : ntstr
|
410
|
-
|
411
|
+
logger.info g.dump(:trig)
|
411
412
|
statements = g.each_statement.to_a
|
412
|
-
JSON::LD::API.fromRdf(statements, options.merge(
|
413
|
+
JSON::LD::API.fromRdf(statements, options.merge(logger: logger))
|
413
414
|
end
|
414
415
|
end
|