json-ld 3.1.3 → 3.1.8

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.
@@ -7,6 +7,8 @@ describe JSON::LD do
7
7
  m = Fixtures::SuiteTest::Manifest.open("#{Fixtures::SuiteTest::SUITE}flatten-manifest.jsonld")
8
8
  describe m.name do
9
9
  m.entries.each do |t|
10
+ t.options[:remap_bnodes] = %w(#t0045).include?(t.property('@id'))
11
+
10
12
  specify "#{t.property('@id')}: #{t.name} unordered#{' (negative test)' unless t.positiveTest?}" do
11
13
  t.options[:ordered] = false
12
14
  if %w(#t0005).include?(t.property('@id'))
@@ -16,6 +18,8 @@ describe JSON::LD do
16
18
  end
17
19
  end
18
20
 
21
+ # Skip ordered tests when remapping bnodes
22
+ next if t.options[:remap_bnodes]
19
23
  specify "#{t.property('@id')}: #{t.name} ordered#{' (negative test)' unless t.positiveTest?}" do
20
24
  t.options[:ordered] = true
21
25
  if %w(#t0005).include?(t.property('@id'))
@@ -7,13 +7,20 @@ describe JSON::LD do
7
7
  m = Fixtures::SuiteTest::Manifest.open("#{Fixtures::SuiteTest::FRAME_SUITE}frame-manifest.jsonld")
8
8
  describe m.name do
9
9
  m.entries.each do |t|
10
+ t.options[:remap_bnodes] = %w(#t0021 #tp021).include?(t.property('@id'))
11
+
10
12
  specify "#{t.property('@id')}: #{t.name} unordered#{' (negative test)' unless t.positiveTest?}" do
11
13
  t.options[:ordered] = false
12
14
  expect {t.run self}.not_to write.to(:error)
13
15
  end
14
16
 
17
+ # Skip ordered tests when remapping bnodes
18
+ next if t.options[:remap_bnodes]
15
19
  specify "#{t.property('@id')}: #{t.name} ordered#{' (negative test)' unless t.positiveTest?}" do
16
20
  t.options[:ordered] = true
21
+ if %w(#tp021).include?(t.property('@id'))
22
+ pending("changes due to blank node reordering")
23
+ end
17
24
  expect {t.run self}.not_to write.to(:error)
18
25
  end
19
26
  end
data/spec/suite_helper.rb CHANGED
@@ -6,6 +6,8 @@ module RDF::Util
6
6
  LOCAL_PATHS = {
7
7
  "https://w3c.github.io/json-ld-api/tests/" => ::File.expand_path("../json-ld-api/tests", __FILE__) + '/',
8
8
  "https://w3c.github.io/json-ld-framing/tests/" => ::File.expand_path("../json-ld-framing/tests", __FILE__) + '/',
9
+ "https://w3c.github.io/json-ld-streaming/tests/" => ::File.expand_path("../json-ld-streaming/tests", __FILE__) + '/',
10
+ "https://json-ld.github.io/json-ld-star/tests/" => ::File.expand_path("../json-ld-star/tests", __FILE__) + '/',
9
11
  "file:" => ""
10
12
  }
11
13
 
@@ -74,6 +76,8 @@ module Fixtures
74
76
  module SuiteTest
75
77
  SUITE = RDF::URI("https://w3c.github.io/json-ld-api/tests/")
76
78
  FRAME_SUITE = RDF::URI("https://w3c.github.io/json-ld-framing/tests/")
79
+ STREAM_SUITE = RDF::URI("https://w3c.github.io/json-ld-streaming/tests/")
80
+ STAR_SUITE = RDF::URI("https://json-ld.github.io/json-ld-star/tests/")
77
81
 
78
82
  class Manifest < JSON::LD::Resource
79
83
  attr_accessor :manifest_url
@@ -199,8 +203,8 @@ module Fixtures
199
203
  logger.info "frame: #{frame}" if frame_loc
200
204
 
201
205
  options = self.options
202
- unless options[:specVersion] == "json-ld-1.1"
203
- skip "not a 1.1 test"
206
+ if options[:specVersion] == "json-ld-1.0"
207
+ skip "1.0 test"
204
208
  return
205
209
  end
206
210
 
@@ -221,21 +225,21 @@ module Fixtures
221
225
  JSON::LD::API.frame(input_loc, frame_loc, logger: logger, **options)
222
226
  when "jld:FromRDFTest"
223
227
  # Use an array, to preserve input order
224
- repo = RDF::NQuads::Reader.open(input_loc) do |reader|
228
+ repo = RDF::NQuads::Reader.open(input_loc, rdfstar: options[:rdfstar]) do |reader|
225
229
  reader.each_statement.to_a
226
230
  end.to_a.uniq.extend(RDF::Enumerable)
227
231
  logger.info "repo: #{repo.dump(self.id == '#t0012' ? :nquads : :trig)}"
228
232
  JSON::LD::API.fromRdf(repo, logger: logger, **options)
229
233
  when "jld:ToRDFTest"
230
234
  repo = RDF::Repository.new
231
- JSON::LD::API.toRdf(input_loc, logger: logger, **options) do |statement|
232
- # To properly compare values of rdf:language and i18n datatypes, normalize to lower case
233
- if statement.predicate == RDF.to_uri + 'language'
234
- statement.object = RDF::Literal(statement.object.to_s.downcase) if statement.object.literal?
235
- elsif statement.object.literal? && statement.object.datatype.to_s.start_with?('https://www.w3.org/ns/i18n#')
236
- statement.object.datatype = RDF::URI(statement.object.datatype.to_s.downcase)
235
+ if manifest_url.to_s.include?('stream')
236
+ JSON::LD::Reader.open(input_loc, stream: true, logger: logger, **options) do |statement|
237
+ repo << statement
238
+ end
239
+ else
240
+ JSON::LD::API.toRdf(input_loc, rename_bnodes: false, logger: logger, **options) do |statement|
241
+ repo << statement
237
242
  end
238
- repo << statement
239
243
  end
240
244
  logger.info "nq: #{repo.map(&:to_nquads)}"
241
245
  repo
@@ -254,12 +258,16 @@ module Fixtures
254
258
  end
255
259
  if evaluationTest?
256
260
  if testType == "jld:ToRDFTest"
257
- expected = RDF::Repository.new << RDF::NQuads::Reader.new(expect, logger: [])
261
+ expected = RDF::Repository.new << RDF::NQuads::Reader.new(expect, rdfstar: options[:rdfstar], logger: [])
258
262
  rspec_example.instance_eval {
259
263
  expect(result).to be_equivalent_graph(expected, logger)
260
264
  }
261
265
  else
262
266
  expected = JSON.load(expect)
267
+
268
+ # If called for, remap bnodes
269
+ result = remap_bnodes(result, expected) if options[:remap_bnodes]
270
+
263
271
  if options[:ordered]
264
272
  # Compare without transformation
265
273
  rspec_example.instance_eval {
@@ -306,7 +314,7 @@ module Fixtures
306
314
  when "jld:FrameTest"
307
315
  JSON::LD::API.frame(t.input_loc, t.frame_loc, logger: logger, **options)
308
316
  when "jld:FromRDFTest"
309
- repo = RDF::Repository.load(t.input_loc)
317
+ repo = RDF::Repository.load(t.input_loc, rdfstar: options[:rdfstar])
310
318
  logger.info "repo: #{repo.dump(t.id == '#t0012' ? :nquads : :trig)}"
311
319
  JSON::LD::API.fromRdf(repo, logger: logger, **options)
312
320
  when "jld:HttpTest"
@@ -320,7 +328,11 @@ module Fixtures
320
328
  raise "Expected status #{t.property('expectErrorCode')}, not #{last_response.status}"
321
329
  end
322
330
  when "jld:ToRDFTest"
323
- JSON::LD::API.toRdf(t.input_loc, logger: logger, **options) {}
331
+ if t.manifest_url.to_s.include?('stream')
332
+ JSON::LD::Reader.open(t.input_loc, stream: true, logger: logger, **options).each_statement {}
333
+ else
334
+ JSON::LD::API.toRdf(t.input_loc, rename_bnodes: false, logger: logger, **options) {}
335
+ end
324
336
  else
325
337
  success("Unknown test type: #{testType}")
326
338
  end
@@ -9,6 +9,7 @@ describe JSON::LD do
9
9
  m.entries.each do |t|
10
10
  specify "#{t.property('@id')}: #{t.name}#{' (negative test)' unless t.positiveTest?}" do
11
11
  pending "Generalized RDF" if t.options[:produceGeneralizedRdf]
12
+ pending "RDF*" if t.property('@id') == '#te122'
12
13
  if %w(#t0118).include?(t.property('@id'))
13
14
  expect {t.run self}.to write(/Statement .* is invalid/).to(:error)
14
15
  elsif %w(#te075).include?(t.property('@id'))
data/spec/to_rdf_spec.rb CHANGED
@@ -1175,6 +1175,212 @@ describe JSON::LD::API do
1175
1175
  end
1176
1176
  end
1177
1177
 
1178
+ context "JSON-LD*" do
1179
+ {
1180
+ "node with embedded subject without rdfstar option": {
1181
+ input: %({
1182
+ "@id": {
1183
+ "@id": "ex:rei",
1184
+ "ex:prop": "value"
1185
+ },
1186
+ "ex:prop": "value2"
1187
+ }),
1188
+ exception: JSON::LD::JsonLdError::InvalidIdValue
1189
+ },
1190
+ }.each do |title, params|
1191
+ it(title) {run_to_rdf params}
1192
+ end
1193
+
1194
+ {
1195
+ "node with embedded subject having no @id": {
1196
+ input: %({
1197
+ "@id": {
1198
+ "ex:prop": "value"
1199
+ },
1200
+ "ex:prop": "value2"
1201
+ }),
1202
+ expected: %(
1203
+ <<_:b0 <ex:prop> "value">> <ex:prop> "value2" .
1204
+ ),
1205
+ },
1206
+ "node with embedded subject having IRI @id": {
1207
+ input: %({
1208
+ "@id": {
1209
+ "@id": "ex:rei",
1210
+ "ex:prop": "value"
1211
+ },
1212
+ "ex:prop": "value2"
1213
+ }),
1214
+ expected: %(
1215
+ <<<ex:rei> <ex:prop> "value">> <ex:prop> "value2" .
1216
+ ),
1217
+ },
1218
+ "node with embedded subject having BNode @id": {
1219
+ input: %({
1220
+ "@id": {
1221
+ "@id": "_:rei",
1222
+ "ex:prop": "value"
1223
+ },
1224
+ "ex:prop": "value2"
1225
+ }),
1226
+ expected: %(
1227
+ <<_:b0 <ex:prop> "value">> <ex:prop> "value2" .
1228
+ ),
1229
+ },
1230
+ "node with embedded subject having a type": {
1231
+ input: %({
1232
+ "@id": {
1233
+ "@id": "ex:rei",
1234
+ "@type": "ex:Type"
1235
+ },
1236
+ "ex:prop": "value2"
1237
+ }),
1238
+ expected: %(
1239
+ <<<ex:rei> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ex:Type>>> <ex:prop> "value2" .
1240
+ ),
1241
+ },
1242
+ "node with embedded subject having an IRI value": {
1243
+ input: %({
1244
+ "@id": {
1245
+ "@id": "ex:rei",
1246
+ "ex:prop": {"@id": "ex:value"}
1247
+ },
1248
+ "ex:prop": "value2"
1249
+ }),
1250
+ expected: %(
1251
+ <<<ex:rei> <ex:prop> <ex:value>>> <ex:prop> "value2" .
1252
+ ),
1253
+ },
1254
+ "node with embedded subject having an BNode value": {
1255
+ input: %({
1256
+ "@id": {
1257
+ "@id": "ex:rei",
1258
+ "ex:prop": {"@id": "_:value"}
1259
+ },
1260
+ "ex:prop": "value2"
1261
+ }),
1262
+ expected: %(
1263
+ <<<ex:rei> <ex:prop> _:b0>> <ex:prop> "value2" .
1264
+ ),
1265
+ },
1266
+ "node with recursive embedded subject": {
1267
+ input: %({
1268
+ "@id": {
1269
+ "@id": {
1270
+ "@id": "ex:rei",
1271
+ "ex:prop": "value3"
1272
+ },
1273
+ "ex:prop": "value"
1274
+ },
1275
+ "ex:prop": "value2"
1276
+ }),
1277
+ expected: %(
1278
+ <<<<<ex:rei> <ex:prop> "value3">> <ex:prop> "value">> <ex:prop> "value2" .
1279
+ ),
1280
+ },
1281
+ "illegal node with subject having no property": {
1282
+ input: %({
1283
+ "@id": {
1284
+ "@id": "ex:rei"
1285
+ },
1286
+ "ex:prop": "value3"
1287
+ }),
1288
+ exception: JSON::LD::JsonLdError::InvalidEmbeddedNode
1289
+ },
1290
+ "illegal node with subject having multiple properties": {
1291
+ input: %({
1292
+ "@id": {
1293
+ "@id": "ex:rei",
1294
+ "ex:prop": ["value1", "value2"]
1295
+ },
1296
+ "ex:prop": "value3"
1297
+ }),
1298
+ exception: JSON::LD::JsonLdError::InvalidEmbeddedNode
1299
+ },
1300
+ "illegal node with subject having multiple types": {
1301
+ input: %({
1302
+ "@id": {
1303
+ "@id": "ex:rei",
1304
+ "@type": ["ex:Type1", "ex:Type2"]
1305
+ },
1306
+ "ex:prop": "value3"
1307
+ }),
1308
+ exception: JSON::LD::JsonLdError::InvalidEmbeddedNode
1309
+ },
1310
+ "illegal node with subject having type and property": {
1311
+ input: %({
1312
+ "@id": {
1313
+ "@id": "ex:rei",
1314
+ "@type": "ex:Type",
1315
+ "ex:prop": "value"
1316
+ },
1317
+ "ex:prop": "value2"
1318
+ }),
1319
+ exception: JSON::LD::JsonLdError::InvalidEmbeddedNode
1320
+ },
1321
+ "node with embedded object": {
1322
+ input: %({
1323
+ "@id": "ex:subj",
1324
+ "ex:value": {
1325
+ "@id": {
1326
+ "@id": "ex:rei",
1327
+ "ex:prop": "value"
1328
+ }
1329
+ }
1330
+ }),
1331
+ expected: %(
1332
+ <ex:subj> <ex:value> <<<ex:rei> <ex:prop> "value">> .
1333
+ ),
1334
+ },
1335
+ "node with embedded object having properties": {
1336
+ input: %({
1337
+ "@id": "ex:subj",
1338
+ "ex:value": {
1339
+ "@id": {
1340
+ "@id": "ex:rei",
1341
+ "ex:prop": "value"
1342
+ },
1343
+ "ex:prop": "value2"
1344
+ }
1345
+ }),
1346
+ expected: %(
1347
+ <ex:subj> <ex:value> <<<ex:rei> <ex:prop> "value">> .
1348
+ <<<ex:rei> <ex:prop> "value">> <ex:prop> "value2" .
1349
+ ),
1350
+ },
1351
+ "node with recursive embedded object": {
1352
+ input: %({
1353
+ "@id": "ex:subj",
1354
+ "ex:value": {
1355
+ "@id": {
1356
+ "@id": {
1357
+ "@id": "ex:rei",
1358
+ "ex:prop": "value3"
1359
+ },
1360
+ "ex:prop": "value"
1361
+ },
1362
+ "ex:prop": "value2"
1363
+ }
1364
+ }),
1365
+ expected: %(
1366
+ <ex:subj> <ex:value> <<<<<ex:rei> <ex:prop> "value3">> <ex:prop> "value">> .
1367
+ <<<<<ex:rei> <ex:prop> "value3">> <ex:prop> "value">> <ex:prop> "value2" .
1368
+ ),
1369
+ },
1370
+ }.each do |title, params|
1371
+ context(title) do
1372
+ it "Generates statements" do
1373
+ output_graph = RDF::Graph.new {|g| g << RDF::NTriples::Reader.new(params[:expected], rdfstar: true)}
1374
+ run_to_rdf params.merge(rdfstar: true, output: output_graph)
1375
+ end if params[:expected]
1376
+
1377
+ it "Exception" do
1378
+ run_to_rdf params.merge(rdfstar: true)
1379
+ end if params[:exception]
1380
+ end
1381
+ end
1382
+ end
1383
+
1178
1384
  context "exceptions" do
1179
1385
  {
1180
1386
  "Invalid subject" => {
@@ -1322,7 +1528,7 @@ describe JSON::LD::API do
1322
1528
  def parse(input, **options)
1323
1529
  graph = options[:graph] || RDF::Graph.new
1324
1530
  options = {logger: logger, validate: true, canonicalize: false}.merge(options)
1325
- JSON::LD::API.toRdf(StringIO.new(input), **options) {|st| graph << st}
1531
+ JSON::LD::API.toRdf(StringIO.new(input), rename_bnodes: false, **options) {|st| graph << st}
1326
1532
  graph
1327
1533
  end
1328
1534
 
@@ -1335,9 +1541,9 @@ describe JSON::LD::API do
1335
1541
  expect {JSON::LD::API.toRdf(input, **params)}.to raise_error(params[:exception])
1336
1542
  else
1337
1543
  if params[:write]
1338
- expect{JSON::LD::API.toRdf(input, base: params[:base], logger: logger, **params) {|st| graph << st}}.to write(params[:write]).to(:error)
1544
+ expect{JSON::LD::API.toRdf(input, base: params[:base], logger: logger, rename_bnodes: false, **params) {|st| graph << st}}.to write(params[:write]).to(:error)
1339
1545
  else
1340
- expect{JSON::LD::API.toRdf(input, base: params[:base], logger: logger, **params) {|st| graph << st}}.not_to write.to(:error)
1546
+ expect{JSON::LD::API.toRdf(input, base: params[:base], logger: logger, rename_bnodes: false, **params) {|st| graph << st}}.not_to write.to(:error)
1341
1547
  end
1342
1548
  expect(graph).to be_equivalent_graph(output, logger: logger, inputDocument: input)
1343
1549
  end
data/spec/writer_spec.rb CHANGED
@@ -189,6 +189,199 @@ describe JSON::LD::Writer do
189
189
  end
190
190
  end
191
191
 
192
+ context "RDF*" do
193
+ {
194
+ "subject-iii": {
195
+ input: RDF::Statement(
196
+ RDF::Statement(
197
+ RDF::URI('http://example/s1'),
198
+ RDF::URI('http://example/p1'),
199
+ RDF::URI('http://example/o1')),
200
+ RDF::URI('http://example/p'),
201
+ RDF::URI('http://example/o')),
202
+ output: %({
203
+ "@context": {"ex": "http://example/"},
204
+ "@id": {
205
+ "@id": "ex:s1",
206
+ "ex:p1": {"@id": "ex:o1"}
207
+ },
208
+ "ex:p": {"@id": "ex:o"}
209
+ })
210
+ },
211
+ "subject-iib": {
212
+ input: RDF::Statement(
213
+ RDF::Statement(
214
+ RDF::URI('http://example/s1'),
215
+ RDF::URI('http://example/p1'),
216
+ RDF::Node.new('o1')),
217
+ RDF::URI('http://example/p'),
218
+ RDF::URI('http://example/o')),
219
+ output: %({
220
+ "@context": {"ex": "http://example/"},
221
+ "@id": {
222
+ "@id": "ex:s1",
223
+ "ex:p1": {"@id": "_:o1"}
224
+ },
225
+ "ex:p": {"@id": "ex:o"}
226
+ })
227
+ },
228
+ "subject-iil": {
229
+ input: RDF::Statement(
230
+ RDF::Statement(
231
+ RDF::URI('http://example/s1'),
232
+ RDF::URI('http://example/p1'),
233
+ RDF::Literal('o1')),
234
+ RDF::URI('http://example/p'),
235
+ RDF::URI('http://example/o')),
236
+ output: %({
237
+ "@context": {"ex": "http://example/"},
238
+ "@id": {
239
+ "@id": "ex:s1",
240
+ "ex:p1": "o1"
241
+ },
242
+ "ex:p": {"@id": "ex:o"}
243
+ })
244
+ },
245
+ "subject-bii": {
246
+ input: RDF::Statement(
247
+ RDF::Statement(
248
+ RDF::Node('s1'),
249
+ RDF::URI('http://example/p1'),
250
+ RDF::URI('http://example/o1')),
251
+ RDF::URI('http://example/p'),
252
+ RDF::URI('http://example/o')),
253
+ output: %({
254
+ "@context": {"ex": "http://example/"},
255
+ "@id": {
256
+ "@id": "_:s1",
257
+ "ex:p1": {"@id": "ex:o1"}
258
+ },
259
+ "ex:p": {"@id": "ex:o"}
260
+ })
261
+ },
262
+ "subject-bib": {
263
+ input: RDF::Statement(
264
+ RDF::Statement(
265
+ RDF::Node('s1'),
266
+ RDF::URI('http://example/p1'),
267
+ RDF::Node.new('o1')),
268
+ RDF::URI('http://example/p'), RDF::URI('http://example/o')),
269
+ output: %({
270
+ "@context": {"ex": "http://example/"},
271
+ "@id": {
272
+ "@id": "_:s1",
273
+ "ex:p1": {"@id": "_:o1"}
274
+ },
275
+ "ex:p": {"@id": "ex:o"}
276
+ })
277
+ },
278
+ "subject-bil": {
279
+ input: RDF::Statement(
280
+ RDF::Statement(
281
+ RDF::Node('s1'),
282
+ RDF::URI('http://example/p1'),
283
+ RDF::Literal('o1')),
284
+ RDF::URI('http://example/p'),
285
+ RDF::URI('http://example/o')),
286
+ output: %({
287
+ "@context": {"ex": "http://example/"},
288
+ "@id": {
289
+ "@id": "_:s1",
290
+ "ex:p1": "o1"
291
+ },
292
+ "ex:p": {"@id": "ex:o"}
293
+ })
294
+ },
295
+ "object-iii": {
296
+ input: RDF::Statement(
297
+ RDF::URI('http://example/s'),
298
+ RDF::URI('http://example/p'),
299
+ RDF::Statement(
300
+ RDF::URI('http://example/s1'),
301
+ RDF::URI('http://example/p1'),
302
+ RDF::URI('http://example/o1'))),
303
+ output: %({
304
+ "@context": {"ex": "http://example/"},
305
+ "@id": "ex:s",
306
+ "ex:p": {
307
+ "@id": {
308
+ "@id": "ex:s1",
309
+ "ex:p1": {"@id": "ex:o1"}
310
+ }
311
+ }
312
+ })
313
+ },
314
+ "object-iib": {
315
+ input: RDF::Statement(
316
+ RDF::URI('http://example/s'),
317
+ RDF::URI('http://example/p'),
318
+ RDF::Statement(
319
+ RDF::URI('http://example/s1'),
320
+ RDF::URI('http://example/p1'),
321
+ RDF::Node.new('o1'))),
322
+ output: %({
323
+ "@context": {"ex": "http://example/"},
324
+ "@id": "ex:s",
325
+ "ex:p": {
326
+ "@id": {
327
+ "@id": "ex:s1",
328
+ "ex:p1": {"@id": "_:o1"}
329
+ }
330
+ }
331
+ })
332
+ },
333
+ "object-iil": {
334
+ input: RDF::Statement(
335
+ RDF::URI('http://example/s'),
336
+ RDF::URI('http://example/p'),
337
+ RDF::Statement(
338
+ RDF::URI('http://example/s1'),
339
+ RDF::URI('http://example/p1'),
340
+ RDF::Literal('o1'))),
341
+ output: %({
342
+ "@context": {"ex": "http://example/"},
343
+ "@id": "ex:s",
344
+ "ex:p": {
345
+ "@id": {
346
+ "@id": "ex:s1",
347
+ "ex:p1": "o1"
348
+ }
349
+ }
350
+ })
351
+ },
352
+ "recursive-subject": {
353
+ input: RDF::Statement(
354
+ RDF::Statement(
355
+ RDF::Statement(
356
+ RDF::URI('http://example/s2'),
357
+ RDF::URI('http://example/p2'),
358
+ RDF::URI('http://example/o2')),
359
+ RDF::URI('http://example/p1'),
360
+ RDF::URI('http://example/o1')),
361
+ RDF::URI('http://example/p'),
362
+ RDF::URI('http://example/o')),
363
+ output: %({
364
+ "@context": {"ex": "http://example/"},
365
+ "@id": {
366
+ "@id": {
367
+ "@id": "ex:s2",
368
+ "ex:p2": {"@id": "ex:o2"}
369
+ },
370
+ "ex:p1": {"@id": "ex:o1"}
371
+ },
372
+ "ex:p": {"@id": "ex:o"}
373
+ })
374
+ },
375
+ }.each do |name, params|
376
+ it name do
377
+ graph = RDF::Graph.new {|g| g << params[:input]}
378
+ expect(
379
+ serialize(graph, rdfstar: true, prefixes: {ex: 'http://example/'})
380
+ ).to produce_jsonld(JSON.parse(params[:output]), logger)
381
+ end
382
+ end
383
+ end
384
+
192
385
  context "Writes fromRdf tests to isomorphic graph" do
193
386
  require 'suite_helper'
194
387
  m = Fixtures::SuiteTest::Manifest.open("#{Fixtures::SuiteTest::SUITE}fromRdf-manifest.jsonld")