diff --git a/Gemfile.lock b/Gemfile.lock
index 66e2de70..23a52ef7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,9 +1,10 @@
GIT
remote: git://github.com/ruby-rdf/json-ld.git
- revision: d88f81b143a602a6174b8b9da79c2fc6c04d127b
+ revision: 6f4b20de173ef27ff3959f5206b9a7cb813ecde7
branch: develop
specs:
json-ld (3.0.2)
+ json-canonicalization (~> 0.1)
link_header (~> 0.0, >= 0.0.8)
multi_json (~> 1.13)
rack (>= 1.6, < 3.0)
@@ -33,6 +34,7 @@ GEM
htmlentities (4.3.4)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
+ json-canonicalization (0.1.0)
json-ld-preloaded (3.0.2)
json-ld (~> 3.0)
multi_json (~> 1.12)
diff --git a/common/extract-examples.rb b/common/extract-examples.rb
index 152e6acc..bbb0c464 100755
--- a/common/extract-examples.rb
+++ b/common/extract-examples.rb
@@ -17,6 +17,11 @@
require 'yaml'
require 'cgi'
+# FIXME: This is here until the rdf:JSON is added in RDF.rb
+unless RDF::RDFV.properties.include?( RDF.to_uri + 'JSON')
+ RDF::RDFV.property :JSON, label: "JSON", comment: "JSON datatype"
+end
+
PREFIXES = {
dc: "http://purl.org/dc/terms/",
cred: "https://w3id.org/credentials#",
diff --git a/common/jsonld.js b/common/jsonld.js
index e53e0cf9..7bd105c7 100644
--- a/common/jsonld.js
+++ b/common/jsonld.js
@@ -18,7 +18,7 @@ const jsonld = {
},
"JCS": {
title: "JSON Canonicalization Scheme (JCS)",
- href: 'https://tools.ietf.org/html/draft-rundgren-json-canonicalization-scheme-05#page-6',
+ href: 'https://tools.ietf.org/html/draft-rundgren-json-canonicalization-scheme-05',
authors: ['A. Rundgren', 'B. Jordan', 'S. Erdtman'],
publisher: 'Network Working Group',
status: 'Internet-Draft',
diff --git a/common/terms.html b/common/terms.html
index 23f259bb..1229745a 100644
--- a/common/terms.html
+++ b/common/terms.html
@@ -338,7 +338,7 @@
JSON literal
A JSON literal is a typed literal where the associated IRI is rdf:JSON
.
In the value object representation, the value of @type
is @json
.
- JSON literals represent values which are valid [[JSON]].
+ JSON literals represent values which are valid JSON [[RFC8259]].
See JSON datatype in [[JSON-LD11]].
typed literal
diff --git a/index.html b/index.html
index 8247c6a1..7a4e115c 100644
--- a/index.html
+++ b/index.html
@@ -1247,7 +1247,7 @@ Algorithm
true
for vocab ,
local context , and defined . If the expanded type is
neither @id
, nor @vocab
,
- nor, if processing mode is json-ld-1.1
, @none
,
+ nor, if processing mode is json-ld-1.1
, @json
nor @none
,
nor an absolute IRI , an
invalid type mapping
error has been detected and processing is aborted.
@@ -1715,7 +1715,12 @@ Algorithm
Initialize an empty dictionary , result .
- For each key and value in element ,
+
+
+ Initialize an empty dictionary , nests , and
+ input type to the last value of any member expanding to @type
.
+
+ For each key and value in element ,
ordered lexicographically by key if ordered is true
:
If key is @context
, continue to
@@ -1778,7 +1783,11 @@ Algorithm
and ordered flags,
ensuring that expanded value is an array of one or more dictionaries .
- If expanded property is @value
and
+ Otherwise, if expanded property is @value
,
+ processing mode is json-ld-1.1
, and
+ input type is @json
,
+ set expanded value to value .
+ Otherwise, if
value is not a scalar or null
, an
invalid value object value
error has been detected and processing is aborted. Otherwise,
@@ -1903,7 +1912,11 @@ Algorithm
set term context to active context .
Set container mapping to key 's container mapping in
term context .
- If container mapping includes @language
and
+ If key 's term definition in active context
+ has a type mapping of @json
,
+ set expanded value to a new dictionary , set the member
+ @value
to value , and set the member @type
to @json
.
+ Otherwise, if container mapping includes @language
and
value is a dictionary then value
is expanded from a language map
as follows:
@@ -2077,7 +2090,7 @@ Algorithm
nested value expands to @value
, an
invalid @nest value error
has been detected and processing is aborted.
- Recursively repeat step 7
+ Recursively repeat step 9
using nested value for element .
@@ -2096,6 +2109,9 @@ Algorithm
error has been detected and processing is aborted.
If the value of result 's @value
member is
null
, then set result to null
.
+ Otherwise, if the result 's @type
member
+ is @json
, then the @value
member may
+ contain any value, and is treated as a JSON literal .
Otherwise, if the value of result 's @value
member
is not a string and result contains the member
@language
, an
@@ -2220,7 +2236,7 @@ Algorithm
value .
If active property has a type mapping in
active context ,
- other than @id
or @vocab
, or @none
,
+ other than @id
, @vocab
, or @none
,
add an @type
member to
result and set its value to the value associated with the
type mapping .
@@ -2372,7 +2388,10 @@ Algorithm
Value Compaction algorithm ,
passing active context , inverse context ,
active property ,and element as value is
- a scalar , return that result.
+ a scalar ,
+ or the term definition for active property
+ has a type mapping of @json
,
+ return that result.
If element is a
list object , and the container mapping for
active property in active context is @list
,
@@ -2938,7 +2957,7 @@ Algorithm
Otherwise, if term definition has a
- type mapping which is @none
:
+ type mapping which is @none
:
Reference the value associated with the @language
member in type/language map using the variable
@@ -2953,6 +2972,7 @@ Algorithm
member , create one and set its value to the term
being processed.
+
Otherwise, if term definition has a
type mapping :
@@ -4235,6 +4255,18 @@ Algorithm
If datatype is not well-formed , return null
.
If item has a @language
member which is not well-formed , return null
.
+ If datatype is @json
,
+ convert value to the canonical lexical form
+ using the result of transforming the internal representation of value
+ to JSON and set datatype to rdf:JSON
.
+ The JSON Canonicalization Scheme [[?JCS]]
+ is an emerging standard for JSON canonicalization
+ not yet ready to be referenced.
+ When a JSON canonicalization standard becomes available,
+ this specification will likely be updated to require such a canonical representation.
+ Users are cautioned from depending on the
+
JSON literal lexical representation as an
RDF literal ,
+ as the specifics of serialization may change in a future revison of this document.
If value is true
or
false
, set value to the string
true
or false
which is the
@@ -4552,6 +4584,11 @@ Overview
value objects whereas IRIs and
blank node identifiers are
transformed to node objects .
+ Literals with datatype rdf:JSON
+ are transformed into a value object using the internal representation
+ based on the lexical-to-value mapping defined in
+ JSON datatype in [[JSON-LD11]],
+ and @type
of @json
.
If the useNativeTypes flag is set to true
,
RDF literals with a
datatype IRI
@@ -4610,6 +4647,11 @@ Algorithm
to a JSON number .
+ Otherwise, if processing mode is json-ld-1.1
,
+ and value is a JSON literal ,
+ set the @value
member to the result of
+ turning the lexical value of value
+ into the JSON-LD internal representation , and set type to @json
.
Otherwise, if value is a
language-tagged string
add a member @language
to result and set its value to the
@@ -4638,7 +4680,7 @@ Data Round Tripping
or not (the result of a modulo‑1 operation), the boolean values
true
and false
are coerced to xsd:boolean
,
and strings are coerced to xsd:string
.
- The numeric or boolean values themselves are converted to
+ The JSON , numeric, or boolean values themselves are converted to
canonical lexical form , i.e., a deterministic string
representation as defined in [[XMLSCHEMA11-2]].
@@ -4692,6 +4734,74 @@ Data Round Tripping
values true
and false
are the strings
true
and false
.
+ The canonical lexical form of a JSON literal
+ value is non-normative, as a normative recommendation for
+ JSON canonicalization is not yet defined. Implementations
+ SHOULD use the following guidelines when creating the lexical
+ representation of a JSON literal :
+
+ Serialize JSON using no unnecessary whitespace,
+ Keys in objects SHOULD be ordered lexicographically,
+ Native Numeric values SHOULD be serialized according to
+ Section 7.1.12.1 of [[?ECMASCRIPT]],
+ Strings SHOULD be serialized with Unicode codepoints from U+0000
through U+001F
+ using lowercase hexaddecimal Unicode notation (\uhhhh
) unless in the set
+ of predefined JSON control characters U+0008
, U+0009
,
+ U+000A
, U+000C
or U+000D
+ which SHOULD be serialized as \b
, \t
, \n
, \f
and \r
respectively.
+ All other Unicode characters SHOULD be serialized "as is", other than
+ U+005C
(\
) and U+0022
("
)
+ which SHOULD be serialized as \\
and \"
respectively.
+
+
+ The JSON Canonicalization Scheme [[?JCS]]
+ is an emerging standard for JSON canonicalization
+ not yet ready to be referenced.
+ When a JSON canonicalization standard becomes available,
+ this specification will likely be updated to require such a canonical representation.
+ Users are cautioned from depending on the
+ JSON literal lexical representation as an RDF literal ,
+ as the specifics of serialization may change in a future revison of this document.
+
+
+
+
+
+
+ The example shows the value of "e" as a native JSON array including
+ unnecessary whitespace, a number and an object. The result
+ eliminates the whitespace, uses a canonical number representation,
+ and reorders the object members lexicographically:
+
+
+
+
+
+
When JSON-native numbers are deserialized
to RDF, lossless data round-tripping cannot be guaranteed, as rounding
errors might occur. When
@@ -5731,6 +5841,7 @@
Changes since JSON-LD Community Group Final Report
Because scoped contexts can lead to contexts being reloaded, replace the
recursive context inclusion error with a context overflow error.
Added support for "@type": "@none"
in a term definition to prevent value compaction.
+ Added support for JSON literals .
diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld
index 34018070..2a9f4d93 100644
--- a/tests/compact-manifest.jsonld
+++ b/tests/compact-manifest.jsonld
@@ -1184,6 +1184,87 @@
"context": "compact/h004-context.jsonld",
"expect": "compact/h004-out.jsonld",
"option": {"specVersion": "json-ld-1.1", "extractAllScripts": true}
+ }, {
+ "@id": "#tjs01",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact JSON literal (boolean true)",
+ "purpose": "Tests compacting property with @type @json to a JSON literal (boolean true).",
+ "input": "compact/js01-in.jsonld",
+ "context": "compact/js01-context.jsonld",
+ "expect": "compact/js01-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs02",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact JSON literal (boolean false)",
+ "purpose": "Tests compacting property with @type @json to a JSON literal (boolean false).",
+ "input": "compact/js02-in.jsonld",
+ "context": "compact/js02-context.jsonld",
+ "expect": "compact/js02-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs03",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact JSON literal (double)",
+ "purpose": "Tests compacting property with @type @json to a JSON literal (double).",
+ "input": "compact/js03-in.jsonld",
+ "context": "compact/js03-context.jsonld",
+ "expect": "compact/js03-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs04",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact JSON literal (double-zero)",
+ "purpose": "Tests compacting property with @type @json to a JSON literal (double-zero).",
+ "input": "compact/js04-in.jsonld",
+ "context": "compact/js04-context.jsonld",
+ "expect": "compact/js04-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs05",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact JSON literal (integer)",
+ "purpose": "Tests compacting property with @type @json to a JSON literal (integer).",
+ "input": "compact/js05-in.jsonld",
+ "context": "compact/js05-context.jsonld",
+ "expect": "compact/js05-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs06",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact JSON literal (object)",
+ "purpose": "Tests compacting property with @type @json to a JSON literal (object).",
+ "input": "compact/js06-in.jsonld",
+ "context": "compact/js06-context.jsonld",
+ "expect": "compact/js06-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs07",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact JSON literal (array)",
+ "purpose": "Tests compacting property with @type @json to a JSON literal (array).",
+ "input": "compact/js07-in.jsonld",
+ "context": "compact/js07-context.jsonld",
+ "expect": "compact/js07-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs08",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact already expanded JSON literal",
+ "purpose": "Tests compacting JSON literal does not expand terms inside json.",
+ "input": "compact/js08-in.jsonld",
+ "context": "compact/js08-context.jsonld",
+ "expect": "compact/js08-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs09",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact already expanded JSON literal with aliased keys",
+ "purpose": "Tests compacting JSON literal in expanded form.",
+ "input": "compact/js09-in.jsonld",
+ "context": "compact/js09-context.jsonld",
+ "expect": "compact/js09-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
}, {
"@id": "#tm001",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
diff --git a/tests/compact/js01-context.jsonld b/tests/compact/js01-context.jsonld
new file mode 100644
index 00000000..946ab91a
--- /dev/null
+++ b/tests/compact/js01-context.jsonld
@@ -0,0 +1,6 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#bool", "@type": "@json"}
+ }
+}
\ No newline at end of file
diff --git a/tests/compact/js01-in.jsonld b/tests/compact/js01-in.jsonld
new file mode 100644
index 00000000..642709fd
--- /dev/null
+++ b/tests/compact/js01-in.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#bool": [{"@value": true, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/compact/js01-out.jsonld b/tests/compact/js01-out.jsonld
new file mode 100644
index 00000000..ace09383
--- /dev/null
+++ b/tests/compact/js01-out.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#bool", "@type": "@json"}
+ },
+ "e": true
+}
\ No newline at end of file
diff --git a/tests/compact/js02-context.jsonld b/tests/compact/js02-context.jsonld
new file mode 100644
index 00000000..946ab91a
--- /dev/null
+++ b/tests/compact/js02-context.jsonld
@@ -0,0 +1,6 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#bool", "@type": "@json"}
+ }
+}
\ No newline at end of file
diff --git a/tests/compact/js02-in.jsonld b/tests/compact/js02-in.jsonld
new file mode 100644
index 00000000..640d3d29
--- /dev/null
+++ b/tests/compact/js02-in.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#bool": [{"@value": false, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/compact/js02-out.jsonld b/tests/compact/js02-out.jsonld
new file mode 100644
index 00000000..65f32bf2
--- /dev/null
+++ b/tests/compact/js02-out.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#bool", "@type": "@json"}
+ },
+ "e": false
+}
\ No newline at end of file
diff --git a/tests/compact/js03-context.jsonld b/tests/compact/js03-context.jsonld
new file mode 100644
index 00000000..e933a8f1
--- /dev/null
+++ b/tests/compact/js03-context.jsonld
@@ -0,0 +1,6 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#double", "@type": "@json"}
+ }
+}
\ No newline at end of file
diff --git a/tests/compact/js03-in.jsonld b/tests/compact/js03-in.jsonld
new file mode 100644
index 00000000..060691ac
--- /dev/null
+++ b/tests/compact/js03-in.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#double": [{"@value": 1.23, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/compact/js03-out.jsonld b/tests/compact/js03-out.jsonld
new file mode 100644
index 00000000..3f98c4fc
--- /dev/null
+++ b/tests/compact/js03-out.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#double", "@type": "@json"}
+ },
+ "e": 1.23
+}
\ No newline at end of file
diff --git a/tests/compact/js04-context.jsonld b/tests/compact/js04-context.jsonld
new file mode 100644
index 00000000..e933a8f1
--- /dev/null
+++ b/tests/compact/js04-context.jsonld
@@ -0,0 +1,6 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#double", "@type": "@json"}
+ }
+}
\ No newline at end of file
diff --git a/tests/compact/js04-in.jsonld b/tests/compact/js04-in.jsonld
new file mode 100644
index 00000000..278b08f0
--- /dev/null
+++ b/tests/compact/js04-in.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#double": [{"@value": 0.0e0, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/compact/js04-out.jsonld b/tests/compact/js04-out.jsonld
new file mode 100644
index 00000000..dfd129c8
--- /dev/null
+++ b/tests/compact/js04-out.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#double", "@type": "@json"}
+ },
+ "e": 0.0e0
+}
\ No newline at end of file
diff --git a/tests/compact/js05-context.jsonld b/tests/compact/js05-context.jsonld
new file mode 100644
index 00000000..8185ea17
--- /dev/null
+++ b/tests/compact/js05-context.jsonld
@@ -0,0 +1,6 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#integer", "@type": "@json"}
+ }
+}
\ No newline at end of file
diff --git a/tests/compact/js05-in.jsonld b/tests/compact/js05-in.jsonld
new file mode 100644
index 00000000..364fc8ff
--- /dev/null
+++ b/tests/compact/js05-in.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#integer": [{"@value": 123, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/compact/js05-out.jsonld b/tests/compact/js05-out.jsonld
new file mode 100644
index 00000000..22702493
--- /dev/null
+++ b/tests/compact/js05-out.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#integer", "@type": "@json"}
+ },
+ "e": 123
+}
\ No newline at end of file
diff --git a/tests/compact/js06-context.jsonld b/tests/compact/js06-context.jsonld
new file mode 100644
index 00000000..98422103
--- /dev/null
+++ b/tests/compact/js06-context.jsonld
@@ -0,0 +1,6 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#object", "@type": "@json"}
+ }
+}
\ No newline at end of file
diff --git a/tests/compact/js06-in.jsonld b/tests/compact/js06-in.jsonld
new file mode 100644
index 00000000..c9df2866
--- /dev/null
+++ b/tests/compact/js06-in.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#object": [{"@value": {"foo": "bar"}, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/compact/js06-out.jsonld b/tests/compact/js06-out.jsonld
new file mode 100644
index 00000000..b0c57352
--- /dev/null
+++ b/tests/compact/js06-out.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#object", "@type": "@json"}
+ },
+ "e": {"foo": "bar"}
+}
\ No newline at end of file
diff --git a/tests/compact/js07-context.jsonld b/tests/compact/js07-context.jsonld
new file mode 100644
index 00000000..c037c68d
--- /dev/null
+++ b/tests/compact/js07-context.jsonld
@@ -0,0 +1,6 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#array", "@type": "@json", "@container": "@set"}
+ }
+}
\ No newline at end of file
diff --git a/tests/compact/js07-in.jsonld b/tests/compact/js07-in.jsonld
new file mode 100644
index 00000000..d0b1b28e
--- /dev/null
+++ b/tests/compact/js07-in.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#array": [{"@value": [{"foo": "bar"}], "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/compact/js07-out.jsonld b/tests/compact/js07-out.jsonld
new file mode 100644
index 00000000..d4e7c2cb
--- /dev/null
+++ b/tests/compact/js07-out.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#array", "@type": "@json", "@container": "@set"}
+ },
+ "e": [{"foo": "bar"}]
+}
\ No newline at end of file
diff --git a/tests/compact/js08-context.jsonld b/tests/compact/js08-context.jsonld
new file mode 100644
index 00000000..91f0f103
--- /dev/null
+++ b/tests/compact/js08-context.jsonld
@@ -0,0 +1,3 @@
+{
+ "@context": {"@version": 1.1}
+}
\ No newline at end of file
diff --git a/tests/compact/js08-in.jsonld b/tests/compact/js08-in.jsonld
new file mode 100644
index 00000000..c9df2866
--- /dev/null
+++ b/tests/compact/js08-in.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#object": [{"@value": {"foo": "bar"}, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/compact/js08-out.jsonld b/tests/compact/js08-out.jsonld
new file mode 100644
index 00000000..2b136f3f
--- /dev/null
+++ b/tests/compact/js08-out.jsonld
@@ -0,0 +1,4 @@
+{
+ "@context": {"@version": 1.1},
+ "http://example.org/vocab#object": {"@value": {"foo": "bar"}, "@type": "@json"}
+}
\ No newline at end of file
diff --git a/tests/compact/js09-context.jsonld b/tests/compact/js09-context.jsonld
new file mode 100644
index 00000000..724029d9
--- /dev/null
+++ b/tests/compact/js09-context.jsonld
@@ -0,0 +1,3 @@
+{
+ "@context": {"@version": 1.1, "value": "@value", "type": "@type", "json": "@json"}
+}
\ No newline at end of file
diff --git a/tests/compact/js09-in.jsonld b/tests/compact/js09-in.jsonld
new file mode 100644
index 00000000..c9df2866
--- /dev/null
+++ b/tests/compact/js09-in.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#object": [{"@value": {"foo": "bar"}, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/compact/js09-out.jsonld b/tests/compact/js09-out.jsonld
new file mode 100644
index 00000000..71bb1b5f
--- /dev/null
+++ b/tests/compact/js09-out.jsonld
@@ -0,0 +1,4 @@
+{
+ "@context": {"@version": 1.1, "value": "@value", "type": "@type", "json": "@json"},
+ "http://example.org/vocab#object": {"value": {"foo": "bar"}, "type": "json"}
+}
\ No newline at end of file
diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld
index a19a72df..d8f59dff 100644
--- a/tests/expand-manifest.jsonld
+++ b/tests/expand-manifest.jsonld
@@ -1489,6 +1489,86 @@
"input": "expand/h022-in.html#second",
"expect": "expand/h022-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs01",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+ "name": "Expand JSON literal (boolean true)",
+ "purpose": "Tests expanding property with @type @json to a JSON literal (boolean true).",
+ "input": "expand/js01-in.jsonld",
+ "expect": "expand/js01-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs02",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+ "name": "Expand JSON literal (boolean false)",
+ "purpose": "Tests expanding property with @type @json to a JSON literal (boolean false).",
+ "input": "expand/js02-in.jsonld",
+ "expect": "expand/js02-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs03",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+ "name": "Expand JSON literal (double)",
+ "purpose": "Tests expanding property with @type @json to a JSON literal (double).",
+ "input": "expand/js03-in.jsonld",
+ "expect": "expand/js03-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs04",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+ "name": "Expand JSON literal (double-zero)",
+ "purpose": "Tests expanding property with @type @json to a JSON literal (double-zero).",
+ "input": "expand/js04-in.jsonld",
+ "expect": "expand/js04-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs05",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+ "name": "Expand JSON literal (integer)",
+ "purpose": "Tests expanding property with @type @json to a JSON literal (integer).",
+ "input": "expand/js05-in.jsonld",
+ "expect": "expand/js05-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs06",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+ "name": "Expand JSON literal (object)",
+ "purpose": "Tests expanding property with @type @json to a JSON literal (object).",
+ "input": "expand/js06-in.jsonld",
+ "expect": "expand/js06-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs07",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+ "name": "Expand JSON literal (array)",
+ "purpose": "Tests expanding property with @type @json to a JSON literal (array).",
+ "input": "expand/js07-in.jsonld",
+ "expect": "expand/js07-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs08",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+ "name": "Expand JSON literal without expanding contents",
+ "purpose": "Tests expanding JSON literal does not expand terms inside json.",
+ "input": "expand/js08-in.jsonld",
+ "expect": "expand/js08-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs09",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+ "name": "Expand JSON literal aleady in expanded form",
+ "purpose": "Tests expanding JSON literal in expanded form.",
+ "input": "expand/js09-in.jsonld",
+ "expect": "expand/js09-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs10",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+ "name": "Expand JSON literal aleady in expanded form with aliased keys",
+ "purpose": "Tests expanding JSON literal in expanded form with aliased keys in value object.",
+ "input": "expand/js10-in.jsonld",
+ "expect": "expand/js10-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tm001",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
diff --git a/tests/expand/js01-in.jsonld b/tests/expand/js01-in.jsonld
new file mode 100644
index 00000000..ace09383
--- /dev/null
+++ b/tests/expand/js01-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#bool", "@type": "@json"}
+ },
+ "e": true
+}
\ No newline at end of file
diff --git a/tests/expand/js01-out.jsonld b/tests/expand/js01-out.jsonld
new file mode 100644
index 00000000..642709fd
--- /dev/null
+++ b/tests/expand/js01-out.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#bool": [{"@value": true, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/expand/js02-in.jsonld b/tests/expand/js02-in.jsonld
new file mode 100644
index 00000000..65f32bf2
--- /dev/null
+++ b/tests/expand/js02-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#bool", "@type": "@json"}
+ },
+ "e": false
+}
\ No newline at end of file
diff --git a/tests/expand/js02-out.jsonld b/tests/expand/js02-out.jsonld
new file mode 100644
index 00000000..640d3d29
--- /dev/null
+++ b/tests/expand/js02-out.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#bool": [{"@value": false, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/expand/js03-in.jsonld b/tests/expand/js03-in.jsonld
new file mode 100644
index 00000000..3f98c4fc
--- /dev/null
+++ b/tests/expand/js03-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#double", "@type": "@json"}
+ },
+ "e": 1.23
+}
\ No newline at end of file
diff --git a/tests/expand/js03-out.jsonld b/tests/expand/js03-out.jsonld
new file mode 100644
index 00000000..060691ac
--- /dev/null
+++ b/tests/expand/js03-out.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#double": [{"@value": 1.23, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/expand/js04-in.jsonld b/tests/expand/js04-in.jsonld
new file mode 100644
index 00000000..dfd129c8
--- /dev/null
+++ b/tests/expand/js04-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#double", "@type": "@json"}
+ },
+ "e": 0.0e0
+}
\ No newline at end of file
diff --git a/tests/expand/js04-out.jsonld b/tests/expand/js04-out.jsonld
new file mode 100644
index 00000000..278b08f0
--- /dev/null
+++ b/tests/expand/js04-out.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#double": [{"@value": 0.0e0, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/expand/js05-in.jsonld b/tests/expand/js05-in.jsonld
new file mode 100644
index 00000000..22702493
--- /dev/null
+++ b/tests/expand/js05-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#integer", "@type": "@json"}
+ },
+ "e": 123
+}
\ No newline at end of file
diff --git a/tests/expand/js05-out.jsonld b/tests/expand/js05-out.jsonld
new file mode 100644
index 00000000..364fc8ff
--- /dev/null
+++ b/tests/expand/js05-out.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#integer": [{"@value": 123, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/expand/js06-in.jsonld b/tests/expand/js06-in.jsonld
new file mode 100644
index 00000000..b0c57352
--- /dev/null
+++ b/tests/expand/js06-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#object", "@type": "@json"}
+ },
+ "e": {"foo": "bar"}
+}
\ No newline at end of file
diff --git a/tests/expand/js06-out.jsonld b/tests/expand/js06-out.jsonld
new file mode 100644
index 00000000..c9df2866
--- /dev/null
+++ b/tests/expand/js06-out.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#object": [{"@value": {"foo": "bar"}, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/expand/js07-in.jsonld b/tests/expand/js07-in.jsonld
new file mode 100644
index 00000000..8caa6c9f
--- /dev/null
+++ b/tests/expand/js07-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#array", "@type": "@json"}
+ },
+ "e": [{"foo": "bar"}]
+}
\ No newline at end of file
diff --git a/tests/expand/js07-out.jsonld b/tests/expand/js07-out.jsonld
new file mode 100644
index 00000000..d0b1b28e
--- /dev/null
+++ b/tests/expand/js07-out.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#array": [{"@value": [{"foo": "bar"}], "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/expand/js08-in.jsonld b/tests/expand/js08-in.jsonld
new file mode 100644
index 00000000..837a69a4
--- /dev/null
+++ b/tests/expand/js08-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#array", "@type": "@json"}
+ },
+ "e": [{"e": "bar"}]
+}
\ No newline at end of file
diff --git a/tests/expand/js08-out.jsonld b/tests/expand/js08-out.jsonld
new file mode 100644
index 00000000..a20f5d8e
--- /dev/null
+++ b/tests/expand/js08-out.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#array": [{"@value": [{"e": "bar"}], "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/expand/js09-in.jsonld b/tests/expand/js09-in.jsonld
new file mode 100644
index 00000000..cc9820a5
--- /dev/null
+++ b/tests/expand/js09-in.jsonld
@@ -0,0 +1,3 @@
+{
+ "http://example.org/vocab#object": [{"@value": {"foo": "bar"}, "@type": "@json"}]
+}
\ No newline at end of file
diff --git a/tests/expand/js09-out.jsonld b/tests/expand/js09-out.jsonld
new file mode 100644
index 00000000..c9df2866
--- /dev/null
+++ b/tests/expand/js09-out.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#object": [{"@value": {"foo": "bar"}, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/expand/js10-in.jsonld b/tests/expand/js10-in.jsonld
new file mode 100644
index 00000000..e40669f3
--- /dev/null
+++ b/tests/expand/js10-in.jsonld
@@ -0,0 +1,4 @@
+{
+ "@context": {"@version": 1.1, "value": "@value", "type": "@type", "json": "@json"},
+ "http://example.org/vocab#object": [{"value": {"foo": "bar"}, "type": "json"}]
+}
\ No newline at end of file
diff --git a/tests/expand/js10-out.jsonld b/tests/expand/js10-out.jsonld
new file mode 100644
index 00000000..c9df2866
--- /dev/null
+++ b/tests/expand/js10-out.jsonld
@@ -0,0 +1,3 @@
+[{
+ "http://example.org/vocab#object": [{"@value": {"foo": "bar"}, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/fromRdf-manifest.jsonld b/tests/fromRdf-manifest.jsonld
index 55469609..4a04c921 100644
--- a/tests/fromRdf-manifest.jsonld
+++ b/tests/fromRdf-manifest.jsonld
@@ -195,6 +195,62 @@
"purpose": "Check list generation with rdf:first property and rdf:nil value.",
"input": "fromRdf/0026-in.nq",
"expect": "fromRdf/0026-out.jsonld"
+ }, {
+ "@id": "#tjs01",
+ "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+ "name": "JSON literal (boolean true)",
+ "purpose": "Tests creating property with rdf:type rdf:JSON to a JSON literal (boolean true).",
+ "input": "fromRdf/js01-in.nq",
+ "expect": "fromRdf/js01-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs02",
+ "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+ "name": "JSON literal (boolean false)",
+ "purpose": "Tests creating property with rdf:type rdf:JSON to a JSON literal (boolean false).",
+ "input": "fromRdf/js02-in.nq",
+ "expect": "fromRdf/js02-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs03",
+ "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+ "name": "JSON literal (double)",
+ "purpose": "Tests creating property with rdf:type rdf:JSON to a JSON literal (double).",
+ "input": "fromRdf/js03-in.nq",
+ "expect": "fromRdf/js03-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs04",
+ "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+ "name": "JSON literal (double-zero)",
+ "purpose": "Tests creating property with rdf:type rdf:JSON to a JSON literal (double-zero).",
+ "input": "fromRdf/js04-in.nq",
+ "expect": "fromRdf/js04-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs05",
+ "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+ "name": "JSON literal (integer)",
+ "purpose": "Tests creating property with rdf:type rdf:JSON to a JSON literal (integer).",
+ "input": "fromRdf/js05-in.nq",
+ "expect": "fromRdf/js05-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs06",
+ "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+ "name": "JSON literal (object)",
+ "purpose": "Tests creating property with rdf:type rdf:JSON to a JSON literal (object).",
+ "input": "fromRdf/js06-in.nq",
+ "expect": "fromRdf/js06-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs07",
+ "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+ "name": "JSON literal (array)",
+ "purpose": "Tests creating property with rdf:type rdf:JSON to a JSON literal (array).",
+ "input": "fromRdf/js07-in.nq",
+ "expect": "fromRdf/js07-out.jsonld",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
}, {
"@id": "#tli01",
"@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
diff --git a/tests/fromRdf/js01-in.nq b/tests/fromRdf/js01-in.nq
new file mode 100644
index 00000000..49b72920
--- /dev/null
+++ b/tests/fromRdf/js01-in.nq
@@ -0,0 +1 @@
+ "true"^^ .
\ No newline at end of file
diff --git a/tests/fromRdf/js01-out.jsonld b/tests/fromRdf/js01-out.jsonld
new file mode 100644
index 00000000..e5d59442
--- /dev/null
+++ b/tests/fromRdf/js01-out.jsonld
@@ -0,0 +1,4 @@
+[{
+ "@id": "http://example.org/vocab#id",
+ "http://example.org/vocab#bool": [{"@value": true, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/fromRdf/js02-in.nq b/tests/fromRdf/js02-in.nq
new file mode 100644
index 00000000..f88e0fa6
--- /dev/null
+++ b/tests/fromRdf/js02-in.nq
@@ -0,0 +1 @@
+ "false"^^ .
\ No newline at end of file
diff --git a/tests/fromRdf/js02-out.jsonld b/tests/fromRdf/js02-out.jsonld
new file mode 100644
index 00000000..5e831a6c
--- /dev/null
+++ b/tests/fromRdf/js02-out.jsonld
@@ -0,0 +1,4 @@
+[{
+ "@id": "http://example.org/vocab#id",
+ "http://example.org/vocab#bool": [{"@value": false, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/fromRdf/js03-in.nq b/tests/fromRdf/js03-in.nq
new file mode 100644
index 00000000..83f070a5
--- /dev/null
+++ b/tests/fromRdf/js03-in.nq
@@ -0,0 +1 @@
+ "1.23"^^ .
\ No newline at end of file
diff --git a/tests/fromRdf/js03-out.jsonld b/tests/fromRdf/js03-out.jsonld
new file mode 100644
index 00000000..19e3e095
--- /dev/null
+++ b/tests/fromRdf/js03-out.jsonld
@@ -0,0 +1,4 @@
+[{
+ "@id": "http://example.org/vocab#id",
+ "http://example.org/vocab#double": [{"@value": 1.23E0, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/fromRdf/js04-in.nq b/tests/fromRdf/js04-in.nq
new file mode 100644
index 00000000..cd8145ef
--- /dev/null
+++ b/tests/fromRdf/js04-in.nq
@@ -0,0 +1 @@
+ "0"^^ .
\ No newline at end of file
diff --git a/tests/fromRdf/js04-out.jsonld b/tests/fromRdf/js04-out.jsonld
new file mode 100644
index 00000000..d0171d50
--- /dev/null
+++ b/tests/fromRdf/js04-out.jsonld
@@ -0,0 +1,4 @@
+[{
+ "@id": "http://example.org/vocab#id",
+ "http://example.org/vocab#double": [{"@value": 0, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/fromRdf/js05-in.nq b/tests/fromRdf/js05-in.nq
new file mode 100644
index 00000000..063dda24
--- /dev/null
+++ b/tests/fromRdf/js05-in.nq
@@ -0,0 +1 @@
+ "123"^^ .
\ No newline at end of file
diff --git a/tests/fromRdf/js05-out.jsonld b/tests/fromRdf/js05-out.jsonld
new file mode 100644
index 00000000..438a44e1
--- /dev/null
+++ b/tests/fromRdf/js05-out.jsonld
@@ -0,0 +1,4 @@
+[{
+ "@id": "http://example.org/vocab#id",
+ "http://example.org/vocab#integer": [{"@value": 123, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/fromRdf/js06-in.nq b/tests/fromRdf/js06-in.nq
new file mode 100644
index 00000000..498c22b0
--- /dev/null
+++ b/tests/fromRdf/js06-in.nq
@@ -0,0 +1 @@
+ "{\"foo\":\"bar\"}"^^ .
\ No newline at end of file
diff --git a/tests/fromRdf/js06-out.jsonld b/tests/fromRdf/js06-out.jsonld
new file mode 100644
index 00000000..89844df5
--- /dev/null
+++ b/tests/fromRdf/js06-out.jsonld
@@ -0,0 +1,4 @@
+[{
+ "@id": "http://example.org/vocab#id",
+ "http://example.org/vocab#object": [{"@value": {"foo": "bar"}, "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/fromRdf/js07-in.nq b/tests/fromRdf/js07-in.nq
new file mode 100644
index 00000000..257f4b0a
--- /dev/null
+++ b/tests/fromRdf/js07-in.nq
@@ -0,0 +1 @@
+ "[{\"foo\":\"bar\"}]"^^ .
\ No newline at end of file
diff --git a/tests/fromRdf/js07-out.jsonld b/tests/fromRdf/js07-out.jsonld
new file mode 100644
index 00000000..3233b0b9
--- /dev/null
+++ b/tests/fromRdf/js07-out.jsonld
@@ -0,0 +1,4 @@
+[{
+ "@id": "http://example.org/vocab#id",
+ "http://example.org/vocab#array": [{"@value": [{"foo": "bar"}], "@type": "@json"}]
+}]
\ No newline at end of file
diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld
index cfac6926..a273e9e2 100644
--- a/tests/toRdf-manifest.jsonld
+++ b/tests/toRdf-manifest.jsonld
@@ -903,6 +903,110 @@
"input": "toRdf/h003-in.html#second",
"expect": "toRdf/h003-out.nq",
"option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs01",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal (boolean true)",
+ "purpose": "Tests transforming property with @type @json to a JSON literal (boolean true).",
+ "input": "toRdf/js01-in.jsonld",
+ "expect": "toRdf/js01-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs02",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal (boolean false)",
+ "purpose": "Tests transforming property with @type @json to a JSON literal (boolean false).",
+ "input": "toRdf/js02-in.jsonld",
+ "expect": "toRdf/js02-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs03",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal (double)",
+ "purpose": "Tests transforming property with @type @json to a JSON literal (double).",
+ "input": "toRdf/js03-in.jsonld",
+ "expect": "toRdf/js03-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs04",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal (double-zero)",
+ "purpose": "Tests transforming property with @type @json to a JSON literal (double-zero).",
+ "input": "toRdf/js04-in.jsonld",
+ "expect": "toRdf/js04-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs05",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal (integer)",
+ "purpose": "Tests transforming property with @type @json to a JSON literal (integer).",
+ "input": "toRdf/js05-in.jsonld",
+ "expect": "toRdf/js05-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs06",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal (object)",
+ "purpose": "Tests transforming property with @type @json to a JSON literal (object).",
+ "input": "toRdf/js06-in.jsonld",
+ "expect": "toRdf/js06-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs07",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal (array)",
+ "purpose": "Tests transforming property with @type @json to a JSON literal (array).",
+ "input": "toRdf/js07-in.jsonld",
+ "expect": "toRdf/js07-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs08",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal with array canonicalization",
+ "purpose": "Tests Transforming JSON literal with array canonicalization.",
+ "input": "toRdf/js08-in.jsonld",
+ "expect": "toRdf/js08-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs09",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal with string canonicalization",
+ "purpose": "Tests transforming JSON literal with string canonicalization.",
+ "input": "toRdf/js09-in.jsonld",
+ "expect": "toRdf/js09-out.nq",
+ "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs10",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal with structural canonicalization",
+ "purpose": "Tests transforming JSON literal with structural canonicalization.",
+ "input": "toRdf/js10-in.jsonld",
+ "expect": "toRdf/js10-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs11",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal with unicode canonicalization",
+ "purpose": "Tests transforming JSON literal with unicode canonicalization.",
+ "input": "toRdf/js11-in.jsonld",
+ "expect": "toRdf/js11-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs12",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal with value canonicalization",
+ "purpose": "Tests transforming JSON literal with value canonicalization.",
+ "input": "toRdf/js12-in.jsonld",
+ "expect": "toRdf/js12-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#tjs13",
+ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+ "name": "Transform JSON literal with wierd canonicalization",
+ "purpose": "Tests transforming JSON literal with wierd canonicalization.",
+ "input": "toRdf/js13-in.jsonld",
+ "expect": "toRdf/js13-out.nq",
+ "option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tli01",
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
diff --git a/tests/toRdf/js01-in.jsonld b/tests/toRdf/js01-in.jsonld
new file mode 100644
index 00000000..ace09383
--- /dev/null
+++ b/tests/toRdf/js01-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#bool", "@type": "@json"}
+ },
+ "e": true
+}
\ No newline at end of file
diff --git a/tests/toRdf/js01-out.nq b/tests/toRdf/js01-out.nq
new file mode 100644
index 00000000..bac18733
--- /dev/null
+++ b/tests/toRdf/js01-out.nq
@@ -0,0 +1 @@
+_:b0 "true"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js02-in.jsonld b/tests/toRdf/js02-in.jsonld
new file mode 100644
index 00000000..65f32bf2
--- /dev/null
+++ b/tests/toRdf/js02-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#bool", "@type": "@json"}
+ },
+ "e": false
+}
\ No newline at end of file
diff --git a/tests/toRdf/js02-out.nq b/tests/toRdf/js02-out.nq
new file mode 100644
index 00000000..7bb8fd1f
--- /dev/null
+++ b/tests/toRdf/js02-out.nq
@@ -0,0 +1 @@
+_:b0 "false"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js03-in.jsonld b/tests/toRdf/js03-in.jsonld
new file mode 100644
index 00000000..3f98c4fc
--- /dev/null
+++ b/tests/toRdf/js03-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#double", "@type": "@json"}
+ },
+ "e": 1.23
+}
\ No newline at end of file
diff --git a/tests/toRdf/js03-out.nq b/tests/toRdf/js03-out.nq
new file mode 100644
index 00000000..1fbd15a4
--- /dev/null
+++ b/tests/toRdf/js03-out.nq
@@ -0,0 +1 @@
+_:b0 "1.23"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js04-in.jsonld b/tests/toRdf/js04-in.jsonld
new file mode 100644
index 00000000..dfd129c8
--- /dev/null
+++ b/tests/toRdf/js04-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#double", "@type": "@json"}
+ },
+ "e": 0.0e0
+}
\ No newline at end of file
diff --git a/tests/toRdf/js04-out.nq b/tests/toRdf/js04-out.nq
new file mode 100644
index 00000000..1172726d
--- /dev/null
+++ b/tests/toRdf/js04-out.nq
@@ -0,0 +1 @@
+_:b0 "0"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js05-in.jsonld b/tests/toRdf/js05-in.jsonld
new file mode 100644
index 00000000..22702493
--- /dev/null
+++ b/tests/toRdf/js05-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#integer", "@type": "@json"}
+ },
+ "e": 123
+}
\ No newline at end of file
diff --git a/tests/toRdf/js05-out.nq b/tests/toRdf/js05-out.nq
new file mode 100644
index 00000000..d8c47b46
--- /dev/null
+++ b/tests/toRdf/js05-out.nq
@@ -0,0 +1 @@
+_:b0 "123"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js06-in.jsonld b/tests/toRdf/js06-in.jsonld
new file mode 100644
index 00000000..b0c57352
--- /dev/null
+++ b/tests/toRdf/js06-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#object", "@type": "@json"}
+ },
+ "e": {"foo": "bar"}
+}
\ No newline at end of file
diff --git a/tests/toRdf/js06-out.nq b/tests/toRdf/js06-out.nq
new file mode 100644
index 00000000..4909a3d6
--- /dev/null
+++ b/tests/toRdf/js06-out.nq
@@ -0,0 +1 @@
+_:b0 "{\"foo\":\"bar\"}"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js07-in.jsonld b/tests/toRdf/js07-in.jsonld
new file mode 100644
index 00000000..8caa6c9f
--- /dev/null
+++ b/tests/toRdf/js07-in.jsonld
@@ -0,0 +1,7 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#array", "@type": "@json"}
+ },
+ "e": [{"foo": "bar"}]
+}
\ No newline at end of file
diff --git a/tests/toRdf/js07-out.nq b/tests/toRdf/js07-out.nq
new file mode 100644
index 00000000..f2ef8961
--- /dev/null
+++ b/tests/toRdf/js07-out.nq
@@ -0,0 +1 @@
+_:b0 "[{\"foo\":\"bar\"}]"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js08-in.jsonld b/tests/toRdf/js08-in.jsonld
new file mode 100644
index 00000000..16ae134f
--- /dev/null
+++ b/tests/toRdf/js08-in.jsonld
@@ -0,0 +1,14 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#c14n", "@type": "@json"}
+ },
+ "e": [
+ 56,
+ {
+ "d": true,
+ "10": null,
+ "1": [ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tests/toRdf/js08-out.nq b/tests/toRdf/js08-out.nq
new file mode 100644
index 00000000..b27b6b7d
--- /dev/null
+++ b/tests/toRdf/js08-out.nq
@@ -0,0 +1 @@
+_:b0 "[56,{\"1\":[],\"10\":null,\"d\":true}]"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js09-in.jsonld b/tests/toRdf/js09-in.jsonld
new file mode 100644
index 00000000..3ade2918
--- /dev/null
+++ b/tests/toRdf/js09-in.jsonld
@@ -0,0 +1,12 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#c14n", "@type": "@json"}
+ },
+ "e": {
+ "peach": "This sorting order",
+ "péché": "is wrong according to French",
+ "pêche": "but canonicalization MUST",
+ "sin": "ignore locale"
+ }
+}
\ No newline at end of file
diff --git a/tests/toRdf/js09-out.nq b/tests/toRdf/js09-out.nq
new file mode 100644
index 00000000..aedbd732
--- /dev/null
+++ b/tests/toRdf/js09-out.nq
@@ -0,0 +1 @@
+_:b0 "{\"peach\":\"This sorting order\",\"péché\":\"is wrong according to French\",\"pêche\":\"but canonicalization MUST\",\"sin\":\"ignore locale\"}"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js10-in.jsonld b/tests/toRdf/js10-in.jsonld
new file mode 100644
index 00000000..5a34da26
--- /dev/null
+++ b/tests/toRdf/js10-in.jsonld
@@ -0,0 +1,14 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#c14n", "@type": "@json"}
+ },
+ "e": {
+ "1": {"f": {"f": "hi","F": 5} ," ": 56.0},
+ "10": { },
+ "": "empty",
+ "a": { },
+ "111": [ {"e": "yes","E": "no" } ],
+ "A": { }
+ }
+}
\ No newline at end of file
diff --git a/tests/toRdf/js10-out.nq b/tests/toRdf/js10-out.nq
new file mode 100644
index 00000000..055426c8
--- /dev/null
+++ b/tests/toRdf/js10-out.nq
@@ -0,0 +1 @@
+_:b0 "{\"\":\"empty\",\"1\":{\" \":56,\"f\":{\"F\":5,\"f\":\"hi\"}},\"10\":{},\"111\":[{\"E\":\"no\",\"e\":\"yes\"}],\"A\":{},\"a\":{}}"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js11-in.jsonld b/tests/toRdf/js11-in.jsonld
new file mode 100644
index 00000000..8f6f20b4
--- /dev/null
+++ b/tests/toRdf/js11-in.jsonld
@@ -0,0 +1,9 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#c14n", "@type": "@json"}
+ },
+ "e": {
+ "Unnormalized Unicode":"A\u030a"
+ }
+}
\ No newline at end of file
diff --git a/tests/toRdf/js11-out.nq b/tests/toRdf/js11-out.nq
new file mode 100644
index 00000000..0d41a89d
--- /dev/null
+++ b/tests/toRdf/js11-out.nq
@@ -0,0 +1 @@
+_:b0 "{\"Unnormalized Unicode\":\"Å\"}"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js12-in.jsonld b/tests/toRdf/js12-in.jsonld
new file mode 100644
index 00000000..325b874a
--- /dev/null
+++ b/tests/toRdf/js12-in.jsonld
@@ -0,0 +1,11 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#c14n", "@type": "@json"}
+ },
+ "e": {
+ "numbers": [333333333.33333329, 1E30, 4.50, 2e-3, 0.000000000000000000000000001],
+ "string": "\u20ac$\u000F\u000aA'\u0042\u0022\u005c\\\"\/",
+ "literals": [null, true, false]
+ }
+}
\ No newline at end of file
diff --git a/tests/toRdf/js12-out.nq b/tests/toRdf/js12-out.nq
new file mode 100644
index 00000000..1c5d73f9
--- /dev/null
+++ b/tests/toRdf/js12-out.nq
@@ -0,0 +1 @@
+_:b0 "{\"literals\":[null,true,false],\"numbers\":[333333333.3333333,1e+30,4.5,0.002,1e-27],\"string\":\"€$\\u000f\\nA'B\\\"\\\\\\\\\\\"/\"}"^^ .
\ No newline at end of file
diff --git a/tests/toRdf/js13-in.jsonld b/tests/toRdf/js13-in.jsonld
new file mode 100644
index 00000000..dc476ae9
--- /dev/null
+++ b/tests/toRdf/js13-in.jsonld
@@ -0,0 +1,16 @@
+{
+ "@context": {
+ "@version": 1.1,
+ "e": {"@id": "http://example.org/vocab#c14n", "@type": "@json"}
+ },
+ "e": {
+ "\u20ac": "Euro Sign",
+ "\r": "Carriage Return",
+ "\u000a": "Newline",
+ "1": "One",
+ "\u0080": "Control\u007f",
+ "\ud83d\ude02": "Smiley",
+ "\u00f6": "Latin Small Letter O With Diaeresis",
+ "": "Browser Challenge"
+ }
+}
\ No newline at end of file
diff --git a/tests/toRdf/js13-out.nq b/tests/toRdf/js13-out.nq
new file mode 100644
index 00000000..f0fc6770
--- /dev/null
+++ b/tests/toRdf/js13-out.nq
@@ -0,0 +1 @@
+_:b0 "{\"\\n\":\"Newline\",\"\\r\":\"Carriage Return\",\"1\":\"One\",\"\":\"Browser Challenge\",\"\":\"Control\",\"ö\":\"Latin Small Letter O With Diaeresis\",\"€\":\"Euro Sign\",\"😂\":\"Smiley\"}"^^ .
\ No newline at end of file