json-ld 1.0.1.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- data/README.md +2 -2
- data/VERSION +1 -1
- data/lib/json/ld/api.rb +8 -5
- data/lib/json/ld/compact.rb +2 -1
- data/lib/json/ld/context.rb +44 -33
- data/lib/json/ld/expand.rb +1 -1
- data/lib/json/ld/flatten.rb +9 -11
- data/lib/json/ld/from_rdf.rb +48 -45
- data/lib/json/ld/reader.rb +5 -0
- data/lib/json/ld/to_rdf.rb +5 -23
- data/lib/json/ld/utils.rb +9 -2
- data/spec/api_spec.rb +1 -1
- data/spec/compact_spec.rb +1 -2
- data/spec/flatten_spec.rb +3 -20
- data/spec/from_rdf_spec.rb +16 -29
- data/spec/matchers.rb +3 -3
- data/spec/reader_spec.rb +4 -4
- data/spec/suite_compact_spec.rb +0 -4
- data/spec/suite_to_rdf_spec.rb +2 -2
- data/spec/test-files/test-1-rdf.ttl +3 -3
- data/spec/test-files/test-3-rdf.ttl +1 -1
- data/spec/test-files/test-5-rdf.ttl +2 -2
- data/spec/test-files/test-6-rdf.ttl +2 -2
- data/spec/test-files/test-7-rdf.ttl +6 -6
- data/spec/to_rdf_spec.rb +32 -18
- data/spec/writer_spec.rb +0 -2
- metadata +33 -33
@@ -2,13 +2,13 @@
|
|
2
2
|
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
3
3
|
|
4
4
|
[ a foaf:Person;
|
5
|
-
foaf:homepage "http://example.com/manu/"
|
6
|
-
foaf:name "Manu"
|
5
|
+
foaf:homepage "http://example.com/manu/";
|
6
|
+
foaf:name "Manu"] .
|
7
7
|
|
8
8
|
[ a foaf:Person;
|
9
|
-
foaf:homepage "http://example.com/eve/"
|
10
|
-
foaf:name "Eve"
|
9
|
+
foaf:homepage "http://example.com/eve/";
|
10
|
+
foaf:name "Eve"] .
|
11
11
|
|
12
12
|
[ a foaf:Person;
|
13
|
-
foaf:homepage "http://example.com/bob/"
|
14
|
-
foaf:name "Bob"
|
13
|
+
foaf:homepage "http://example.com/bob/";
|
14
|
+
foaf:name "Bob"] .
|
data/spec/to_rdf_spec.rb
CHANGED
@@ -24,7 +24,7 @@ describe JSON::LD::API do
|
|
24
24
|
}.each do |title, (js, ttl)|
|
25
25
|
it title do
|
26
26
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
27
|
-
parse(js).
|
27
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -41,7 +41,7 @@ describe JSON::LD::API do
|
|
41
41
|
}.each do |title, (js, ttl)|
|
42
42
|
it title do
|
43
43
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
44
|
-
parse(js).
|
44
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -71,7 +71,7 @@ describe JSON::LD::API do
|
|
71
71
|
}.each do |title, (js, ttl)|
|
72
72
|
it title do
|
73
73
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
74
|
-
parse(js, :base => "http://example.org/").
|
74
|
+
expect(parse(js, :base => "http://example.org/")).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -100,7 +100,7 @@ describe JSON::LD::API do
|
|
100
100
|
}.each do |title, (js, ttl)|
|
101
101
|
it title do
|
102
102
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
103
|
-
parse(js).
|
103
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
@@ -134,7 +134,7 @@ describe JSON::LD::API do
|
|
134
134
|
}.each do |title, (js, ttl)|
|
135
135
|
it title do
|
136
136
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
137
|
-
parse(js).
|
137
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
@@ -183,7 +183,7 @@ describe JSON::LD::API do
|
|
183
183
|
}.each do |title, (js, ttl)|
|
184
184
|
it title do
|
185
185
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
186
|
-
parse(js).
|
186
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
187
187
|
end
|
188
188
|
end
|
189
189
|
end
|
@@ -205,12 +205,12 @@ describe JSON::LD::API do
|
|
205
205
|
}.each_pair do |title, (js, ttl)|
|
206
206
|
it title do
|
207
207
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
208
|
-
parse(js).
|
208
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
209
209
|
end
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
-
context "overriding keywords"
|
213
|
+
context "overriding keywords" do
|
214
214
|
{
|
215
215
|
"'url' for @id, 'a' for @type" => [
|
216
216
|
%q({
|
@@ -227,7 +227,7 @@ describe JSON::LD::API do
|
|
227
227
|
}.each do |title, (js, ttl)|
|
228
228
|
it title do
|
229
229
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
230
|
-
parse(js).
|
230
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
231
231
|
end
|
232
232
|
end
|
233
233
|
end
|
@@ -266,7 +266,7 @@ describe JSON::LD::API do
|
|
266
266
|
}.each do |title, (js, ttl)|
|
267
267
|
it title do
|
268
268
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
269
|
-
parse(js).
|
269
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
270
270
|
end
|
271
271
|
end
|
272
272
|
end
|
@@ -288,7 +288,7 @@ describe JSON::LD::API do
|
|
288
288
|
}.each do |title, (js, ttl)|
|
289
289
|
it title do
|
290
290
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
291
|
-
parse(js).
|
291
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
292
292
|
end
|
293
293
|
end
|
294
294
|
end
|
@@ -353,12 +353,12 @@ describe JSON::LD::API do
|
|
353
353
|
}.each do |title, (js, ttl)|
|
354
354
|
it title do
|
355
355
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
356
|
-
parse(js).
|
356
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
357
357
|
end
|
358
358
|
end
|
359
359
|
end
|
360
360
|
|
361
|
-
context "context"
|
361
|
+
context "context" do
|
362
362
|
{
|
363
363
|
"@id coersion" =>
|
364
364
|
[
|
@@ -476,7 +476,7 @@ describe JSON::LD::API do
|
|
476
476
|
}.each do |title, (js, ttl)|
|
477
477
|
it title do
|
478
478
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
479
|
-
parse(js).
|
479
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :base => "http://example/", :trace => @debug, :inputDocument => js)
|
480
480
|
end
|
481
481
|
end
|
482
482
|
|
@@ -529,14 +529,14 @@ describe JSON::LD::API do
|
|
529
529
|
}.each do |title, (js, ttl)|
|
530
530
|
it title do
|
531
531
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
532
|
-
parse(js).
|
532
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
533
533
|
end
|
534
534
|
end
|
535
535
|
end
|
536
536
|
end
|
537
537
|
|
538
538
|
context "lists" do
|
539
|
-
context "term def with @id + @type + @container"
|
539
|
+
context "term def with @id + @type + @container" do
|
540
540
|
{
|
541
541
|
"dt with term" => [
|
542
542
|
%q({
|
@@ -565,13 +565,27 @@ describe JSON::LD::API do
|
|
565
565
|
}.each do |title, (js, ttl)|
|
566
566
|
it title do
|
567
567
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
568
|
-
parse(js).
|
568
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
569
569
|
end
|
570
570
|
end
|
571
571
|
end
|
572
572
|
end
|
573
573
|
end
|
574
574
|
|
575
|
+
context "blank node predicates" do
|
576
|
+
subject {%q({"@id": "http://example/subj", "_:foo": "bar"})}
|
577
|
+
|
578
|
+
it "outputs statements with blank node predicates if :produceGeneralizedRDF is true" do
|
579
|
+
graph = parse(subject, :produceGeneralizedRDF => true)
|
580
|
+
expect(graph.count).to eq 1
|
581
|
+
end
|
582
|
+
|
583
|
+
it "rejects statements with blank node predicates if :produceGeneralizedRDF is false" do
|
584
|
+
graph = parse(subject, :produceGeneralizedRDF => false)
|
585
|
+
expect(graph.count).to eq 0
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
575
589
|
context "advanced features" do
|
576
590
|
{
|
577
591
|
"number syntax (decimal)" =>
|
@@ -622,7 +636,7 @@ describe JSON::LD::API do
|
|
622
636
|
}.each do |title, (js, ttl)|
|
623
637
|
it title do
|
624
638
|
ttl = "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . #{ttl}"
|
625
|
-
parse(js).
|
639
|
+
expect(parse(js)).to be_equivalent_graph(ttl, :trace => @debug, :inputDocument => js)
|
626
640
|
end
|
627
641
|
end
|
628
642
|
end
|
data/spec/writer_spec.rb
CHANGED
metadata
CHANGED
@@ -1,167 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-ld
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Kellogg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '>='
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.0.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - '>='
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.0.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '>='
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.7.5
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '>='
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.7.5
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: equivalent-xml
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - '>='
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.2.8
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - '>='
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.2.8
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: open-uri-cached
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - '>='
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.0.5
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - '>='
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.0.5
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: yard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - '>='
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.8.3
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - '>='
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.8.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - '>='
|
87
|
+
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 2.12.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - '>='
|
94
|
+
- - ! '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 2.12.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rdf-spec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - '>='
|
101
|
+
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '1.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - '>='
|
108
|
+
- - ! '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rdf-turtle
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - '>='
|
115
|
+
- - ! '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 1.0.7
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - '>='
|
122
|
+
- - ! '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 1.0.7
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rdf-trig
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - '>='
|
129
|
+
- - ! '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 1.0.1
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - '>='
|
136
|
+
- - ! '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 1.0.1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rdf-isomorphic
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - '>='
|
143
|
+
- - ! '>='
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - '>='
|
150
|
+
- - ! '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rdf-xsd
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - '>='
|
157
|
+
- - ! '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - '>='
|
164
|
+
- - ! '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
description: JSON::LD parses and serializes JSON-LD into RDF and implements expansion,
|
@@ -282,17 +282,17 @@ require_paths:
|
|
282
282
|
- lib
|
283
283
|
required_ruby_version: !ruby/object:Gem::Requirement
|
284
284
|
requirements:
|
285
|
-
- - '>='
|
285
|
+
- - ! '>='
|
286
286
|
- !ruby/object:Gem::Version
|
287
287
|
version: 1.9.3
|
288
288
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
289
289
|
requirements:
|
290
|
-
- - '>='
|
290
|
+
- - ! '>='
|
291
291
|
- !ruby/object:Gem::Version
|
292
292
|
version: '0'
|
293
293
|
requirements: []
|
294
294
|
rubyforge_project: json-ld
|
295
|
-
rubygems_version: 2.0.
|
295
|
+
rubygems_version: 2.0.5
|
296
296
|
signing_key:
|
297
297
|
specification_version: 4
|
298
298
|
summary: JSON-LD reader/writer for Ruby.
|