<!DOCTYPE html>
<html>
<head>
<meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
<title>
JSON-LD Test Suite
</title>
<link href='manifest.jsonld' rel='alternate'>
<link href='https://www.w3.org/StyleSheets/TR/base' rel='stylesheet'>
</head>
<body>
<p>
<a href='http://www.w3.org/'>
<img alt='W3C' height='48' src='http://www.w3.org/Icons/w3c_home' width='72'>
</a>
</p>
<h1>JSON-LD Test Suite</h1>
<p>This manifest loads additional manifests for specific behavior tests for <a href="https://www.w3.org/TR/json-ld11-api/">JSON-LD 1.1 API</a></p>
<p>This is an HTML version of a test manifest. The JSON-LD version of this manifest may be found at
<a href="manifest.jsonld">manifest.jsonld</a>. The manifest vocabulary is described in the <a href="vocab.html">JSON-LD Test Vocabulary</a> (<a href="vocab.jsonld">JSON-LD</a>, <a href="vocab.ttl">Turtle</a>) and is based on the <a href="http://www.w3.org/TR/2014/NOTE-rdf11-testcases-20140225/">RDF Test Vocabulary</a>.</p>
<p>The JSON-LD Test Suite is a set of tests that can
be used to verify JSON-LD Processor conformance to the set of specifications
that constitute JSON-LD. The goal of the suite is to provide an easy and
comprehensive JSON-LD testing solution for developers creating JSON-LD Processors.</p>
<p>The <a href="https://w3.org/TR/json-ld11-framing">JSON-LD Framing Specification</a> maintains its own
<a href="https://w3c.github.io/json-ld-framing/tests/">test suite</a>.</p>
<h2>General instructions for running the JSON-LD Test suites</h2>
<h3><a href="compact-manifest.html">compact</a> tests have <em>input</em>, <em>expected</em> and <em>context</em> documents.</h3>
<p>The <em>expected</em> results can be compared using <a href="#json-ld-object-comparison">JSON-LD object comparison</a> with the processor output. Additionally, if the <code>ordered</code> option is not set, result should be expanded and compared with the expanded <em>expected</em> document also using <a href="#json-ld-object-comparison">JSON-LD object comparison</a>.</p>
<p>For <strong>NegativeEvaluationTests</strong>, the result is a string associated with the expected error code.</p>
<h3><a href="expand-manifest.html">expand</a> tests have <em>input</em> and <em>expected</em> documents.</h3>
<p>The <em>expected</em> results can be compared using <a href="#json-ld-object-comparison">JSON-LD object comparison</a> with the processor output.</p>
<p>Expansion tests may have a <code>expandContext</code> option, which is treated
as an IRI relative to the manifest.</p>
<p>For <strong>NegativeEvaluationTests</strong>, the result is a string associated with the expected error code.</p>
<h3><a href="html-manifest.html">html</a> tests have <em>input</em> and <em>expected</em> documents and an optional <em>context</em> document.</h3>
<p>The <em>expected</em> results can be compared using <a href="#json-ld-object-comparison">JSON-LD object comparison</a> with the processor output after potentially remapping blank node identifiers (see below). Additionally, if the result is compacted and the <code>ordered</code> option is not set, result should be expanded and compared with the expanded <em>expected</em> document also using <a href="#json-ld-object-comparison">JSON-LD object comparison</a>.</p>
<p>For <strong>NegativeEvaluationTests</strong>, the result is a string associated with the expected error code.</p>
<h3><a href="flatten-manifest.html">flatten</a> tests have <em>input</em> and <em>expected</em> documents and an optional <em>context</em> document.</h3>
<p>The <em>expected</em> results can be compared using <a href="#json-ld-object-comparison">JSON-LD object comparison</a> with the processor output after potentially remapping blank node identifiers (see below). Additionally, if the result is compacted and the <code>ordered</code> option is not set, result should be expanded and compared with the expanded <em>expected</em> document also using <a href="#json-ld-object-comparison">JSON-LD object comparison</a>.</p>
<p>For <strong>NegativeEvaluationTests</strong>, the result is a string associated with the expected error code.</p>
<h3><a href="remote-doc-manifest.html">remote-doc</a> tests have <em>input</em> and <em>expected</em> documents.</h3>
<p>The <em>expected</em> results can be compared using <a href="#json-ld-object-comparison">JSON-LD object comparison</a> with the processor output.</p>
<p>For <strong>NegativeEvaluationTests</strong>, the result is a string associated with the expected error code.</p>
<p>Options may be present to describe the intended HTTP behavior:</p>
<ul>
<li><em>contentType</em>: Content-Type of the returned HTTP payload, defaults to the appropriate type for the <em>input</em> suffix.</li>
<li><em>httpStatus</em>: The HTTP status code to return, defaults to <code>200</code>.</li>
<li><em>redirectTo</em>: The HTTP <em>Content-Location</em> header value.</li>
<li><em>httpLink</em>: The HTTP <em>Link</em> header value.</li>
</ul>
<h3><a href="fromRdf-manifest.html">fromRdf</a> tests have <em>input</em> and <em>expected</em> documents.</h3>
<p>The <em>expected</em> results can be compared using <a href="#json-ld-object-comparison">JSON-LD object comparison</a> with the processor output.</p>
<h3><a href="toRdf-manifest.html">toRdf</a> tests have <em>input</em> and <em>expected</em> documents.</h3>
<p>Some tests require the use of <a href="https://tools.ietf.org/html/draft-rundgren-json-canonicalization-scheme-05">JSON Canonicalization Scheme</a> to properly generate RDF Literals from JSON literal values. This algorithm is non-normative, but is assumed to be used to properly compare results. These tests are marked using the <code>useJCS</code> option.</p>
<p>The <em>expected</em> results can be compared using <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-dataset-isomorphism">RDF Dataset Isomorphism</a>.</p>
<p>A <strong>PositiveSyntaxTest</strong> looks specifically for syntax-related issues. A <strong>PositiveSyntaxTest</strong> succeeds when no error is found when processing.</p>
<p>ToRdf tests may have a <code>expandContext</code> option, which is treated
as an IRI relative to the manifest.</p>
<p>Unless <code>processingMode</code> is set explicitly in a test entry, <code>processingMode</code> is compatible with both <code>json-ld-1.0</code> and <code>json-ld-1.1</code>.</p>
<p>Test results that include a context input presume that the context is provided locally, and not from the referenced location, thus the results will include the content of the context file, rather than a reference.</p>
<p>Developers are encouraged to make a local copy of the test suite (available on <a href="http://github.com/w3c/json-ld-api/tests/">GitHub</a>) and simulate the behavior of fetching test files remotely and setting HTTP headers as described in a particular test entry.</p>
<h2 id="json-ld-object-comparison">JSON-LD Object comparison</h2>
<p>If algorithms are invoked with the <code>ordered</code> flag set to <code>true</code>, simple JSON Object comparison may be used, as the order of all arrays will be preserved (except for <em>fromRdf</em>, unless the input quads are also ordered). If <code>ordered</code> is <code>false</code>, then the following algorithm will ensure arrays other than values of <code>@list</code> are compared without regard to order.</p>
<p>JSON-LD Object comparison compares JSON objects, arrays, and values recursively for equality.</p>
<ul>
<li>JSON objects are compared entry by entry without regard to the ordering of entries within the object. Each entry must have a corresponding entry in the object being compared to. Values are compared recursively.</li>
<li>JSON arrays are generally compared without regard to order (the lone exception being if the referencing key is <code>@list</code>). Each item within the array must be equivalent to an item in the array being compared to by using the comparison algorithm recursively. For values of <code>@list</code>, the order of these items is significant.</li>
<li>JSON values are compared using strict equality.</li>
<li>Values of <code>@language</code>, and other places where language tags may be used are specified in lowercase in the test results. Implementations should either normalize language tags for testing purposes, or compare language tags in a case-independent way.</li>
</ul>
<p>Note that some tests require re-expansion and comparison, as list values may exist as values of properties that have <code>@container: @list</code> and the comparison algorithm will not consider ordering significant.</p>
<h1>Running tests</h1>
<p>The top-level <a href="manifest.jsonld">manifest</a> references the specific test manifests, which in turn reference each test associated with a particular type of behavior.</p>
<p>Implementations create their own infrastructure for running the test suite. In particular, the following should be considered:</p>
<ul>
<li><em>remote-doc</em> tests will likely not return expected HTTP headers, so the <em>options</em> should be used to determine what headers are associated with the input document.</li>
<li>Test case properties identifying a file (<em>input</em>, <em>output</em>, <em>context</em>, <em>expectContext</em>, and <em>frame</em>) are presumed to have a media type appropriate for the file extension.
<ul>
<li><code>application/ld+json</code> for <code>.jsonld</code></li>
<li><code>text/html</code> for <code>.html</code></li>
<li><code>application/n-quads</code> for <code>.nq</code></li>
</ul></li>
<li>The media type for the file associated with the <em>input</em> property can be overridden using the <code>contentType</code> option.</li>
<li>Some algorithms, particularly <em>fromRdf</em>, may not preserve the order of statements listed in the input document, and provision should be taken for performing unordered array comparison, for arrays other than values of <code>@list</code>. (This may be difficult for compacted results, where array value ordering is dependent on the associated term definition).</li>
<li>Some <em>toRdf</em> tests require the use of <a href="https://tools.ietf.org/html/draft-rundgren-json-canonicalization-scheme-05">JSON Canonicalization Scheme</a> to properly generate RDF Literals from JSON literal values. This algorithm is non-normative, but is assumed to be used to properly compare results using <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-dataset-isomorphism">RDF Dataset Isomorphism</a>. These tests are marked using the <code>useJCS</code> option.</li>
<li>When comparing documents after flattening, framing or generating RDF, blank node identifiers may not be predictable. Implementations using the JSON-LD 1.0 algorithm, where output is always sorted and blank node identifiers are generated sequentially from <code>_:b0</code> may continue to use a simple object comparison. Otherwise, implementations should take this into consideration. (One way to do this may be to reduce both results and <em>expected</em> to datsets to extract a bijective mapping of blank node labels between the two datasets as described in <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-dataset-isomorphism">RDF Dataset Isomorphism</a>).</li>
<li>Some tests may have a <code>requires</code> property, indicating some optional behavior described by a test vocabulary term.</li>
</ul>
<h1>Contributing Tests</h1>
<p>If you would like to contribute a new test or a fix to an existing test,
please follow these steps:</p>
<ol>
<li>Notify the JSON-LD mailing list, public-json-ld-wg@w3.org,
that you will be creating a new test or fix and the purpose of the
change.</li>
<li>Clone the git repository: git://github.com/w3c/json-ld-api.git</li>
<li>Make your changes and submit them via github, or via a 'git format-patch'
to the <a href="mailto:json-ld-wg@w3.org">JSON-LD Working Group mailing list</a>.</li>
</ol>
<h2>Distribution</h2>
<p>Distributed under the <a href="http://www.w3.org/Consortium/Legal/2008/04-testsuite-license">W3C Test Suite License</a>. To contribute to a W3C Test Suite, see the <a href="http://www.w3.org/2004/10/27-testcases">policies and contribution forms</a>.</p>
<h2>Disclaimer</h2>
<p>UNDER THE EXCLUSIVE LICENSE, THIS DOCUMENT AND ALL DOCUMENTS, TESTS AND SOFTWARE THAT LINK THIS STATEMENT ARE PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.</p>
<section>
<h2>
Test sequence:
</h2>
<ul>
<li>
<a href='compact-manifest.html'>compact-manifest</a>
</li>
<li>
<a href='expand-manifest.html'>expand-manifest</a>
</li>
<li>
<a href='flatten-manifest.html'>flatten-manifest</a>
</li>
<li>
<a href='fromRdf-manifest.html'>fromRdf-manifest</a>
</li>
<li>
<a href='remote-doc-manifest.html'>remote-doc-manifest</a>
</li>
<li>
<a href='toRdf-manifest.html'>toRdf-manifest</a>
</li>
<li>
<a href='html-manifest.html'>html-manifest</a>
</li>
</ul>
</section>
</body>
</html>