diff --git a/tests/compact-manifest.html b/tests/compact-manifest.html index 6e453394..546105f2 100644 --- a/tests/compact-manifest.html +++ b/tests/compact-manifest.html @@ -4805,6 +4805,38 @@

+
+ Test tej01 Multiple JSON values for a JSON literal properties +
+
+
+
id
+
#tej01
+
Type
+
jld:NegativeEvaluationTest, jld:CompactTest
+
Purpose
+
Tests compacting multiple JSON values for a JSON literal property.
+
input
+
+ compact/ej01-in.jsonld +
+
context
+
+ compact/ej01-context.jsonld +
+
expect
+
+ multiple JSON literals +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
Test tin01 Basic Included array
@@ -5317,6 +5349,166 @@

+
+ Test tjs12 Compact JSON literal (empty array) +
+
+
+
id
+
#tjs12
+
Type
+
jld:PositiveEvaluationTest, jld:CompactTest
+
Purpose
+
Tests compacting property with @type @json to a JSON literal (empty array).
+
input
+
+ compact/js12-in.jsonld +
+
context
+
+ compact/js12-context.jsonld +
+
expect
+
+ compact/js12-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs13 Compact JSON literal (array with string) +
+
+
+
id
+
#tjs13
+
Type
+
jld:PositiveEvaluationTest, jld:CompactTest
+
Purpose
+
Tests compacting property with @type @json to a JSON literal (array with string).
+
input
+
+ compact/js13-in.jsonld +
+
context
+
+ compact/js13-context.jsonld +
+
expect
+
+ compact/js13-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs14 Compact JSON literal and non-JSON with @json property +
+
+
+
id
+
#tjs14
+
Type
+
jld:PositiveEvaluationTest, jld:CompactTest
+
Purpose
+
Tests compacting property with @type @json with JSON literal and non-JSON.
+
input
+
+ compact/js14-in.jsonld +
+
context
+
+ compact/js14-context.jsonld +
+
expect
+
+ compact/js14-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs15 Compact JSON literal and non-JSON without @json property +
+
+
+
id
+
#tjs15
+
Type
+
jld:PositiveEvaluationTest, jld:CompactTest
+
Purpose
+
Tests compacting property without @type @json with JSON literal and non-JSON.
+
input
+
+ compact/js15-in.jsonld +
+
context
+
+ compact/js15-context.jsonld +
+
expect
+
+ compact/js15-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs16 Compact JSON literal and non-JSON with and without @json property +
+
+
+
id
+
#tjs16
+
Type
+
jld:PositiveEvaluationTest, jld:CompactTest
+
Purpose
+
Tests compacting property with and without @type @json with JSON literal and non-JSON.
+
input
+
+ compact/js16-in.jsonld +
+
context
+
+ compact/js16-context.jsonld +
+
expect
+
+ compact/js16-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
Test tla01 most specific term matching in @list.
diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index 0743df70..c5d9c4e4 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -1405,6 +1405,15 @@ "input": "compact/ep15-in.jsonld", "context": "compact/ep15-context.jsonld", "expectErrorCode": "invalid container mapping" + }, { + "@id": "#tej01", + "@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"], + "name": "Multiple JSON values for a JSON literal properties", + "purpose": "Tests compacting multiple JSON values for a JSON literal property.", + "input": "compact/ej01-in.jsonld", + "context": "compact/ej01-context.jsonld", + "expectErrorCode": "multiple JSON literals", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tin01", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], @@ -1549,6 +1558,51 @@ "context": "compact/js11-context.jsonld", "expect": "compact/js11-out.jsonld", "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs12", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact JSON literal (empty array)", + "purpose": "Tests compacting property with @type @json to a JSON literal (empty array).", + "input": "compact/js12-in.jsonld", + "context": "compact/js12-context.jsonld", + "expect": "compact/js12-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs13", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact JSON literal (array with string)", + "purpose": "Tests compacting property with @type @json to a JSON literal (array with string).", + "input": "compact/js13-in.jsonld", + "context": "compact/js13-context.jsonld", + "expect": "compact/js13-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs14", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact JSON literal and non-JSON with @json property", + "purpose": "Tests compacting property with @type @json with JSON literal and non-JSON.", + "input": "compact/js14-in.jsonld", + "context": "compact/js14-context.jsonld", + "expect": "compact/js14-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs15", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact JSON literal and non-JSON without @json property", + "purpose": "Tests compacting property without @type @json with JSON literal and non-JSON.", + "input": "compact/js15-in.jsonld", + "context": "compact/js15-context.jsonld", + "expect": "compact/js15-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs16", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact JSON literal and non-JSON with and without @json property", + "purpose": "Tests compacting property with and without @type @json with JSON literal and non-JSON.", + "input": "compact/js16-in.jsonld", + "context": "compact/js16-context.jsonld", + "expect": "compact/js16-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tla01", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], diff --git a/tests/compact/ej01-context.jsonld b/tests/compact/ej01-context.jsonld new file mode 100644 index 00000000..46787e1d --- /dev/null +++ b/tests/compact/ej01-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "http://example.org/vocab#value", "@type": "@json"} + } +} diff --git a/tests/compact/ej01-in.jsonld b/tests/compact/ej01-in.jsonld new file mode 100644 index 00000000..590f51ae --- /dev/null +++ b/tests/compact/ej01-in.jsonld @@ -0,0 +1,9 @@ +[{ + "http://example.org/vocab#value": [{ + "@value": ["JSON1"], + "@type": "@json" + }, { + "@value": ["JSON2"], + "@type": "@json" + }] +}] diff --git a/tests/compact/js07-out.jsonld b/tests/compact/js07-out.jsonld index d4e7c2cb..bd557c0b 100644 --- a/tests/compact/js07-out.jsonld +++ b/tests/compact/js07-out.jsonld @@ -3,5 +3,5 @@ "@version": 1.1, "e": {"@id": "http://example.org/vocab#array", "@type": "@json", "@container": "@set"} }, - "e": [{"foo": "bar"}] -} \ No newline at end of file + "e": [[{"foo": "bar"}]] +} diff --git a/tests/compact/js12-context.jsonld b/tests/compact/js12-context.jsonld new file mode 100644 index 00000000..46787e1d --- /dev/null +++ b/tests/compact/js12-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "http://example.org/vocab#value", "@type": "@json"} + } +} diff --git a/tests/compact/js12-in.jsonld b/tests/compact/js12-in.jsonld new file mode 100644 index 00000000..33e2be76 --- /dev/null +++ b/tests/compact/js12-in.jsonld @@ -0,0 +1,6 @@ +[{ + "http://example.org/vocab#value": [{ + "@value": ["string"], + "@type": "@json" + }] +}] diff --git a/tests/compact/js12-out.jsonld b/tests/compact/js12-out.jsonld new file mode 100644 index 00000000..2e680bce --- /dev/null +++ b/tests/compact/js12-out.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "http://example.org/vocab#value", "@type": "@json"} + }, + "e": ["string"] +} diff --git a/tests/compact/js13-context.jsonld b/tests/compact/js13-context.jsonld new file mode 100644 index 00000000..46787e1d --- /dev/null +++ b/tests/compact/js13-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "http://example.org/vocab#value", "@type": "@json"} + } +} diff --git a/tests/compact/js13-in.jsonld b/tests/compact/js13-in.jsonld new file mode 100644 index 00000000..6cdd158e --- /dev/null +++ b/tests/compact/js13-in.jsonld @@ -0,0 +1,6 @@ +[{ + "http://example.org/vocab#value": [{ + "@value": [], + "@type": "@json" + }] +}] diff --git a/tests/compact/js13-out.jsonld b/tests/compact/js13-out.jsonld new file mode 100644 index 00000000..4b889432 --- /dev/null +++ b/tests/compact/js13-out.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "http://example.org/vocab#value", "@type": "@json"} + }, + "e": [] +} diff --git a/tests/compact/js14-context.jsonld b/tests/compact/js14-context.jsonld new file mode 100644 index 00000000..46787e1d --- /dev/null +++ b/tests/compact/js14-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "http://example.org/vocab#value", "@type": "@json"} + } +} diff --git a/tests/compact/js14-in.jsonld b/tests/compact/js14-in.jsonld new file mode 100644 index 00000000..9255f815 --- /dev/null +++ b/tests/compact/js14-in.jsonld @@ -0,0 +1,8 @@ +[{ + "http://example.org/vocab#value": [{ + "@value": [], + "@type": "@json" + }, + "non-JSON" + ] +}] diff --git a/tests/compact/js14-out.jsonld b/tests/compact/js14-out.jsonld new file mode 100644 index 00000000..6ef179b8 --- /dev/null +++ b/tests/compact/js14-out.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "http://example.org/vocab#value", "@type": "@json"} + }, + "e": [], + "http://example.org/vocab#value": "non-JSON" +} diff --git a/tests/compact/js15-context.jsonld b/tests/compact/js15-context.jsonld new file mode 100644 index 00000000..96b097d0 --- /dev/null +++ b/tests/compact/js15-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "http://example.org/vocab#value"} + } +} diff --git a/tests/compact/js15-in.jsonld b/tests/compact/js15-in.jsonld new file mode 100644 index 00000000..9255f815 --- /dev/null +++ b/tests/compact/js15-in.jsonld @@ -0,0 +1,8 @@ +[{ + "http://example.org/vocab#value": [{ + "@value": [], + "@type": "@json" + }, + "non-JSON" + ] +}] diff --git a/tests/compact/js15-out.jsonld b/tests/compact/js15-out.jsonld new file mode 100644 index 00000000..fd291ac2 --- /dev/null +++ b/tests/compact/js15-out.jsonld @@ -0,0 +1,13 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "http://example.org/vocab#value"} + }, + "e": [ + { + "@type": "@json", + "@value": [] + }, + "non-JSON" + ] +} diff --git a/tests/compact/js16-context.jsonld b/tests/compact/js16-context.jsonld new file mode 100644 index 00000000..6a0627d9 --- /dev/null +++ b/tests/compact/js16-context.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "e-json": {"@id": "http://example.org/vocab#value", "@type": "@json"}, + "e-non-json": {"@id": "http://example.org/vocab#value"} + } +} diff --git a/tests/compact/js16-in.jsonld b/tests/compact/js16-in.jsonld new file mode 100644 index 00000000..9255f815 --- /dev/null +++ b/tests/compact/js16-in.jsonld @@ -0,0 +1,8 @@ +[{ + "http://example.org/vocab#value": [{ + "@value": [], + "@type": "@json" + }, + "non-JSON" + ] +}] diff --git a/tests/compact/js16-out.jsonld b/tests/compact/js16-out.jsonld new file mode 100644 index 00000000..e2f6fb89 --- /dev/null +++ b/tests/compact/js16-out.jsonld @@ -0,0 +1,9 @@ +{ + "@context": { + "@version": 1.1, + "e-json": {"@id": "http://example.org/vocab#value", "@type": "@json"}, + "e-non-json": {"@id": "http://example.org/vocab#value"} + }, + "e-json": [], + "e-non-json": "non-JSON" +} diff --git a/tests/expand-manifest.html b/tests/expand-manifest.html index 85a273e9..35df2f1f 100644 --- a/tests/expand-manifest.html +++ b/tests/expand-manifest.html @@ -6025,6 +6025,69 @@

+
+ Test ter57 Array not found for @json @set. +
+
+
+
id
+
#ter57
+
Type
+
jld:NegativeEvaluationTest, jld:ExpandTest
+
Purpose
+
The value for a @json @set term MUST be an array.
+
input
+
+ expand/er57-in.jsonld +
+
expect
+
+ invalid set or list object +
+
+
+
+ Test ter58 Array not found for @json @set. +
+
+
+
id
+
#ter58
+
Type
+
jld:NegativeEvaluationTest, jld:ExpandTest
+
Purpose
+
The value for a @json @set term MUST be an array.
+
input
+
+ expand/er57-in.jsonld +
+
expect
+
+ invalid set or list object +
+
+
+
+ Test ter58 Array not found for @json @list. +
+
+
+
id
+
#ter58
+
Type
+
jld:NegativeEvaluationTest, jld:ExpandTest
+
Purpose
+
The value for a @json @list term MUST be an array.
+
input
+
+ expand/er58-in.jsonld +
+
expect
+
+ invalid set or list object +
+
+
Test tes01 Using an array value for @context is illegal in JSON-LD 1.0
@@ -6979,6 +7042,202 @@

+
+ Test tjs24 Expand JSON literal (one JSON literal). +
+
+
+
id
+
#tjs24
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Tests expanding property with @type @json (one JSON literal).
+
input
+
+ expand/js24-in.jsonld +
+
expect
+
+ expand/js24-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs25 Expand JSON literal (two JSON literals). +
+
+
+
id
+
#tjs25
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Tests expanding property with @type @json (two JSON literals).
+
input
+
+ expand/js25-in.jsonld +
+
expect
+
+ expand/js25-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs26 Expand JSON literal (JSON literal and non-JSON). +
+
+
+
id
+
#tjs26
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Tests expanding property with @type @json (JSON literal and non-JSON).
+
input
+
+ expand/js26-in.jsonld +
+
expect
+
+ expand/js26-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs27 Expand JSON literal (duplicate JSON literals). +
+
+
+
id
+
#tjs27
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Tests expanding property with @type @json (dupcliate JSON literals).
+
input
+
+ expand/js27-in.jsonld +
+
expect
+
+ expand/js27-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs28 Expand array-like value with @json and no @set/@list in @context. +
+
+
+
id
+
#tjs28
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Tests expanding array-like value with @json and no @set/@list in @context.
+
input
+
+ expand/js28-in.jsonld +
+
expect
+
+ expand/js28-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs29 Expand array-like value with @json and @set in @context. +
+
+
+
id
+
#tjs29
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Tests expanding array-like value with @json and @set in @context.
+
input
+
+ expand/js29-in.jsonld +
+
expect
+
+ expand/js29-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs30 Expand array-like value with @json and @list in @context. +
+
+
+
id
+
#tjs30
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Tests expanding array-like value with @json and @list in @context.
+
input
+
+ expand/js30-in.jsonld +
+
expect
+
+ expand/js30-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
Test tl001 Language map with null value
diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 12cb3993..79be31a2 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -1826,6 +1826,27 @@ "purpose": "Verifies that an exception is raised when attempting to redefine @context.", "input": "expand/er56-in.jsonld", "expectErrorCode": "keyword redefinition" + }, { + "@id": "#ter57", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Array not found for @json @set.", + "purpose": "The value for a @json @set term MUST be an array.", + "input": "expand/er57-in.jsonld", + "expectErrorCode": "invalid set or list object" + }, { + "@id": "#ter58", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Array not found for @json @set.", + "purpose": "The value for a @json @set term MUST be an array.", + "input": "expand/er57-in.jsonld", + "expectErrorCode": "invalid set or list object" + }, { + "@id": "#ter58", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Array not found for @json @list.", + "purpose": "The value for a @json @list term MUST be an array.", + "input": "expand/er58-in.jsonld", + "expectErrorCode": "invalid set or list object" }, { "@id": "#tes01", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], @@ -2098,6 +2119,62 @@ "input": "expand/js23-in.jsonld", "expect": "expand/js23-out.jsonld", "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs24", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand JSON literal (one JSON literal).", + "purpose": "Tests expanding property with @type @json (one JSON literal).", + "input": "expand/js24-in.jsonld", + "expect": "expand/js24-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs25", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand JSON literal (two JSON literals).", + "purpose": "Tests expanding property with @type @json (two JSON literals).", + "input": "expand/js25-in.jsonld", + "expect": "expand/js25-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs26", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand JSON literal (JSON literal and non-JSON).", + "purpose": "Tests expanding property with @type @json (JSON literal and non-JSON).", + "input": "expand/js26-in.jsonld", + "expect": "expand/js26-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs27", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand JSON literal (duplicate JSON literals).", + "purpose": "Tests expanding property with @type @json (dupcliate JSON literals).", + "input": "expand/js27-in.jsonld", + "expect": "expand/js27-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs28", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand array-like value with @json and no @set/@list in @context.", + "purpose": "Tests expanding array-like value with @json and no @set/@list in @context.", + "input": "expand/js28-in.jsonld", + "expect": "expand/js28-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs29", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand array-like value with @json and @set in @context.", + "purpose": "Tests expanding array-like value with @json and @set in @context.", + "input": "expand/js29-in.jsonld", + "expect": "expand/js29-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs30", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand array-like value with @json and @list in @context.", + "purpose": "Tests expanding array-like value with @json and @list in @context.", + "input": "expand/js30-in.jsonld", + "expect": "expand/js30-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tl001", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/er57-in.jsonld b/tests/expand/er57-in.jsonld new file mode 100644 index 00000000..07e6339b --- /dev/null +++ b/tests/expand/er57-in.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "prop": { + "@id": "ex:prop", + "@type": "@json", + "@container": "@set" + } + }, + "prop": "value" +} diff --git a/tests/expand/er58-in.jsonld b/tests/expand/er58-in.jsonld new file mode 100644 index 00000000..90091bf2 --- /dev/null +++ b/tests/expand/er58-in.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "prop": { + "@id": "ex:prop", + "@type": "@json", + "@container": "@list" + } + }, + "prop": "value" +} + diff --git a/tests/expand/js24-in.jsonld b/tests/expand/js24-in.jsonld new file mode 100644 index 00000000..e62286bf --- /dev/null +++ b/tests/expand/js24-in.jsonld @@ -0,0 +1,3 @@ +{ + "http://example.org/vocab#null": {"@value": ["JSON"], "@type": "@json"} +} diff --git a/tests/expand/js24-out.jsonld b/tests/expand/js24-out.jsonld new file mode 100644 index 00000000..a0a7348b --- /dev/null +++ b/tests/expand/js24-out.jsonld @@ -0,0 +1,8 @@ +[{ + "http://example.org/vocab#null": [{ + "@type": "@json", + "@value": [ + "JSON" + ] + }] +}] diff --git a/tests/expand/js25-in.jsonld b/tests/expand/js25-in.jsonld new file mode 100644 index 00000000..84ff724c --- /dev/null +++ b/tests/expand/js25-in.jsonld @@ -0,0 +1,6 @@ +{ + "http://example.org/vocab#value": [ + {"@value": ["JSON1"], "@type": "@json"}, + {"@value": ["JSON2"], "@type": "@json"} + ] +} diff --git a/tests/expand/js25-out.jsonld b/tests/expand/js25-out.jsonld new file mode 100644 index 00000000..6e6ff887 --- /dev/null +++ b/tests/expand/js25-out.jsonld @@ -0,0 +1,13 @@ +[{ + "http://example.org/vocab#value": [{ + "@type": "@json", + "@value": [ + "JSON1" + ] + }, { + "@type": "@json", + "@value": [ + "JSON2" + ] + }] +}] diff --git a/tests/expand/js26-in.jsonld b/tests/expand/js26-in.jsonld new file mode 100644 index 00000000..3f11042f --- /dev/null +++ b/tests/expand/js26-in.jsonld @@ -0,0 +1,6 @@ +{ + "http://example.org/vocab#value": [ + {"@value": ["JSON"], "@type": "@json"}, + {"@value": "non-JSON"} + ] +} diff --git a/tests/expand/js26-out.jsonld b/tests/expand/js26-out.jsonld new file mode 100644 index 00000000..6251d232 --- /dev/null +++ b/tests/expand/js26-out.jsonld @@ -0,0 +1,10 @@ +[{ + "http://example.org/vocab#value": [{ + "@type": "@json", + "@value": [ + "JSON" + ] + }, { + "@value": "non-JSON" + }] +}] diff --git a/tests/expand/js27-in.jsonld b/tests/expand/js27-in.jsonld new file mode 100644 index 00000000..9d479f74 --- /dev/null +++ b/tests/expand/js27-in.jsonld @@ -0,0 +1,6 @@ +{ + "http://example.org/vocab#value": [ + {"@value": ["dup"], "@type": "@json"}, + {"@value": ["dup"], "@type": "@json"} + ] +} diff --git a/tests/expand/js27-out.jsonld b/tests/expand/js27-out.jsonld new file mode 100644 index 00000000..5e15b03c --- /dev/null +++ b/tests/expand/js27-out.jsonld @@ -0,0 +1,13 @@ +[{ + "http://example.org/vocab#value": [{ + "@type": "@json", + "@value": [ + "dup" + ] + }, { + "@type": "@json", + "@value": [ + "dup" + ] + }] +}] diff --git a/tests/expand/js28-in.jsonld b/tests/expand/js28-in.jsonld new file mode 100644 index 00000000..8a10ef58 --- /dev/null +++ b/tests/expand/js28-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "ex:e", "@type": "@json"} + }, + "e": ["v1", "v2"] +} diff --git a/tests/expand/js28-out.jsonld b/tests/expand/js28-out.jsonld new file mode 100644 index 00000000..48880690 --- /dev/null +++ b/tests/expand/js28-out.jsonld @@ -0,0 +1,13 @@ +[ + { + "ex:e": [ + { + "@type": "@json", + "@value": [ + "v1", + "v2" + ] + } + ] + } +] diff --git a/tests/expand/js29-in.jsonld b/tests/expand/js29-in.jsonld new file mode 100644 index 00000000..a06649ee --- /dev/null +++ b/tests/expand/js29-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "ex:e", "@type": "@json", "@container": "@set"} + }, + "e": ["v1", "v2"] +} diff --git a/tests/expand/js29-out.jsonld b/tests/expand/js29-out.jsonld new file mode 100644 index 00000000..55f2348b --- /dev/null +++ b/tests/expand/js29-out.jsonld @@ -0,0 +1,14 @@ +[ + { + "ex:e": [ + { + "@type": "@json", + "@value": "v1" + }, + { + "@type": "@json", + "@value": "v2" + } + ] + } +] diff --git a/tests/expand/js30-in.jsonld b/tests/expand/js30-in.jsonld new file mode 100644 index 00000000..aaa153d2 --- /dev/null +++ b/tests/expand/js30-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "ex:e", "@type": "@json", "@container": "@list"} + }, + "e": ["v1", "v2"] +} diff --git a/tests/expand/js30-out.jsonld b/tests/expand/js30-out.jsonld new file mode 100644 index 00000000..47e6e973 --- /dev/null +++ b/tests/expand/js30-out.jsonld @@ -0,0 +1,18 @@ +[ + { + "ex:e": [ + { + "@list": [ + { + "@type": "@json", + "@value": "v1" + }, + { + "@type": "@json", + "@value": "v2" + } + ] + } + ] + } +] diff --git a/tests/fromRdf-manifest.html b/tests/fromRdf-manifest.html index ca803b4b..b0128020 100644 --- a/tests/fromRdf-manifest.html +++ b/tests/fromRdf-manifest.html @@ -1324,6 +1324,62 @@

+
+ Test tjs12 JSON literals (strings) +
+
+
+
id
+
#tjs12
+
Type
+
jld:PositiveEvaluationTest, jld:FromRDFTest
+
Purpose
+
Tests creating property with multiple rdf:type rdf:JSON to a JSON literal (null).
+
input
+
+ fromRdf/js12-in.nq +
+
expect
+
+ fromRdf/js12-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+ Test tjs13 Mixed JSON literals and non-JSON +
+
+
+
id
+
#tjs13
+
Type
+
jld:PositiveEvaluationTest, jld:FromRDFTest
+
Purpose
+
Tests creating property with mixed rdf:type rdf:JSON and non-JSON.
+
input
+
+ fromRdf/js13-in.nq +
+
expect
+
+ fromRdf/js13-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
Test tli01 @list containing empty @list
diff --git a/tests/fromRdf-manifest.jsonld b/tests/fromRdf-manifest.jsonld index 1764a682..90c8cadf 100644 --- a/tests/fromRdf-manifest.jsonld +++ b/tests/fromRdf-manifest.jsonld @@ -379,6 +379,22 @@ "input": "fromRdf/js11-in.nq", "expect": "fromRdf/js11-out.jsonld", "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs12", + "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], + "name": "JSON literals (strings)", + "purpose": "Tests creating property with multiple rdf:type rdf:JSON to a JSON literal (null).", + "input": "fromRdf/js12-in.nq", + "expect": "fromRdf/js12-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs13", + "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], + "name": "Mixed JSON literals and non-JSON", + "purpose": "Tests creating property with mixed rdf:type rdf:JSON and non-JSON.", + "input": "fromRdf/js13-in.nq", + "expect": "fromRdf/js13-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tli01", "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], diff --git a/tests/fromRdf/js12-in.nq b/tests/fromRdf/js12-in.nq new file mode 100644 index 00000000..8dddac6b --- /dev/null +++ b/tests/fromRdf/js12-in.nq @@ -0,0 +1,2 @@ + "[\"string1\"]"^^ . + "[\"string2\"]"^^ . diff --git a/tests/fromRdf/js12-out.jsonld b/tests/fromRdf/js12-out.jsonld new file mode 100644 index 00000000..9a0686ab --- /dev/null +++ b/tests/fromRdf/js12-out.jsonld @@ -0,0 +1,10 @@ +[{ + "@id": "http://example.org/vocab#id", + "http://example.org/vocab#multi": [{ + "@value": ["string1"], + "@type": "@json" + }, { + "@value": ["string2"], + "@type": "@json" + }] +}] diff --git a/tests/fromRdf/js13-in.nq b/tests/fromRdf/js13-in.nq new file mode 100644 index 00000000..394bb536 --- /dev/null +++ b/tests/fromRdf/js13-in.nq @@ -0,0 +1,2 @@ + "null"^^ . + . diff --git a/tests/fromRdf/js13-out.jsonld b/tests/fromRdf/js13-out.jsonld new file mode 100644 index 00000000..e2bcda7e --- /dev/null +++ b/tests/fromRdf/js13-out.jsonld @@ -0,0 +1,9 @@ +[{ + "@id": "http://example.org/vocab#id", + "http://example.org/vocab#mixed": [{ + "@value": null, + "@type": "@json" + }, { + "@id": "http://example.org/vocab#value" + }] +}] diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index 1d2c9267..9cc6a22b 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -2251,6 +2251,20 @@ "purpose": "Verifies that an exception is raised when attempting to redefine @context.", "input": "expand/er56-in.jsonld", "expectErrorCode": "keyword redefinition" + }, { + "@id": "#ter57", + "@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest" ], + "name": "Array not found for @json @list.", + "purpose": "The value for a @json @list term MUST be an array.", + "input": "toRdf/er57-in.jsonld", + "expectErrorCode": "invalid set or list object" + }, { + "@id": "#ter58", + "@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest" ], + "name": "Array not found for @json @set.", + "purpose": "The value for a @json @set term MUST be an array.", + "input": "toRdf/er58-in.jsonld", + "expectErrorCode": "invalid set or list object" }, { "@id": "#tin01", "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], @@ -2507,6 +2521,62 @@ "input": "toRdf/js23-in.jsonld", "expect": "toRdf/js23-out.nq", "option": {"specVersion": "json-ld-1.1", "useJCS": true} + }, { + "@id": "#tjs24", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Transform JSON literal (one JSON literal).", + "purpose": "Tests transforming property with @type @json to a JSON literal (one JSON literal).", + "input": "toRdf/js24-in.jsonld", + "expect": "toRdf/js24-out.nq", + "option": {"specVersion": "json-ld-1.1", "useJCS": true} + }, { + "@id": "#tjs25", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Transform JSON literal (two JSON literals).", + "purpose": "Tests transforming property with @type @json to a JSON literal (two JSON literals).", + "input": "toRdf/js25-in.jsonld", + "expect": "toRdf/js25-out.nq", + "option": {"specVersion": "json-ld-1.1", "useJCS": true} + }, { + "@id": "#tjs26", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Transform JSON literal (JSON literal and non-JSON).", + "purpose": "Tests transforming property with @type @json to a JSON literal (JSON literal and non-JSON).", + "input": "toRdf/js26-in.jsonld", + "expect": "toRdf/js26-out.nq", + "option": {"specVersion": "json-ld-1.1", "useJCS": true} + }, { + "@id": "#tjs27", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Transform JSON literal (duplicate JSON literals).", + "purpose": "Tests transforming property with @type @json to a JSON literal (duplicate JSON literals).", + "input": "toRdf/js27-in.jsonld", + "expect": "toRdf/js27-out.nq", + "option": {"specVersion": "json-ld-1.1", "useJCS": true} + }, { + "@id": "#tjs28", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Transform array-like value with @json and no @set/@list in @context.", + "purpose": "Tests transforming array-like value with @json and no @set/@list in @context.", + "input": "toRdf/js28-in.jsonld", + "expect": "toRdf/js28-out.nq", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs29", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Transform array-like value with @json and @set in @context.", + "purpose": "Tests transforming array-like value with @json and @set in @context.", + "input": "toRdf/js29-in.jsonld", + "expect": "toRdf/js29-out.nq", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs30", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Transform array-like value with @json and @list in @context.", + "purpose": "Tests transforming array-like value with @json and @list in @context.", + "input": "toRdf/js30-in.jsonld", + "expect": "toRdf/js30-out.nq", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tli01", "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], diff --git a/tests/toRdf/er57-in.jsonld b/tests/toRdf/er57-in.jsonld new file mode 100644 index 00000000..07e6339b --- /dev/null +++ b/tests/toRdf/er57-in.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "prop": { + "@id": "ex:prop", + "@type": "@json", + "@container": "@set" + } + }, + "prop": "value" +} diff --git a/tests/toRdf/er58-in.jsonld b/tests/toRdf/er58-in.jsonld new file mode 100644 index 00000000..3ea8be4c --- /dev/null +++ b/tests/toRdf/er58-in.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "prop": { + "@id": "ex:prop", + "@type": "@json", + "@container": "@list" + } + }, + "prop": "value" +} diff --git a/tests/toRdf/js24-in.jsonld b/tests/toRdf/js24-in.jsonld new file mode 100644 index 00000000..6031cc67 --- /dev/null +++ b/tests/toRdf/js24-in.jsonld @@ -0,0 +1,3 @@ +{ + "http://example.org/vocab#value": {"@value": ["JSON"], "@type": "@json"} +} diff --git a/tests/toRdf/js24-out.nq b/tests/toRdf/js24-out.nq new file mode 100644 index 00000000..8bf2d7a4 --- /dev/null +++ b/tests/toRdf/js24-out.nq @@ -0,0 +1 @@ +_:b0 "[\"JSON\"]"^^ . diff --git a/tests/toRdf/js25-in.jsonld b/tests/toRdf/js25-in.jsonld new file mode 100644 index 00000000..84ff724c --- /dev/null +++ b/tests/toRdf/js25-in.jsonld @@ -0,0 +1,6 @@ +{ + "http://example.org/vocab#value": [ + {"@value": ["JSON1"], "@type": "@json"}, + {"@value": ["JSON2"], "@type": "@json"} + ] +} diff --git a/tests/toRdf/js25-out.nq b/tests/toRdf/js25-out.nq new file mode 100644 index 00000000..53af01e9 --- /dev/null +++ b/tests/toRdf/js25-out.nq @@ -0,0 +1,2 @@ +_:b0 "[\"JSON1\"]"^^ . +_:b0 "[\"JSON2\"]"^^ . diff --git a/tests/toRdf/js26-in.jsonld b/tests/toRdf/js26-in.jsonld new file mode 100644 index 00000000..3f11042f --- /dev/null +++ b/tests/toRdf/js26-in.jsonld @@ -0,0 +1,6 @@ +{ + "http://example.org/vocab#value": [ + {"@value": ["JSON"], "@type": "@json"}, + {"@value": "non-JSON"} + ] +} diff --git a/tests/toRdf/js26-out.nq b/tests/toRdf/js26-out.nq new file mode 100644 index 00000000..cb658a4c --- /dev/null +++ b/tests/toRdf/js26-out.nq @@ -0,0 +1,2 @@ +_:b0 "[\"JSON\"]"^^ . +_:b0 "non-JSON" . diff --git a/tests/toRdf/js27-in.jsonld b/tests/toRdf/js27-in.jsonld new file mode 100644 index 00000000..a0a817f2 --- /dev/null +++ b/tests/toRdf/js27-in.jsonld @@ -0,0 +1,6 @@ +{ + "http://example.org/vocab#value": [ + {"@value": [{"dup": true}], "@type": "@json"}, + {"@value": [{"dup": true}], "@type": "@json"} + ] +} diff --git a/tests/toRdf/js27-out.nq b/tests/toRdf/js27-out.nq new file mode 100644 index 00000000..6b84ec97 --- /dev/null +++ b/tests/toRdf/js27-out.nq @@ -0,0 +1 @@ +_:b0 "[{\"dup\":true}]"^^ . diff --git a/tests/toRdf/js28-in.jsonld b/tests/toRdf/js28-in.jsonld new file mode 100644 index 00000000..8a10ef58 --- /dev/null +++ b/tests/toRdf/js28-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "ex:e", "@type": "@json"} + }, + "e": ["v1", "v2"] +} diff --git a/tests/toRdf/js28-out.nq b/tests/toRdf/js28-out.nq new file mode 100644 index 00000000..379870bb --- /dev/null +++ b/tests/toRdf/js28-out.nq @@ -0,0 +1 @@ +_:b0 "[\"v1\",\"v2\"]"^^ . diff --git a/tests/toRdf/js29-in.jsonld b/tests/toRdf/js29-in.jsonld new file mode 100644 index 00000000..a06649ee --- /dev/null +++ b/tests/toRdf/js29-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "ex:e", "@type": "@json", "@container": "@set"} + }, + "e": ["v1", "v2"] +} diff --git a/tests/toRdf/js29-out.nq b/tests/toRdf/js29-out.nq new file mode 100644 index 00000000..17b54b47 --- /dev/null +++ b/tests/toRdf/js29-out.nq @@ -0,0 +1,2 @@ +_:b0 "\"v1\""^^ . +_:b0 "\"v2\""^^ . diff --git a/tests/toRdf/js30-in.jsonld b/tests/toRdf/js30-in.jsonld new file mode 100644 index 00000000..aaa153d2 --- /dev/null +++ b/tests/toRdf/js30-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "e": {"@id": "ex:e", "@type": "@json", "@container": "@list"} + }, + "e": ["v1", "v2"] +} diff --git a/tests/toRdf/js30-out.nq b/tests/toRdf/js30-out.nq new file mode 100644 index 00000000..34766071 --- /dev/null +++ b/tests/toRdf/js30-out.nq @@ -0,0 +1,5 @@ +_:b0 _:b1 . +_:b1 "\"v1\""^^ . +_:b1 _:b2 . +_:b2 "\"v2\""^^ . +_:b2 .