json-ld 3.1.2 → 3.1.7

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.
@@ -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")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-ld
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-18 00:00:00.000000000 Z
11
+ date: 2020-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
@@ -324,6 +324,7 @@ files:
324
324
  - lib/json/ld/html/rexml.rb
325
325
  - lib/json/ld/reader.rb
326
326
  - lib/json/ld/resource.rb
327
+ - lib/json/ld/streaming_reader.rb
327
328
  - lib/json/ld/streaming_writer.rb
328
329
  - lib/json/ld/to_rdf.rb
329
330
  - lib/json/ld/utils.rb
@@ -342,6 +343,7 @@ files:
342
343
  - spec/reader_spec.rb
343
344
  - spec/resource_spec.rb
344
345
  - spec/spec_helper.rb
346
+ - spec/streaming_reader_spec.rb
345
347
  - spec/streaming_writer_spec.rb
346
348
  - spec/suite_compact_spec.rb
347
349
  - spec/suite_expand_spec.rb
@@ -409,7 +411,7 @@ homepage: https://github.com/ruby-rdf/json-ld
409
411
  licenses:
410
412
  - Unlicense
411
413
  metadata: {}
412
- post_install_message:
414
+ post_install_message:
413
415
  rdoc_options: []
414
416
  require_paths:
415
417
  - lib
@@ -424,8 +426,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
424
426
  - !ruby/object:Gem::Version
425
427
  version: '0'
426
428
  requirements: []
427
- rubygems_version: 3.0.6
428
- signing_key:
429
+ rubygems_version: 3.1.4
430
+ signing_key:
429
431
  specification_version: 4
430
432
  summary: JSON-LD reader/writer for Ruby.
431
433
  test_files:
@@ -455,6 +457,7 @@ test_files:
455
457
  - spec/suite_flatten_spec.rb
456
458
  - spec/compact_spec.rb
457
459
  - spec/suite_http_spec.rb
460
+ - spec/streaming_reader_spec.rb
458
461
  - spec/writer_spec.rb
459
462
  - spec/test-files/test-3-compacted.json
460
463
  - spec/test-files/test-2-rdf.ttl