json-ld 0.1.5.2 → 0.1.6
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.
- data/History.markdown +7 -0
- data/VERSION +1 -1
- data/lib/json/ld/api.rb +86 -7
- data/lib/json/ld/compact.rb +1 -1
- data/lib/json/ld/evaluation_context.rb +11 -26
- data/lib/json/ld/expand.rb +5 -5
- data/lib/json/ld/flatten.rb +109 -0
- data/lib/json/ld/frame.rb +52 -135
- data/lib/json/ld/from_rdf.rb +16 -17
- data/lib/json/ld/utils.rb +5 -5
- data/spec/compact_spec.rb +1 -1
- data/spec/evaluation_context_spec.rb +1 -13
- data/spec/expand_spec.rb +68 -0
- data/spec/flatten_spec.rb +180 -0
- data/spec/frame_spec.rb +107 -133
- data/spec/from_rdf_spec.rb +5 -29
- metadata +5 -2
data/spec/from_rdf_spec.rb
CHANGED
@@ -65,14 +65,6 @@ describe JSON::LD::API do
|
|
65
65
|
it "integer" do
|
66
66
|
input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1 .)
|
67
67
|
serialize(input).should produce([{
|
68
|
-
'@id' => "http://example.com/a",
|
69
|
-
"http://example.com/b" => [{"@value" => 1}]
|
70
|
-
}], @debug)
|
71
|
-
end
|
72
|
-
|
73
|
-
it "integer (non-native)" do
|
74
|
-
input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1 .)
|
75
|
-
serialize(input, :useNativeTypes => false).should produce([{
|
76
68
|
'@id' => "http://example.com/a",
|
77
69
|
"http://example.com/b" => [{"@value" => "1","@type" => "http://www.w3.org/2001/XMLSchema#integer"}]
|
78
70
|
}], @debug)
|
@@ -81,14 +73,6 @@ describe JSON::LD::API do
|
|
81
73
|
it "boolean" do
|
82
74
|
input = %(@prefix ex: <http://example.com/> . ex:a ex:b true .)
|
83
75
|
serialize(input).should produce([{
|
84
|
-
'@id' => "http://example.com/a",
|
85
|
-
"http://example.com/b" => [{"@value" => true}]
|
86
|
-
}], @debug)
|
87
|
-
end
|
88
|
-
|
89
|
-
it "boolean (non-native)" do
|
90
|
-
input = %(@prefix ex: <http://example.com/> . ex:a ex:b true .)
|
91
|
-
serialize(input, :useNativeTypes => false).should produce([{
|
92
76
|
'@id' => "http://example.com/a",
|
93
77
|
"http://example.com/b" => [{"@value" => "true","@type" => "http://www.w3.org/2001/XMLSchema#boolean"}]
|
94
78
|
}], @debug)
|
@@ -105,21 +89,13 @@ describe JSON::LD::API do
|
|
105
89
|
it "double" do
|
106
90
|
input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1.0e0 .)
|
107
91
|
serialize(input).should produce([{
|
108
|
-
'@id' => "http://example.com/a",
|
109
|
-
"http://example.com/b" => [{"@value" => 1.0E0}]
|
110
|
-
}], @debug)
|
111
|
-
end
|
112
|
-
|
113
|
-
it "double (non-native)" do
|
114
|
-
input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1.0e0 .)
|
115
|
-
serialize(input, :useNativeTypes => false).should produce([{
|
116
92
|
'@id' => "http://example.com/a",
|
117
93
|
"http://example.com/b" => [{"@value" => "1.0E0","@type" => "http://www.w3.org/2001/XMLSchema#double"}]
|
118
94
|
}], @debug)
|
119
95
|
end
|
120
96
|
end
|
121
97
|
|
122
|
-
context "datatyped
|
98
|
+
context "datatyped" do
|
123
99
|
{
|
124
100
|
:integer => 1,
|
125
101
|
:unsignedInteger => 1,
|
@@ -134,7 +110,7 @@ describe JSON::LD::API do
|
|
134
110
|
@prefix ex: <http://example.com/> .
|
135
111
|
ex:a ex:b "#{v}"^^xsd:#{t} .
|
136
112
|
)
|
137
|
-
serialize(input
|
113
|
+
serialize(input).should produce([{
|
138
114
|
'@id' => "http://example.com/a",
|
139
115
|
"http://example.com/b" => [{"@value" => "#{v}","@type" => "http://www.w3.org/2001/XMLSchema##{t}"}]
|
140
116
|
}], @debug)
|
@@ -331,10 +307,10 @@ describe JSON::LD::API do
|
|
331
307
|
end
|
332
308
|
end
|
333
309
|
|
334
|
-
context "
|
310
|
+
context "notType option" do
|
335
311
|
it "uses @type if set to false" do
|
336
312
|
input = %(@prefix ex: <http://example.com/> . ex:a a ex:b .)
|
337
|
-
serialize(input, :
|
313
|
+
serialize(input, :notType => false).should produce([{
|
338
314
|
'@id' => "http://example.com/a",
|
339
315
|
"@type" => ["http://example.com/b"]
|
340
316
|
}], @debug)
|
@@ -342,7 +318,7 @@ describe JSON::LD::API do
|
|
342
318
|
|
343
319
|
it "does not use @type if set to true" do
|
344
320
|
input = %(@prefix ex: <http://example.com/> . ex:a a ex:b .)
|
345
|
-
serialize(input, :
|
321
|
+
serialize(input, :notType => true).should produce([{
|
346
322
|
'@id' => "http://example.com/a",
|
347
323
|
RDF.type.to_s => [{"@id" => "http://example.com/b"}]
|
348
324
|
}], @debug)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-ld
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdf
|
@@ -237,6 +237,7 @@ files:
|
|
237
237
|
- lib/json/ld/evaluation_context.rb
|
238
238
|
- lib/json/ld/expand.rb
|
239
239
|
- lib/json/ld/extensions.rb
|
240
|
+
- lib/json/ld/flatten.rb
|
240
241
|
- lib/json/ld/format.rb
|
241
242
|
- lib/json/ld/frame.rb
|
242
243
|
- lib/json/ld/from_rdf.rb
|
@@ -250,6 +251,7 @@ files:
|
|
250
251
|
- spec/compact_spec.rb
|
251
252
|
- spec/evaluation_context_spec.rb
|
252
253
|
- spec/expand_spec.rb
|
254
|
+
- spec/flatten_spec.rb
|
253
255
|
- spec/format_spec.rb
|
254
256
|
- spec/frame_spec.rb
|
255
257
|
- spec/from_rdf_spec.rb
|
@@ -348,6 +350,7 @@ test_files:
|
|
348
350
|
- spec/compact_spec.rb
|
349
351
|
- spec/evaluation_context_spec.rb
|
350
352
|
- spec/expand_spec.rb
|
353
|
+
- spec/flatten_spec.rb
|
351
354
|
- spec/format_spec.rb
|
352
355
|
- spec/frame_spec.rb
|
353
356
|
- spec/from_rdf_spec.rb
|