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.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/VERSION +1 -1
- data/lib/json/ld.rb +3 -0
- data/lib/json/ld/api.rb +31 -24
- data/lib/json/ld/compact.rb +37 -21
- data/lib/json/ld/context.rb +532 -473
- data/lib/json/ld/expand.rb +131 -68
- data/lib/json/ld/from_rdf.rb +7 -8
- data/lib/json/ld/reader.rb +19 -10
- data/lib/json/ld/streaming_reader.rb +578 -0
- data/spec/context_spec.rb +4 -42
- data/spec/reader_spec.rb +33 -34
- data/spec/streaming_reader_spec.rb +237 -0
- data/spec/suite_helper.rb +14 -8
- metadata +6 -3
data/spec/suite_helper.rb
CHANGED
@@ -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
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
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
|
-
|
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.
|
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-
|
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.
|
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
|