diff --git a/common/algorithm-terms.html b/common/algorithm-terms.html
index cff1c71f..5ba18af2 100644
--- a/common/algorithm-terms.html
+++ b/common/algorithm-terms.html
@@ -16,7 +16,7 @@
A map containing values for
the object embed flag,
the require all flag,
- the embedded flag,
+ the embedded flag,
used internally to help determine if object embedding is appropriate,
the explicit inclusion flag,
and the omit default flag.
diff --git a/index.html b/index.html
index 42d3995e..8ff08da8 100644
--- a/index.html
+++ b/index.html
@@ -2954,13 +2954,13 @@ Algorithm
If container includes @graph
and @id
:
- Initialize map object to the value of item active property
- in nest result.
+ in nest result.
Initialize map key to the result of calling the
IRI Compaction algorithm
passing active context, inverse context, and the value of @id
in expanded item
or @none
if no such value exists as var, with vocab set to true
if there is no @id
entry in expanded item.
- If compacted item is not an
+ If compacted item is not an
array and as array is true
,
set compacted item to an array containing that value.
If map key is not an entry in map object,
@@ -2975,11 +2975,11 @@ Algorithm
and expanded item is a simple graph object:
- Initialize map object to the value of item active property
- in nest result.
+ in nest result.
Initialize map key the value of @index
in
expanded item or @none
, if no such
value exists.
- If compacted item is not an
+ If compacted item is not an
array and as array is true
,
set compacted item to an array containing that value.
If map key is not an entry in map object,
@@ -2991,17 +2991,27 @@ Algorithm
Otherwise, if container includes @graph
- and expanded item is a simple graph
- object the value cannot be represented as a map
- object. If compacted item is not an array
- and as array is true
, set
- compacted item to an array containing
- that value. If the value of an item active property entry in
- nest result is not an array,
- set it to a new array containing only the value.
- Then append compacted item to the value if
- compacted item is not an array,
- otherwise, concatenate it.
+ and expanded item is a simple graph object
+ the value cannot be represented as a map object.
+
+ - If compacted item is not an array
+ and as array is
true
,
+ set compacted item to an array containing that value.
+ - If compacted item is an array
+ with more than one value, it cannot be directly represented,
+ as multiple objects would be interpreted as different named graphs.
+ Set compacted item to a new map,
+ containing the key created by calling the IRI Compaction algorithm
+ passing active context, inverse context, `@included` as
+ var, and `true` for
+ vocab and the original compacted item as the value.
+ - If the value of an item active property entry in nest result
+ is not an array,
+ set it to a new array containing only the value.
+ - Then append compacted item to the value if
+ compacted item is not an array,
+ otherwise, concatenate it.
+
Otherwise, container does not include @graph
or otherwise does not match one of the previous cases, redo compacted item.
diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld
index 4ff8c73e..d1f29d18 100644
--- a/tests/compact-manifest.jsonld
+++ b/tests/compact-manifest.jsonld
@@ -800,7 +800,7 @@
}, {
"@id": "#t0096",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
- "name": "Compact @graph container (multiple objects)",
+ "name": "Compact @graph container (multiple graphs)",
"purpose": "Ensure @graph appears properly in output",
"input": "compact/0096-in.jsonld",
"context": "compact/0096-context.jsonld",
@@ -809,7 +809,7 @@
}, {
"@id": "#t0097",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
- "name": "Compact [@graph, @set] container (multiple objects)",
+ "name": "Compact [@graph, @set] container (multiple graphs)",
"purpose": "Ensure @graph appears properly in output",
"input": "compact/0097-in.jsonld",
"context": "compact/0097-context.jsonld",
@@ -914,6 +914,24 @@
"input": "compact/0108-in.jsonld",
"context": "compact/0108-context.jsonld",
"expect": "compact/0108-out.jsonld"
+ }, {
+ "@id": "#t0109",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact @graph container (multiple objects)",
+ "purpose": "Multiple objects in a simple graph with a graph container need to use @included",
+ "input": "compact/0109-in.jsonld",
+ "context": "compact/0109-context.jsonld",
+ "expect": "compact/0109-out.jsonld",
+ "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
+ }, {
+ "@id": "#t0110",
+ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
+ "name": "Compact [@graph, @set] container (multiple objects)",
+ "purpose": "Multiple objects in a simple graph with a graph container need to use @included",
+ "input": "compact/0110-in.jsonld",
+ "context": "compact/0110-context.jsonld",
+ "expect": "compact/0110-out.jsonld",
+ "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
}, {
"@id": "#tc001",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
diff --git a/tests/compact/0109-context.jsonld b/tests/compact/0109-context.jsonld
new file mode 100644
index 00000000..2af65c48
--- /dev/null
+++ b/tests/compact/0109-context.jsonld
@@ -0,0 +1,6 @@
+{
+ "@context": {
+ "input": {"@id": "foo:input", "@container": "@graph"},
+ "value": "foo:value"
+ }
+}
\ No newline at end of file
diff --git a/tests/compact/0109-in.jsonld b/tests/compact/0109-in.jsonld
new file mode 100644
index 00000000..61047099
--- /dev/null
+++ b/tests/compact/0109-in.jsonld
@@ -0,0 +1,8 @@
+[{
+ "foo:input": [{
+ "@graph": [
+ {"foo:value": "x"},
+ {"foo:value": "y"}
+ ]
+ }]
+}]
\ No newline at end of file
diff --git a/tests/compact/0109-out.jsonld b/tests/compact/0109-out.jsonld
new file mode 100644
index 00000000..3a322f1a
--- /dev/null
+++ b/tests/compact/0109-out.jsonld
@@ -0,0 +1,13 @@
+{
+ "@context": {
+ "input": {"@id": "foo:input", "@container": "@graph"},
+ "value": "foo:value"
+ },
+ "input": {
+ "@included": [{
+ "value": "x"
+ }, {
+ "value": "y"
+ }]
+ }
+}
\ No newline at end of file
diff --git a/tests/compact/0110-context.jsonld b/tests/compact/0110-context.jsonld
new file mode 100644
index 00000000..c6cb8aa0
--- /dev/null
+++ b/tests/compact/0110-context.jsonld
@@ -0,0 +1,6 @@
+{
+ "@context": {
+ "input": {"@id": "foo:input", "@container": ["@graph", "@set"]},
+ "value": "foo:value"
+ }
+}
\ No newline at end of file
diff --git a/tests/compact/0110-in.jsonld b/tests/compact/0110-in.jsonld
new file mode 100644
index 00000000..61047099
--- /dev/null
+++ b/tests/compact/0110-in.jsonld
@@ -0,0 +1,8 @@
+[{
+ "foo:input": [{
+ "@graph": [
+ {"foo:value": "x"},
+ {"foo:value": "y"}
+ ]
+ }]
+}]
\ No newline at end of file
diff --git a/tests/compact/0110-out.jsonld b/tests/compact/0110-out.jsonld
new file mode 100644
index 00000000..328f71b7
--- /dev/null
+++ b/tests/compact/0110-out.jsonld
@@ -0,0 +1,13 @@
+{
+ "@context": {
+ "input": {"@id": "foo:input", "@container": ["@graph", "@set"]},
+ "value": "foo:value"
+ },
+ "input": [{
+ "@included": [{
+ "value": "x"
+ }, {
+ "value": "y"
+ }]
+ }]
+}
\ No newline at end of file