--- a/spec/latest/json-ld-api/index.html Fri Mar 22 12:26:17 2013 +0100
+++ b/spec/latest/json-ld-api/index.html Fri Mar 22 12:48:49 2013 +0100
@@ -1948,10 +1948,7 @@
key, if a <tref>context</tref> was given, where the <tref>JSON object</tref>
is either <i>result</i> or a wrapper for it where <i>result</i> appears
as the value of an (aliased) <code>@graph</code> key because <i>result</i>
- contained two or more items in an <tref>array</tref>. If no
- <tref>context</tref> was given, the <i>result</i> is only simplified
- from an <tref>array</tref> to a <tref>JSON object</tref> if it has one or
- fewer items and array compaction has been requested.</p>
+ contained two or more items in an <tref>array</tref>.</p>
</section>
<section>
@@ -2239,20 +2236,15 @@
<li>Return <i>result</i>.</li>
</ol>
- <p>If, after the algorithm outlined above is run, the result <i>result</i> is
- an <tref>array</tref> with two or more items and a <i>context</i> has
- been passed, replace it with a new <tref>JSON object</tref> with a single
- key-value pair where the key is the result of using the
- <a href="#iri-compaction">IRI Compaction algorithm</a>, passing
- <tref>active context</tref>, <tref>inverse context</tref>, <code>@graph</code>
- as <i>iri</i>, and <i>result</i> as <i>value</i>. Otherwise, if
- <i>result</i> is an <tref>array</tref> with only one item and
- <code class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays">compactArrays</a></code>
- is <tref>true</tref>, set <i>result</i> to that item. Otherwise, if
- <i>result</i> is an <tref>array</tref> with zero items, replace it
- with an empty <tref>JSON object</tref>. Finally, if a <i>context</i>
- has been passed, add an <code>@context</code> property to <i>result</i>
- and set its value to the initially passed <i>context</i>.</p>
+ <p>If, after the algorithm outlined above is run, the result <i>result</i>
+ is an <tref>array</tref>, replace it with a new
+ <tref>JSON object</tref> with a single member whose key is the result
+ of using the <a href="#iri-compaction">IRI Compaction algorithm</a>,
+ passing <tref>active context</tref>, <tref>inverse context</tref>, and
+ <code>@graph</code> as <i>iri</i> and whose value is the <tref>array</tref>
+ <i>result</i>. Finally, if a <i>context</i> has been passed, add an
+ <code>@context</code> member to <i>result</i> and set its value to
+ the passed <i>context</i>.</p>
</section>
</section> <!-- end of Compaction -->
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0046-context.jsonld Fri Mar 22 12:48:49 2013 +0100
@@ -0,0 +1,1 @@
+{ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0046-in.jsonld Fri Mar 22 12:48:49 2013 +0100
@@ -0,0 +1,10 @@
+[
+ {
+ "@id": "http://me.markus-lanthaler.com/",
+ "http://xmlns.com/foaf/0.1/name": "Markus Lanthaler"
+ },
+ {
+ "@id": "http://greggkellogg.net/foaf#me",
+ "http://xmlns.com/foaf/0.1/name": "Gregg Kellogg"
+ }
+]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0046-out.jsonld Fri Mar 22 12:48:49 2013 +0100
@@ -0,0 +1,12 @@
+{
+ "@graph": [
+ {
+ "@id": "http://me.markus-lanthaler.com/",
+ "http://xmlns.com/foaf/0.1/name": "Markus Lanthaler"
+ },
+ {
+ "@id": "http://greggkellogg.net/foaf#me",
+ "http://xmlns.com/foaf/0.1/name": "Gregg Kellogg"
+ }
+ ]
+}
--- a/test-suite/tests/compact-manifest.jsonld Fri Mar 22 12:26:17 2013 +0100
+++ b/test-suite/tests/compact-manifest.jsonld Fri Mar 22 12:48:49 2013 +0100
@@ -278,6 +278,12 @@
"expect": "compact-0045-out.jsonld"
}, {
"@type": ["test:TestCase", "jld:CompactTest"],
+ "name": "Wrap top-level array into @graph even if no context is passed",
+ "input": "compact-0046-in.jsonld",
+ "context": "compact-0046-context.jsonld",
+ "expect": "compact-0046-out.jsonld"
+ }, {
+ "@type": ["test:TestCase", "jld:CompactTest"],
"name": "Prefer terms with a language mapping set to null over terms without language-mapping for non-strings",
"input": "compact-0048-in.jsonld",
"context": "compact-0048-context.jsonld",