json-ld 1.99.1 → 1.99.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ba81727972fdb49ae06b098ce1754bbab4fad06
4
- data.tar.gz: 084a57e8647980ce9e972ffdeefa1725d5a90edb
3
+ metadata.gz: 4c02d86fe66a58214d00b28c5542377cebcb3620
4
+ data.tar.gz: 966da6c48876b3728e89cedf867d7e9b163c53b3
5
5
  SHA512:
6
- metadata.gz: d0fb6704553d2dbfa3ef5f65e006bdbb1c3fb2192d182c43606a6a9fb620303ff45500f613d970aa2a451f6722f25be00ff3b6bf0a0c335322e1855169560661
7
- data.tar.gz: 9d0f250e54edb0f1cd2aa15e9c1282fc4cf7e87a6cc511db7afaa3cd0c73ed1b18b40debb369242ffac8205f1e41105c4b0a8794d82fda780bb8bb97b80832a1
6
+ metadata.gz: c4b28db10c7dd63d9dd5e6cafec485672ca40cf86edd6bf225534a8bae7e7feaf4804e7d979960fee280cf2528ff3547a96dc67c29abbc3ff5f67f9cf6ed7be2
7
+ data.tar.gz: 0d98b744bff6f6c2dad942e25d88c52c82d7348599ab7ba6d06b3a147be8e588884ff9ed1b62e8359069e8dd3ad37fc50512527ba779bb5a5f99aff25a132779
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.99.1
1
+ 1.99.2
@@ -78,7 +78,7 @@ module JSON::LD
78
78
  # @option options [Boolean] :rename_bnodes (true)
79
79
  # Rename bnodes as part of expansion, or keep them the same.
80
80
  # @option options [Boolean] :unique_bnodes (false)
81
- # Use unique bnode identifiers, defaults to using the identifier which the node was originall initialized with (if any).
81
+ # Use unique bnode identifiers, defaults to using the identifier which the node was originally initialized with (if any).
82
82
  # @option options [Boolean] :simple_compact_iris (false)
83
83
  # When compacting IRIs, do not use terms with expanded term definitions
84
84
  # @option options [Symbol] :adapter used with MultiJson
@@ -132,7 +132,7 @@ module JSON::LD
132
132
  context ||= (@value['@context'] if @value.is_a?(Hash)) || context_ref
133
133
  @context = Context.new(@options)
134
134
  @context = @context.parse(context) if context
135
-
135
+
136
136
  if block_given?
137
137
  case block.arity
138
138
  when 0, -1 then instance_eval(&block)
@@ -268,7 +268,7 @@ module JSON::LD
268
268
  begin
269
269
  ctx = JSON.load(context)
270
270
  raise JSON::LD::JsonLdError::InvalidRemoteContext, "Context missing @context key" if @options[:validate] && ctx['@context'].nil?
271
- result = parse(ctx["@context"] ? ctx["@context"].dup : {})
271
+ result = result.dup.parse(ctx["@context"] ? ctx["@context"].dup : {})
272
272
  result.provided_context = ctx["@context"] if [context] == local_context
273
273
  result
274
274
  rescue JSON::ParserError => e
@@ -285,7 +285,7 @@ module JSON::LD
285
285
  raise JsonLdError::RecursiveContextInclusion, "#{context}" if remote_contexts.include?(context.to_s)
286
286
  remote_contexts << context.to_s
287
287
 
288
- context_no_base = self.dup
288
+ context_no_base = result.dup
289
289
  context_no_base.base = nil
290
290
  context_no_base.context_base = context.to_s
291
291
 
@@ -70,7 +70,7 @@ module JSON::LD
70
70
  def as_resource(id, base = nil)
71
71
  @nodes ||= {} # Re-use BNodes
72
72
  if id[0,2] == '_:'
73
- (@nodes[id] ||= RDF::Node.new(id[2..-1]))
73
+ (@nodes[id] ||= RDF::Node.new(namer.get_sym(id)))
74
74
  elsif base
75
75
  base.join(id)
76
76
  else
@@ -111,6 +111,24 @@ describe JSON::LD::Context do
111
111
  "bar" => "http://example.com/foo"
112
112
  }, @debug)
113
113
  end
114
+
115
+ it "merges definitions from remote contexts" do
116
+ expect(JSON::LD::API).to receive(:documentLoader).with("http://example.com/context", anything).and_yield(remote_doc)
117
+ rd2 = JSON::LD::API::RemoteDocument.new("http://example.com/c2", %q({
118
+ "@context": {
119
+ "title": {"@id": "http://purl.org/dc/terms/title"}
120
+ }
121
+ }))
122
+ expect(JSON::LD::API).to receive(:documentLoader).with("http://example.com/c2", anything).and_yield(rd2)
123
+ ec = subject.parse(%w(http://example.com/context http://example.com/c2))
124
+ expect(ec.send(:mappings)).to produce({
125
+ "xsd" => "http://www.w3.org/2001/XMLSchema#",
126
+ "name" => "http://xmlns.com/foaf/0.1/name",
127
+ "homepage" => "http://xmlns.com/foaf/0.1/homepage",
128
+ "avatar" => "http://xmlns.com/foaf/0.1/avatar",
129
+ "title" => "http://purl.org/dc/terms/title"
130
+ }, @debug)
131
+ end
114
132
  end
115
133
 
116
134
  context "Hash" do
@@ -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
@@ -195,7 +195,6 @@ describe JSON::LD::Writer do
195
195
  t.debug = ["test: #{t.inspect}", "source: #{t.input}"]
196
196
  specify "#{t.property('input')}: #{t.name}" do
197
197
  pending "Shared list BNode in different graphs" if t.property('input').include?("fromRdf-0021")
198
- pending "graph comparison issue" if t.property('input').include?("fromRdf-0008")
199
198
  repo = RDF::Repository.load(t.input_loc, format: :nquads)
200
199
  jsonld = JSON::LD::Writer.buffer(debug: t.debug) do |writer|
201
200
  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: 1.99.1
4
+ version: 1.99.2
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-02-29 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf