Add optimization flag to compaction API, closes #8
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Mon, 27 Feb 2012 22:43:43 +0800
changeset 375 efbe9fbb8adb
parent 374 f1e0816d5812
child 376 9ba47ea9ac84
Add optimization flag to compaction API, closes #8

Added the optimization flag to the compaction API and made the context parameter mandatory. This is still being discussed in issue #58 and might need to be changed as the context could also be extracted directly from the input - at least in some scenarios.
spec/latest/json-ld-api/index.html
--- a/spec/latest/json-ld-api/index.html	Wed Feb 22 22:58:50 2012 +0800
+++ b/spec/latest/json-ld-api/index.html	Mon Feb 27 22:43:43 2012 +0800
@@ -502,7 +502,7 @@
 
       <dt>object compact()</dt>
       <dd><a href="#compaction">Compacts</a> the given <code>input</code>
-        according to the steps in the
+        using the <code>context</code> according to the steps in the
         <a href="#compaction-algorithm">Compaction Algorithm</a>. The
         <code>input</code> MUST be copied, compacted and returned if there are
         no errors. If the compaction fails, an appropirate exception MUST be
@@ -510,8 +510,15 @@
         <dl class="parameters">
            <dt>object input</dt>
            <dd>The JSON-LD object to perform compaction on.</dd>
-           <dt>object optional? context</dt>
-           <dd>The base context to use when compacting the <code>input</code>.</dd>
+           <dt>object? context</dt>
+           <dd>The context to use when compacting the <code>input</code>.</dd>
+           <dt>boolean optional optimize</dt>
+           <dd>If set to <code>true</code>, the JSON-LD processor is allowed
+           optimize the output of the <a href="#compaction-algorithm">Compaction Algorithm</a>
+           to produce even compacter representations. The algorithm for compaction
+           optimization is beyond the scope of this specification and thus
+           not defined. Consequently, different implementations MAY implement
+           different optimization algorithms.</dd>
         </dl>
 
         <dl class="exception" title="InvalidContext">