json-ld 3.1.3 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,7 @@ 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__) + '/',
9
10
  "file:" => ""
10
11
  }
11
12
 
@@ -74,6 +75,7 @@ module Fixtures
74
75
  module SuiteTest
75
76
  SUITE = RDF::URI("https://w3c.github.io/json-ld-api/tests/")
76
77
  FRAME_SUITE = RDF::URI("https://w3c.github.io/json-ld-framing/tests/")
78
+ STREAM_SUITE = RDF::URI("https://w3c.github.io/json-ld-streaming/tests/")
77
79
 
78
80
  class Manifest < JSON::LD::Resource
79
81
  attr_accessor :manifest_url
@@ -228,14 +230,14 @@ module Fixtures
228
230
  JSON::LD::API.fromRdf(repo, logger: logger, **options)
229
231
  when "jld:ToRDFTest"
230
232
  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)
233
+ if manifest_url.to_s.include?('stream')
234
+ JSON::LD::Reader.open(input_loc, stream: true, logger: logger, **options) do |statement|
235
+ repo << statement
236
+ end
237
+ else
238
+ JSON::LD::API.toRdf(input_loc, logger: logger, **options) do |statement|
239
+ repo << statement
237
240
  end
238
- repo << statement
239
241
  end
240
242
  logger.info "nq: #{repo.map(&:to_nquads)}"
241
243
  repo
@@ -320,7 +322,11 @@ module Fixtures
320
322
  raise "Expected status #{t.property('expectErrorCode')}, not #{last_response.status}"
321
323
  end
322
324
  when "jld:ToRDFTest"
323
- JSON::LD::API.toRdf(t.input_loc, logger: logger, **options) {}
325
+ if t.manifest_url.to_s.include?('stream')
326
+ JSON::LD::Reader.open(t.input_loc, stream: true, logger: logger, **options).each_statement {}
327
+ else
328
+ JSON::LD::API.toRdf(t.input_loc, logger: logger, **options) {}
329
+ end
324
330
  else
325
331
  success("Unknown test type: #{testType}")
326
332
  end
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.3
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-01 00:00:00.000000000 Z
11
+ date: 2020-04-28 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
@@ -424,7 +426,7 @@ 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
429
+ rubygems_version: 3.1.2
428
430
  signing_key:
429
431
  specification_version: 4
430
432
  summary: JSON-LD reader/writer for Ruby.
@@ -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