From c8c199f0be340d148e6f73e360f0caafe7c9920e Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 25 Mar 2019 09:25:11 -0700 Subject: [PATCH 1/8] Fix bad HTML. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 8247c6a1..fd3c9439 100644 --- a/index.html +++ b/index.html @@ -2938,7 +2938,7 @@

Algorithm

  • Otherwise, if term definition has a - type mapping which is @none:
  • + type mapping which is @none:
    1. Reference the value associated with the @language member in type/language map using the variable From 8e2b899518fc3eb91a5938370084bf0f2a954ee9 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 20 Mar 2019 15:52:57 -0700 Subject: [PATCH 2/8] Support JSON Literals. Uses JCS normatively for RDF output, with atrisk issue. For w3c/json-ld-syntax#4. --- Gemfile.lock | 4 +- index.html | 110 +++++++++++++++++++++++++++--- tests/compact-manifest.jsonld | 81 ++++++++++++++++++++++ tests/compact/js01-context.jsonld | 6 ++ tests/compact/js01-in.jsonld | 3 + tests/compact/js01-out.jsonld | 7 ++ tests/compact/js02-context.jsonld | 6 ++ tests/compact/js02-in.jsonld | 3 + tests/compact/js02-out.jsonld | 7 ++ tests/compact/js03-context.jsonld | 6 ++ tests/compact/js03-in.jsonld | 3 + tests/compact/js03-out.jsonld | 7 ++ tests/compact/js04-context.jsonld | 6 ++ tests/compact/js04-in.jsonld | 3 + tests/compact/js04-out.jsonld | 7 ++ tests/compact/js05-context.jsonld | 6 ++ tests/compact/js05-in.jsonld | 3 + tests/compact/js05-out.jsonld | 7 ++ tests/compact/js06-context.jsonld | 6 ++ tests/compact/js06-in.jsonld | 3 + tests/compact/js06-out.jsonld | 7 ++ tests/compact/js07-context.jsonld | 6 ++ tests/compact/js07-in.jsonld | 3 + tests/compact/js07-out.jsonld | 7 ++ tests/compact/js08-context.jsonld | 3 + tests/compact/js08-in.jsonld | 3 + tests/compact/js08-out.jsonld | 4 ++ tests/compact/js09-context.jsonld | 3 + tests/compact/js09-in.jsonld | 3 + tests/compact/js09-out.jsonld | 4 ++ tests/expand-manifest.jsonld | 80 ++++++++++++++++++++++ tests/expand/js01-in.jsonld | 7 ++ tests/expand/js01-out.jsonld | 3 + tests/expand/js02-in.jsonld | 7 ++ tests/expand/js02-out.jsonld | 3 + tests/expand/js03-in.jsonld | 7 ++ tests/expand/js03-out.jsonld | 3 + tests/expand/js04-in.jsonld | 7 ++ tests/expand/js04-out.jsonld | 3 + tests/expand/js05-in.jsonld | 7 ++ tests/expand/js05-out.jsonld | 3 + tests/expand/js06-in.jsonld | 7 ++ tests/expand/js06-out.jsonld | 3 + tests/expand/js07-in.jsonld | 7 ++ tests/expand/js07-out.jsonld | 3 + tests/expand/js08-in.jsonld | 7 ++ tests/expand/js08-out.jsonld | 3 + tests/expand/js09-in.jsonld | 3 + tests/expand/js09-out.jsonld | 3 + tests/expand/js10-in.jsonld | 4 ++ tests/expand/js10-out.jsonld | 3 + tests/fromRdf-manifest.jsonld | 56 +++++++++++++++ tests/fromRdf/js01-in.nq | 1 + tests/fromRdf/js01-out.jsonld | 4 ++ tests/fromRdf/js02-in.nq | 1 + tests/fromRdf/js02-out.jsonld | 4 ++ tests/fromRdf/js03-in.nq | 1 + tests/fromRdf/js03-out.jsonld | 4 ++ tests/fromRdf/js04-in.nq | 1 + tests/fromRdf/js04-out.jsonld | 4 ++ tests/fromRdf/js05-in.nq | 1 + tests/fromRdf/js05-out.jsonld | 4 ++ tests/fromRdf/js06-in.nq | 1 + tests/fromRdf/js06-out.jsonld | 4 ++ tests/fromRdf/js07-in.nq | 1 + tests/fromRdf/js07-out.jsonld | 4 ++ tests/toRdf-manifest.jsonld | 104 ++++++++++++++++++++++++++++ tests/toRdf/js01-in.jsonld | 7 ++ tests/toRdf/js01-out.nq | 1 + tests/toRdf/js02-in.jsonld | 7 ++ tests/toRdf/js02-out.nq | 1 + tests/toRdf/js03-in.jsonld | 7 ++ tests/toRdf/js03-out.nq | 1 + tests/toRdf/js04-in.jsonld | 7 ++ tests/toRdf/js04-out.nq | 1 + tests/toRdf/js05-in.jsonld | 7 ++ tests/toRdf/js05-out.nq | 1 + tests/toRdf/js06-in.jsonld | 7 ++ tests/toRdf/js06-out.nq | 1 + tests/toRdf/js07-in.jsonld | 7 ++ tests/toRdf/js07-out.nq | 1 + tests/toRdf/js08-in.jsonld | 14 ++++ tests/toRdf/js08-out.nq | 1 + tests/toRdf/js09-in.jsonld | 12 ++++ tests/toRdf/js09-out.nq | 1 + tests/toRdf/js10-in.jsonld | 14 ++++ tests/toRdf/js10-out.nq | 1 + tests/toRdf/js11-in.jsonld | 9 +++ tests/toRdf/js11-out.nq | 1 + tests/toRdf/js12-in.jsonld | 11 +++ tests/toRdf/js12-out.nq | 1 + tests/toRdf/js13-in.jsonld | 17 +++++ tests/toRdf/js13-out.nq | 1 + 93 files changed, 824 insertions(+), 10 deletions(-) create mode 100644 tests/compact/js01-context.jsonld create mode 100644 tests/compact/js01-in.jsonld create mode 100644 tests/compact/js01-out.jsonld create mode 100644 tests/compact/js02-context.jsonld create mode 100644 tests/compact/js02-in.jsonld create mode 100644 tests/compact/js02-out.jsonld create mode 100644 tests/compact/js03-context.jsonld create mode 100644 tests/compact/js03-in.jsonld create mode 100644 tests/compact/js03-out.jsonld create mode 100644 tests/compact/js04-context.jsonld create mode 100644 tests/compact/js04-in.jsonld create mode 100644 tests/compact/js04-out.jsonld create mode 100644 tests/compact/js05-context.jsonld create mode 100644 tests/compact/js05-in.jsonld create mode 100644 tests/compact/js05-out.jsonld create mode 100644 tests/compact/js06-context.jsonld create mode 100644 tests/compact/js06-in.jsonld create mode 100644 tests/compact/js06-out.jsonld create mode 100644 tests/compact/js07-context.jsonld create mode 100644 tests/compact/js07-in.jsonld create mode 100644 tests/compact/js07-out.jsonld create mode 100644 tests/compact/js08-context.jsonld create mode 100644 tests/compact/js08-in.jsonld create mode 100644 tests/compact/js08-out.jsonld create mode 100644 tests/compact/js09-context.jsonld create mode 100644 tests/compact/js09-in.jsonld create mode 100644 tests/compact/js09-out.jsonld create mode 100644 tests/expand/js01-in.jsonld create mode 100644 tests/expand/js01-out.jsonld create mode 100644 tests/expand/js02-in.jsonld create mode 100644 tests/expand/js02-out.jsonld create mode 100644 tests/expand/js03-in.jsonld create mode 100644 tests/expand/js03-out.jsonld create mode 100644 tests/expand/js04-in.jsonld create mode 100644 tests/expand/js04-out.jsonld create mode 100644 tests/expand/js05-in.jsonld create mode 100644 tests/expand/js05-out.jsonld create mode 100644 tests/expand/js06-in.jsonld create mode 100644 tests/expand/js06-out.jsonld create mode 100644 tests/expand/js07-in.jsonld create mode 100644 tests/expand/js07-out.jsonld create mode 100644 tests/expand/js08-in.jsonld create mode 100644 tests/expand/js08-out.jsonld create mode 100644 tests/expand/js09-in.jsonld create mode 100644 tests/expand/js09-out.jsonld create mode 100644 tests/expand/js10-in.jsonld create mode 100644 tests/expand/js10-out.jsonld create mode 100644 tests/fromRdf/js01-in.nq create mode 100644 tests/fromRdf/js01-out.jsonld create mode 100644 tests/fromRdf/js02-in.nq create mode 100644 tests/fromRdf/js02-out.jsonld create mode 100644 tests/fromRdf/js03-in.nq create mode 100644 tests/fromRdf/js03-out.jsonld create mode 100644 tests/fromRdf/js04-in.nq create mode 100644 tests/fromRdf/js04-out.jsonld create mode 100644 tests/fromRdf/js05-in.nq create mode 100644 tests/fromRdf/js05-out.jsonld create mode 100644 tests/fromRdf/js06-in.nq create mode 100644 tests/fromRdf/js06-out.jsonld create mode 100644 tests/fromRdf/js07-in.nq create mode 100644 tests/fromRdf/js07-out.jsonld create mode 100644 tests/toRdf/js01-in.jsonld create mode 100644 tests/toRdf/js01-out.nq create mode 100644 tests/toRdf/js02-in.jsonld create mode 100644 tests/toRdf/js02-out.nq create mode 100644 tests/toRdf/js03-in.jsonld create mode 100644 tests/toRdf/js03-out.nq create mode 100644 tests/toRdf/js04-in.jsonld create mode 100644 tests/toRdf/js04-out.nq create mode 100644 tests/toRdf/js05-in.jsonld create mode 100644 tests/toRdf/js05-out.nq create mode 100644 tests/toRdf/js06-in.jsonld create mode 100644 tests/toRdf/js06-out.nq create mode 100644 tests/toRdf/js07-in.jsonld create mode 100644 tests/toRdf/js07-out.nq create mode 100644 tests/toRdf/js08-in.jsonld create mode 100644 tests/toRdf/js08-out.nq create mode 100644 tests/toRdf/js09-in.jsonld create mode 100644 tests/toRdf/js09-out.nq create mode 100644 tests/toRdf/js10-in.jsonld create mode 100644 tests/toRdf/js10-out.nq create mode 100644 tests/toRdf/js11-in.jsonld create mode 100644 tests/toRdf/js11-out.nq create mode 100644 tests/toRdf/js12-in.jsonld create mode 100644 tests/toRdf/js12-out.nq create mode 100644 tests/toRdf/js13-in.jsonld create mode 100644 tests/toRdf/js13-out.nq diff --git a/Gemfile.lock b/Gemfile.lock index 66e2de70..3a35e566 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,10 @@ GIT remote: git://github.com/ruby-rdf/json-ld.git - revision: d88f81b143a602a6174b8b9da79c2fc6c04d127b + revision: 2a11745bc50eab0d5a4c5c3a5cd98b840176896e 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/index.html b/index.html index fd3c9439..b5f19b9c 100644 --- a/index.html +++ b/index.html @@ -894,6 +894,10 @@

      RDF Serialization/Deserialization

      IRI + + jsonld + http://www.w3.org/ns/json-ld# + rdf http://www.w3.org/1999/02/22-rdf-syntax-ns# @@ -1247,7 +1251,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.
    2. @@ -1715,7 +1719,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:
    1. If key is @context, continue to @@ -1778,7 +1787,11 @@

      Algorithm

      and ordered flags, ensuring that expanded value is an array of one or more dictionaries.
    2. -
    3. If expanded property is @value and +
    4. 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 +1916,11 @@

      Algorithm

      set term context to active context.
    5. Set container mapping to key's container mapping in term context.
    6. -
    7. If container mapping includes @language and +
    8. If key's term definition in active context + has a type mapping of @json, + set expanded value to a new dictionary the the member + @value set to value, and @type set to @json.
    9. +
    10. Otherwise, if container mapping includes @language and value is a dictionary then value is expanded from a language map as follows: @@ -2077,7 +2094,7 @@

      Algorithm

      nested value expands to @value, an invalid @nest value error has been detected and processing is aborted.
    11. -
    12. Recursively repeat step 7 +
    13. Recursively repeat step 9 using nested value for element.
  • @@ -2096,6 +2113,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 +2240,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 +2392,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, @@ -4235,6 +4258,13 @@

    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 as defined in [[JCS]] + using the result of transforming the internal representation of value + to JSON and set datatype to jsonld:JSON. +
    JCS is still in draft form, and normatively requiring + JSON canonicalization may be removed in a future draft, or + a JSON-LD specific canonicalization form may be defined.
  • If value is true or false, set value to the string true or false which is the @@ -4552,6 +4582,11 @@

    Overview

    value objects whereas IRIs and blank node identifiers are transformed to node objects. + Literals with datatype jsonld: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 +4645,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,9 +4678,10 @@

    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]].

    + representation as defined in [[XMLSCHEMA11-2]] + and [[JCS]].

    The canonical lexical form of an integer, i.e., a number with no non-zero fractional part or a number @@ -4692,6 +4733,56 @@

    Data Round Tripping

    values true and false are the strings true and false.

    +

    The canonical lexical form of the JSON literal + values are defined in [[JCS]]. The internal representation + of value objects having @type @json are converted to JSON + and canonicalized to reduce unnecessary whitespace, + order object members, and use a standard representation + for strings and numbers.

    + + + +

    JCS is still in draft form, and normatively requiring + JSON canonicalization may be removed in a future draft, or + a JSON-LD specific canonicalization form may be defined.

    +

    When JSON-native numbers are deserialized to RDF, lossless data round-tripping cannot be guaranteed, as rounding errors might occur. When @@ -5731,6 +5822,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..ca5f37f2 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 jsonld: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 jsonld: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 jsonld: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 jsonld: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 jsonld: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 jsonld: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 jsonld: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..9f82b6ac --- /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..6edec473 --- /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..e6f99b6a --- /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..119b97a5 --- /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..b3abebc1 --- /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..ef8ddedf --- /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..f991e6e6 --- /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..8ce606b4 --- /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..ee67b67d --- /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..d980c079 --- /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..e35f67bb --- /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..911ee059 --- /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..34d732cb --- /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..988c2dfe --- /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..c1e1e846 --- /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..ad11368b --- /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..f95aa9ff --- /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..1c203dd3 --- /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..3703020c --- /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..02fa45e5 --- /dev/null +++ b/tests/toRdf/js13-in.jsonld @@ -0,0 +1,17 @@ +{ + "@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", + "\ufb33": "Hebrew Letter Dalet With Dagesh", + "": "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..d40d875c --- /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\",\"דּ\":\"Hebrew Letter Dalet With Dagesh\"}"^^ . \ No newline at end of file From 0422dc5f1964615d6dcaa11fecc24241357ce840 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 20 Mar 2019 16:06:24 -0700 Subject: [PATCH 3/8] Fix some minor HTML errors. --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index b5f19b9c..8c8fedae 100644 --- a/index.html +++ b/index.html @@ -2976,6 +2976,7 @@

    Algorithm

    member, create one and set its value to the term being processed. +
  • Otherwise, if term definition has a type mapping:
      @@ -4585,7 +4586,7 @@

      Overview

      Literals with datatype jsonld: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]], + JSON datatype in [[JSON-LD11]], and @type of @json. If the useNativeTypes flag is set to true, RDF literals with a From 63cbf7048b6122c0229bf63bb9c70955f9e6607d Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Thu, 21 Mar 2019 10:50:44 +0100 Subject: [PATCH 4/8] fixed a few typos --- index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 8c8fedae..32aff6c8 100644 --- a/index.html +++ b/index.html @@ -1918,8 +1918,8 @@

      Algorithm

      term context.
    1. If key's term definition in active context has a type mapping of @json, - set expanded value to a new dictionary the the member - @value set to value, and @type set to @json.
    2. + set expanded value to a new dictionary, set the member + @value to value, and set the member @type to @json.
    3. Otherwise, if container mapping includes @language and value is a dictionary then value is expanded from a language map @@ -4679,7 +4679,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 JSON, 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]] and [[JCS]]. @@ -4763,7 +4763,7 @@

      Data Round Tripping

      The example shows the value of "e" as a native JSON array including - unnecssary whitespace, a number and an object. The result + unnecessary whitespace, a number and an object. The result eliminates the whitespace, uses a canonical number representation, and reorders the object members lexicographically:

      From 2577df6d6855e28251afea940450af0d29504a66 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sun, 24 Mar 2019 15:14:57 -0700 Subject: [PATCH 5/8] Use rdf:JSON instead of jsonld:JSON. --- index.html | 64 ++++++++++++++++++++++------------- tests/fromRdf-manifest.jsonld | 14 ++++---- tests/fromRdf/js01-in.nq | 2 +- tests/fromRdf/js02-in.nq | 2 +- tests/fromRdf/js03-in.nq | 2 +- tests/fromRdf/js04-in.nq | 2 +- tests/fromRdf/js05-in.nq | 2 +- tests/fromRdf/js06-in.nq | 2 +- tests/fromRdf/js07-in.nq | 2 +- tests/toRdf/js01-out.nq | 2 +- tests/toRdf/js02-out.nq | 2 +- tests/toRdf/js03-out.nq | 2 +- tests/toRdf/js04-out.nq | 2 +- tests/toRdf/js05-out.nq | 2 +- tests/toRdf/js06-out.nq | 2 +- tests/toRdf/js07-out.nq | 2 +- tests/toRdf/js08-out.nq | 2 +- tests/toRdf/js09-out.nq | 2 +- tests/toRdf/js10-out.nq | 2 +- tests/toRdf/js11-out.nq | 2 +- tests/toRdf/js12-in.jsonld | 2 +- tests/toRdf/js12-out.nq | 2 +- tests/toRdf/js13-in.jsonld | 1 - tests/toRdf/js13-out.nq | 2 +- 24 files changed, 69 insertions(+), 52 deletions(-) diff --git a/index.html b/index.html index 32aff6c8..4d3fdec8 100644 --- a/index.html +++ b/index.html @@ -894,10 +894,6 @@

      RDF Serialization/Deserialization

      IRI - - jsonld - http://www.w3.org/ns/json-ld# - rdf http://www.w3.org/1999/02/22-rdf-syntax-ns# @@ -4260,12 +4256,17 @@

      Algorithm

    4. If item has a @language member which is not well-formed, return null.
    5. If datatype is @json, - convert value to the canonical lexical form as defined in [[JCS]] + convert value to the canonical lexical form using the result of transforming the internal representation of value - to JSON and set datatype to jsonld:JSON. -
      JCS is still in draft form, and normatively requiring - JSON canonicalization may be removed in a future draft, or - a JSON-LD specific canonicalization form may be defined.
    6. + 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.
    7. If value is true or false, set value to the string true or false which is the @@ -4583,7 +4584,7 @@

      Overview

      value objects whereas IRIs and blank node identifiers are transformed to node objects. - Literals with datatype jsonld:JSON + 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]], @@ -4679,10 +4680,9 @@

      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 JSON, 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]] - and [[JCS]]. + representation as defined in [[XMLSCHEMA11-2]].

      The canonical lexical form of an integer, i.e., a number with no non-zero fractional part or a number @@ -4735,11 +4735,33 @@

      Data Round Tripping

      true and false.

      The canonical lexical form of the JSON literal - values are defined in [[JCS]]. The internal representation - of value objects having @type @json are converted to JSON - and canonicalized to reduce unnecessary whitespace, - order object members, and use a standard representation - for strings and numbers.

      + values are 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 Boolean and Numeric values SHOULD be serialized as described elsewhere in this section + for deserializing JSON-LD to RDF,
      • +
      • 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.

      -

      JCS is still in draft form, and normatively requiring - JSON canonicalization may be removed in a future draft, or - a JSON-LD specific canonicalization form may be defined.

      -

      When JSON-native numbers are deserialized to RDF, lossless data round-tripping cannot be guaranteed, as rounding errors might occur. When diff --git a/tests/fromRdf-manifest.jsonld b/tests/fromRdf-manifest.jsonld index ca5f37f2..4a04c921 100644 --- a/tests/fromRdf-manifest.jsonld +++ b/tests/fromRdf-manifest.jsonld @@ -199,7 +199,7 @@ "@id": "#tjs01", "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], "name": "JSON literal (boolean true)", - "purpose": "Tests creating property with rdf:type jsonld:JSON to a 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"} @@ -207,7 +207,7 @@ "@id": "#tjs02", "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], "name": "JSON literal (boolean false)", - "purpose": "Tests creating property with rdf:type jsonld:JSON to a 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"} @@ -215,7 +215,7 @@ "@id": "#tjs03", "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], "name": "JSON literal (double)", - "purpose": "Tests creating property with rdf:type jsonld:JSON to a 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"} @@ -223,7 +223,7 @@ "@id": "#tjs04", "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], "name": "JSON literal (double-zero)", - "purpose": "Tests creating property with rdf:type jsonld:JSON to a 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"} @@ -231,7 +231,7 @@ "@id": "#tjs05", "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], "name": "JSON literal (integer)", - "purpose": "Tests creating property with rdf:type jsonld:JSON to a 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"} @@ -239,7 +239,7 @@ "@id": "#tjs06", "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], "name": "JSON literal (object)", - "purpose": "Tests creating property with rdf:type jsonld:JSON to a 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"} @@ -247,7 +247,7 @@ "@id": "#tjs07", "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], "name": "JSON literal (array)", - "purpose": "Tests creating property with rdf:type jsonld:JSON to a 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"} diff --git a/tests/fromRdf/js01-in.nq b/tests/fromRdf/js01-in.nq index 9f82b6ac..49b72920 100644 --- a/tests/fromRdf/js01-in.nq +++ b/tests/fromRdf/js01-in.nq @@ -1 +1 @@ - "true"^^ . \ No newline at end of file + "true"^^ . \ No newline at end of file diff --git a/tests/fromRdf/js02-in.nq b/tests/fromRdf/js02-in.nq index 6edec473..f88e0fa6 100644 --- a/tests/fromRdf/js02-in.nq +++ b/tests/fromRdf/js02-in.nq @@ -1 +1 @@ - "false"^^ . \ No newline at end of file + "false"^^ . \ No newline at end of file diff --git a/tests/fromRdf/js03-in.nq b/tests/fromRdf/js03-in.nq index e6f99b6a..83f070a5 100644 --- a/tests/fromRdf/js03-in.nq +++ b/tests/fromRdf/js03-in.nq @@ -1 +1 @@ - "1.23"^^ . \ No newline at end of file + "1.23"^^ . \ No newline at end of file diff --git a/tests/fromRdf/js04-in.nq b/tests/fromRdf/js04-in.nq index 119b97a5..cd8145ef 100644 --- a/tests/fromRdf/js04-in.nq +++ b/tests/fromRdf/js04-in.nq @@ -1 +1 @@ - "0"^^ . \ No newline at end of file + "0"^^ . \ No newline at end of file diff --git a/tests/fromRdf/js05-in.nq b/tests/fromRdf/js05-in.nq index b3abebc1..063dda24 100644 --- a/tests/fromRdf/js05-in.nq +++ b/tests/fromRdf/js05-in.nq @@ -1 +1 @@ - "123"^^ . \ No newline at end of file + "123"^^ . \ No newline at end of file diff --git a/tests/fromRdf/js06-in.nq b/tests/fromRdf/js06-in.nq index ef8ddedf..498c22b0 100644 --- a/tests/fromRdf/js06-in.nq +++ b/tests/fromRdf/js06-in.nq @@ -1 +1 @@ - "{\"foo\":\"bar\"}"^^ . \ No newline at end of file + "{\"foo\":\"bar\"}"^^ . \ No newline at end of file diff --git a/tests/fromRdf/js07-in.nq b/tests/fromRdf/js07-in.nq index f991e6e6..257f4b0a 100644 --- a/tests/fromRdf/js07-in.nq +++ b/tests/fromRdf/js07-in.nq @@ -1 +1 @@ - "[{\"foo\":\"bar\"}]"^^ . \ No newline at end of file + "[{\"foo\":\"bar\"}]"^^ . \ No newline at end of file diff --git a/tests/toRdf/js01-out.nq b/tests/toRdf/js01-out.nq index 8ce606b4..bac18733 100644 --- a/tests/toRdf/js01-out.nq +++ b/tests/toRdf/js01-out.nq @@ -1 +1 @@ -_:b0 "true"^^ . \ No newline at end of file +_:b0 "true"^^ . \ No newline at end of file diff --git a/tests/toRdf/js02-out.nq b/tests/toRdf/js02-out.nq index ee67b67d..7bb8fd1f 100644 --- a/tests/toRdf/js02-out.nq +++ b/tests/toRdf/js02-out.nq @@ -1 +1 @@ -_:b0 "false"^^ . \ No newline at end of file +_:b0 "false"^^ . \ No newline at end of file diff --git a/tests/toRdf/js03-out.nq b/tests/toRdf/js03-out.nq index d980c079..80013ecf 100644 --- a/tests/toRdf/js03-out.nq +++ b/tests/toRdf/js03-out.nq @@ -1 +1 @@ -_:b0 "1.23"^^ . \ No newline at end of file +_:b0 "1.23E0"^^ . \ No newline at end of file diff --git a/tests/toRdf/js04-out.nq b/tests/toRdf/js04-out.nq index e35f67bb..1172726d 100644 --- a/tests/toRdf/js04-out.nq +++ b/tests/toRdf/js04-out.nq @@ -1 +1 @@ -_:b0 "0"^^ . \ No newline at end of file +_:b0 "0"^^ . \ No newline at end of file diff --git a/tests/toRdf/js05-out.nq b/tests/toRdf/js05-out.nq index 911ee059..d8c47b46 100644 --- a/tests/toRdf/js05-out.nq +++ b/tests/toRdf/js05-out.nq @@ -1 +1 @@ -_:b0 "123"^^ . \ No newline at end of file +_:b0 "123"^^ . \ No newline at end of file diff --git a/tests/toRdf/js06-out.nq b/tests/toRdf/js06-out.nq index 34d732cb..4909a3d6 100644 --- a/tests/toRdf/js06-out.nq +++ b/tests/toRdf/js06-out.nq @@ -1 +1 @@ -_:b0 "{\"foo\":\"bar\"}"^^ . \ No newline at end of file +_:b0 "{\"foo\":\"bar\"}"^^ . \ No newline at end of file diff --git a/tests/toRdf/js07-out.nq b/tests/toRdf/js07-out.nq index 988c2dfe..f2ef8961 100644 --- a/tests/toRdf/js07-out.nq +++ b/tests/toRdf/js07-out.nq @@ -1 +1 @@ -_:b0 "[{\"foo\":\"bar\"}]"^^ . \ No newline at end of file +_:b0 "[{\"foo\":\"bar\"}]"^^ . \ No newline at end of file diff --git a/tests/toRdf/js08-out.nq b/tests/toRdf/js08-out.nq index c1e1e846..b27b6b7d 100644 --- a/tests/toRdf/js08-out.nq +++ b/tests/toRdf/js08-out.nq @@ -1 +1 @@ -_:b0 "[56,{\"1\":[],\"10\":null,\"d\":true}]"^^ . \ No newline at end of file +_:b0 "[56,{\"1\":[],\"10\":null,\"d\":true}]"^^ . \ No newline at end of file diff --git a/tests/toRdf/js09-out.nq b/tests/toRdf/js09-out.nq index ad11368b..aedbd732 100644 --- a/tests/toRdf/js09-out.nq +++ b/tests/toRdf/js09-out.nq @@ -1 +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 +_: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-out.nq b/tests/toRdf/js10-out.nq index f95aa9ff..055426c8 100644 --- a/tests/toRdf/js10-out.nq +++ b/tests/toRdf/js10-out.nq @@ -1 +1 @@ -_:b0 "{\"\":\"empty\",\"1\":{\" \":56,\"f\":{\"F\":5,\"f\":\"hi\"}},\"10\":{},\"111\":[{\"E\":\"no\",\"e\":\"yes\"}],\"A\":{},\"a\":{}}"^^ . \ No newline at end of file +_: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-out.nq b/tests/toRdf/js11-out.nq index 1c203dd3..0d41a89d 100644 --- a/tests/toRdf/js11-out.nq +++ b/tests/toRdf/js11-out.nq @@ -1 +1 @@ -_:b0 "{\"Unnormalized Unicode\":\"Å\"}"^^ . \ No newline at end of file +_:b0 "{\"Unnormalized Unicode\":\"Å\"}"^^ . \ No newline at end of file diff --git a/tests/toRdf/js12-in.jsonld b/tests/toRdf/js12-in.jsonld index 325b874a..e1b58238 100644 --- a/tests/toRdf/js12-in.jsonld +++ b/tests/toRdf/js12-in.jsonld @@ -4,7 +4,7 @@ "e": {"@id": "http://example.org/vocab#c14n", "@type": "@json"} }, "e": { - "numbers": [333333333.33333329, 1E30, 4.50, 2e-3, 0.000000000000000000000000001], + "numbers": [333333333.333333, 1E20, 4.50, 2e-3, 0.000000000000000000000000001], "string": "\u20ac$\u000F\u000aA'\u0042\u0022\u005c\\\"\/", "literals": [null, true, false] } diff --git a/tests/toRdf/js12-out.nq b/tests/toRdf/js12-out.nq index 3703020c..28d4c049 100644 --- a/tests/toRdf/js12-out.nq +++ b/tests/toRdf/js12-out.nq @@ -1 +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 +_:b0 "{\"literals\":[null,true,false],\"numbers\":[3.33333333333333E8,100000000000000000000,4.5E0,2.0E-3,1.0E-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 index 02fa45e5..dc476ae9 100644 --- a/tests/toRdf/js13-in.jsonld +++ b/tests/toRdf/js13-in.jsonld @@ -11,7 +11,6 @@ "\u0080": "Control\u007f", "\ud83d\ude02": "Smiley", "\u00f6": "Latin Small Letter O With Diaeresis", - "\ufb33": "Hebrew Letter Dalet With Dagesh", "": "Browser Challenge" } } \ No newline at end of file diff --git a/tests/toRdf/js13-out.nq b/tests/toRdf/js13-out.nq index d40d875c..f0fc6770 100644 --- a/tests/toRdf/js13-out.nq +++ b/tests/toRdf/js13-out.nq @@ -1 +1 @@ -_:b0 "{\"\\n\":\"Newline\",\"\\r\":\"Carriage Return\",\"1\":\"One\",\"\":\"Browser Challenge\",\"€\":\"Control\",\"ö\":\"Latin Small Letter O With Diaeresis\",\"€\":\"Euro Sign\",\"😂\":\"Smiley\",\"דּ\":\"Hebrew Letter Dalet With Dagesh\"}"^^ . \ No newline at end of file +_: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 From 353f804a8b9d77447934b1c4fe86f2571bb3743a Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sun, 24 Mar 2019 15:21:13 -0700 Subject: [PATCH 6/8] Fix JSON literal example and update Gemfile. --- Gemfile.lock | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3a35e566..23a52ef7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/ruby-rdf/json-ld.git - revision: 2a11745bc50eab0d5a4c5c3a5cd98b840176896e + revision: 6f4b20de173ef27ff3959f5206b9a7cb813ecde7 branch: develop specs: json-ld (3.0.2) diff --git a/index.html b/index.html index 4d3fdec8..26d22fb0 100644 --- a/index.html +++ b/index.html @@ -4796,7 +4796,7 @@

      Data Round Tripping

      data-to-rdf> From fe329e5d0ebcb2e95d40e69b818080a3f322f569 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 25 Mar 2019 10:04:37 -0700 Subject: [PATCH 7/8] Use ECMASCRIPT number serialization for serializing JSON numerics. --- common/jsonld.js | 2 +- index.html | 8 ++++---- tests/toRdf/js03-out.nq | 2 +- tests/toRdf/js12-in.jsonld | 2 +- tests/toRdf/js12-out.nq | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) 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/index.html b/index.html index 26d22fb0..f164b3c7 100644 --- a/index.html +++ b/index.html @@ -4742,8 +4742,8 @@

      Data Round Tripping

      • Serialize JSON using no unnecessary whitespace,
      • Keys in objects SHOULD be ordered lexicographically,
      • -
      • Native Boolean and Numeric values SHOULD be serialized as described elsewhere in this section - for deserializing JSON-LD to RDF,
      • +
      • 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, @@ -4770,7 +4770,7 @@

        Data Round Tripping

        { "@context": { "@version": 1.1, - "e": {"@id": "http://example.org/vocab#c14n", ****"@type": "@json"****} + "e": {"@id": "http://example.org/vocab#json", ****"@type": "@json"****} }, "e": ****[ 56.0, @@ -4797,7 +4797,7 @@

        Data Round Tripping

        diff --git a/tests/toRdf/js03-out.nq b/tests/toRdf/js03-out.nq index 80013ecf..1fbd15a4 100644 --- a/tests/toRdf/js03-out.nq +++ b/tests/toRdf/js03-out.nq @@ -1 +1 @@ -_:b0 "1.23E0"^^ . \ No newline at end of file +_:b0 "1.23"^^ . \ No newline at end of file diff --git a/tests/toRdf/js12-in.jsonld b/tests/toRdf/js12-in.jsonld index e1b58238..325b874a 100644 --- a/tests/toRdf/js12-in.jsonld +++ b/tests/toRdf/js12-in.jsonld @@ -4,7 +4,7 @@ "e": {"@id": "http://example.org/vocab#c14n", "@type": "@json"} }, "e": { - "numbers": [333333333.333333, 1E20, 4.50, 2e-3, 0.000000000000000000000000001], + "numbers": [333333333.33333329, 1E30, 4.50, 2e-3, 0.000000000000000000000000001], "string": "\u20ac$\u000F\u000aA'\u0042\u0022\u005c\\\"\/", "literals": [null, true, false] } diff --git a/tests/toRdf/js12-out.nq b/tests/toRdf/js12-out.nq index 28d4c049..1c5d73f9 100644 --- a/tests/toRdf/js12-out.nq +++ b/tests/toRdf/js12-out.nq @@ -1 +1 @@ -_:b0 "{\"literals\":[null,true,false],\"numbers\":[3.33333333333333E8,100000000000000000000,4.5E0,2.0E-3,1.0E-27],\"string\":\"€$\\u000f\\nA'B\\\"\\\\\\\\\\\"/\"}"^^ . \ No newline at end of file +_: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 From 64a3fe46d042a7a8a61e9ae7aaee806e551dc1bb Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 26 Mar 2019 15:39:01 -0700 Subject: [PATCH 8/8] Fix some HTML and sync common files. --- common/extract-examples.rb | 5 +++++ common/terms.html | 2 +- index.html | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) 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/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 f164b3c7..7a4e115c 100644 --- a/index.html +++ b/index.html @@ -4734,8 +4734,8 @@

        Data Round Tripping

        values true and false are the strings true and false.

        -

        The canonical lexical form of the JSON literal - values are non-normative, as a normative recommendation for +

        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:

        @@ -4761,7 +4761,7 @@

        Data Round Tripping

        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. + as the specifics of serialization may change in a future revison of this document.