json-ld 2.0.0.beta2 → 2.0.0.beta3
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/VERSION +1 -1
- data/lib/json/ld/api.rb +2 -2
- data/lib/json/ld/context.rb +3 -3
- data/lib/json/ld/utils.rb +1 -1
- data/lib/json/ld/writer.rb +0 -1
- data/spec/context_spec.rb +18 -0
- data/spec/suite_to_rdf_spec.rb +0 -1
- data/spec/writer_spec.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1da92b315af019278538aaac7a28f81aa326b9d2
|
4
|
+
data.tar.gz: 6af02e670f5487b42020949408bc2e41a34acd15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89bf9f2ac0f47311225074131ea1bb83a332f53b33b44a26c37c127b883208cad59e97f292275a4ffa76be4a5da6e1147990ae48f266d4251c1f596070db81ca
|
7
|
+
data.tar.gz: ef1940a0babfabeeee80890eceb153d57dd99d5322338c431f8c4db8c1f96fb2e79d9564af6afe6ab1c02cf837899812e00a82f7fd9f70e0d394bb680e38cc19
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.
|
1
|
+
2.0.0.beta3
|
data/lib/json/ld/api.rb
CHANGED
@@ -79,7 +79,7 @@ module JSON::LD
|
|
79
79
|
# @option options [Boolean] :rename_bnodes (true)
|
80
80
|
# Rename bnodes as part of expansion, or keep them the same.
|
81
81
|
# @option options [Boolean] :unique_bnodes (false)
|
82
|
-
# Use unique bnode identifiers, defaults to using the identifier which the node was
|
82
|
+
# Use unique bnode identifiers, defaults to using the identifier which the node was originally initialized with (if any).
|
83
83
|
# @option options [Boolean] :simple_compact_iris (false)
|
84
84
|
# When compacting IRIs, do not use terms with expanded term definitions
|
85
85
|
# @option options [Symbol] :adapter used with MultiJson
|
@@ -133,7 +133,7 @@ module JSON::LD
|
|
133
133
|
context ||= (@value['@context'] if @value.is_a?(Hash)) || context_ref
|
134
134
|
@context = Context.new(@options)
|
135
135
|
@context = @context.parse(context) if context
|
136
|
-
|
136
|
+
|
137
137
|
if block_given?
|
138
138
|
case block.arity
|
139
139
|
when 0, -1 then instance_eval(&block)
|
data/lib/json/ld/context.rb
CHANGED
@@ -265,11 +265,11 @@ module JSON::LD
|
|
265
265
|
result = context.dup
|
266
266
|
when IO, StringIO
|
267
267
|
log_debug("parse") {"io: #{context}"}
|
268
|
-
# Load context document, if it is
|
268
|
+
# Load context document, if it is an open file
|
269
269
|
begin
|
270
270
|
ctx = JSON.load(context)
|
271
271
|
raise JSON::LD::JsonLdError::InvalidRemoteContext, "Context missing @context key" if @options[:validate] && ctx['@context'].nil?
|
272
|
-
result = parse(ctx["@context"] ? ctx["@context"].dup : {})
|
272
|
+
result = result.dup.parse(ctx["@context"] ? ctx["@context"].dup : {})
|
273
273
|
result.provided_context = ctx["@context"] if [context] == local_context
|
274
274
|
result
|
275
275
|
rescue JSON::ParserError => e
|
@@ -286,7 +286,7 @@ module JSON::LD
|
|
286
286
|
raise JsonLdError::RecursiveContextInclusion, "#{context}" if remote_contexts.include?(context.to_s)
|
287
287
|
remote_contexts << context.to_s
|
288
288
|
|
289
|
-
context_no_base =
|
289
|
+
context_no_base = result.dup
|
290
290
|
context_no_base.base = nil
|
291
291
|
context_no_base.context_base = context.to_s
|
292
292
|
|
data/lib/json/ld/utils.rb
CHANGED
data/lib/json/ld/writer.rb
CHANGED
@@ -130,7 +130,6 @@ module JSON::LD
|
|
130
130
|
options[:base_uri] ||= options[:base] if options.has_key?(:base)
|
131
131
|
options[:base] ||= options[:base_uri] if options.has_key?(:base_uri)
|
132
132
|
super do
|
133
|
-
log_statistics.clear # FIXME: shouldn't be necessary
|
134
133
|
@repo = RDF::Repository.new
|
135
134
|
|
136
135
|
if block_given?
|
data/spec/context_spec.rb
CHANGED
@@ -109,6 +109,24 @@ describe JSON::LD::Context do
|
|
109
109
|
"bar" => "http://example.com/foo"
|
110
110
|
}, logger)
|
111
111
|
end
|
112
|
+
|
113
|
+
it "merges definitions from remote contexts" do
|
114
|
+
expect(JSON::LD::API).to receive(:documentLoader).with("http://example.com/context", anything).and_yield(remote_doc)
|
115
|
+
rd2 = JSON::LD::API::RemoteDocument.new("http://example.com/c2", %q({
|
116
|
+
"@context": {
|
117
|
+
"title": {"@id": "http://purl.org/dc/terms/title"}
|
118
|
+
}
|
119
|
+
}))
|
120
|
+
expect(JSON::LD::API).to receive(:documentLoader).with("http://example.com/c2", anything).and_yield(rd2)
|
121
|
+
ec = subject.parse(%w(http://example.com/context http://example.com/c2))
|
122
|
+
expect(ec.send(:mappings)).to produce({
|
123
|
+
"xsd" => "http://www.w3.org/2001/XMLSchema#",
|
124
|
+
"name" => "http://xmlns.com/foaf/0.1/name",
|
125
|
+
"homepage" => "http://xmlns.com/foaf/0.1/homepage",
|
126
|
+
"avatar" => "http://xmlns.com/foaf/0.1/avatar",
|
127
|
+
"title" => "http://purl.org/dc/terms/title"
|
128
|
+
}, logger)
|
129
|
+
end
|
112
130
|
end
|
113
131
|
|
114
132
|
context "Hash" do
|
data/spec/suite_to_rdf_spec.rb
CHANGED
@@ -11,7 +11,6 @@ describe JSON::LD do
|
|
11
11
|
specify "#{t.property('input')}: #{t.name}#{' (negative test)' unless t.positiveTest?}" do
|
12
12
|
skip "Native value fidelity" if %w(toRdf-0035-in.jsonld).include?(t.property('input'))
|
13
13
|
pending "Generalized RDF" if %w(toRdf-0118-in.jsonld).include?(t.property('input'))
|
14
|
-
pending "Blank nodes with reverse properties" if %w(toRdf-0119-in.jsonld).include?(t.property('input'))
|
15
14
|
t.run self
|
16
15
|
end
|
17
16
|
end
|
data/spec/writer_spec.rb
CHANGED
@@ -201,7 +201,6 @@ describe JSON::LD::Writer do
|
|
201
201
|
logger.info "source: #{t.input}"
|
202
202
|
t.logger = logger
|
203
203
|
pending "Shared list BNode in different graphs" if t.property('input').include?("fromRdf-0021")
|
204
|
-
pending "graph comparison issue" if t.property('input').include?("fromRdf-0008")
|
205
204
|
repo = RDF::Repository.load(t.input_loc, format: :nquads)
|
206
205
|
jsonld = JSON::LD::Writer.buffer(logger: t.logger) do |writer|
|
207
206
|
writer << repo
|
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: 2.0.0.
|
4
|
+
version: 2.0.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Kellogg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|