This document report test subject conformance for and related specifications for JSON-LD [[JSON-LD-API]] according to the requirements of the Evaluation and Report Language (EARL) 1.0 Schema [[EARL10-SCHEMA]].

This report is also available in alternate formats: Turtle and JSON-LD

Instructions for submitting implementation reports

Tests should be run using the test manifests defined in the Test Manifests Section.

Each test manifest MAY contain a baseIri property, indicating the base IRI to be used for running each test.

Reports should be submitted in Turtle format to public-rdf-comments@w3.org and include an earl:Assertion for each test, referencing the test resource from the associated manifest and the test subject being reported upon. An example test entry is be the following:

  [ a earl:Assertion;
    earl:assertedBy <http://greggkellogg.net/foaf#me>;
    earl:subject <http://rubygems.org/gems/json-ld>;
    earl:test <http://json-ld.org/test-suite/tests/flatten-manifest.jsonld#t0001>;
    earl:result [
      a earl:TestResult;
      earl:outcome earl:passed;
      dc:date "2013-02-22T15:12:30-08:00"^^xsd:dateTime];
    earl:mode earl:automatic ] .

The Test Subject should be defined as a doap:Project, including the name, homepage and developer(s) of the software (see [[DOAP]]). Optionally, including the project description and programming language. An example test subject description is the following:

  <http://rubygems.org/gems/json-ld> a doap:Project, earl:TestSubject, earl:Software ;
    doap:name          "JSON::LD" ;
    doap:homepage      <http://gkellogg.github.com/json-ld> ;
    doap:license       <http://creativecommons.org/licenses/publicdomain/> ;
    doap:description   "JSON::LD parses and serializes JSON-LD into RDF and implements expansion, compaction and framing API interfaces."@en ;
    doap:programming-language "Ruby" ;
    doap:developer     <http://greggkellogg.net/foaf#me> ;
    dc:title           "JSON::LD" ;
    dc:date            "2011-08-29"^^xsd:date ;
    dc:creator         <http://greggkellogg.net/foaf#me> ;

The software developer, either an organization or one or more individuals SHOULD be referenced from doap:developer using [[FOAF]]. For example:

  <http://greggkellogg.net/foaf#me> a foaf:Person, earl:Assertor;
    foaf:name "Gregg Kellogg";
    foaf:title "Implementor";
    foaf:homepage <http://greggkellogg.net/> .

See JSON-LD Test Description for more information.

Test Manifests

Compaction

JSON-LD compaction tests use object comparison.

Test JSON::LD jsonld.js browser jsonld.js node.js php-json-ld PyLD JSONLD-Java JsonLD
Test 0001: drop free-floating nodes PASS PASS PASS PASS PASS PASS PASS
Test 0002: basic PASS PASS PASS PASS PASS PASS PASS
Test 0003: drop null and unmapped properties PASS PASS PASS PASS PASS PASS PASS
Test 0004: optimize @set, keep empty arrays PASS PASS PASS PASS PASS PASS PASS
Test 0005: @type and prefix compaction PASS PASS PASS PASS PASS PASS PASS
Test 0006: keep expanded object format if @type doesn't match PASS PASS PASS PASS PASS PASS PASS
Test 0007: add context PASS PASS PASS PASS PASS PASS PASS
Test 0008: alias keywords PASS PASS PASS PASS PASS PASS PASS
Test 0009: compact @id PASS PASS PASS PASS PASS PASS PASS
Test 0010: array to @graph PASS PASS PASS PASS PASS PASS PASS
Test 0011: compact date PASS PASS PASS PASS PASS PASS PASS
Test 0012: native types PASS PASS PASS PASS PASS PASS PASS
Test 0013: @value with @language PASS PASS PASS PASS PASS PASS PASS
Test 0014: array to aliased @graph PASS PASS PASS PASS PASS PASS PASS
Test 0015: best match compaction PASS PASS PASS PASS PASS PASS PASS
Test 0016: recursive named graphs PASS PASS PASS PASS PASS PASS PASS
Test 0017: A term mapping to null removes the mapping PASS PASS PASS PASS PASS PASS PASS
Test 0018: best matching term for lists PASS PASS PASS PASS PASS PASS PASS
Test 0019: Keep duplicate values in @list and @set PASS PASS PASS PASS PASS PASS PASS
Test 0020: Compact @id that is a property IRI when @container is @list PASS PASS PASS PASS PASS PASS PASS
Test 0021: Compact properties and types using @vocab PASS PASS PASS PASS PASS PASS PASS
Test 0022: @list compaction of nested properties PASS PASS PASS PASS PASS PASS PASS
Test 0023: prefer @vocab over compacted IRIs PASS PASS PASS PASS PASS PASS PASS
Test 0024: most specific term matching in @list. PASS PASS PASS PASS PASS PASS PASS
Test 0025: Language maps PASS PASS PASS PASS PASS PASS PASS
Test 0026: Language map term selection with complications PASS PASS PASS PASS PASS PASS PASS
Test 0027: @container: @set with multiple values PASS PASS PASS PASS PASS PASS PASS
Test 0028: Alias keywords and use @vocab PASS PASS PASS PASS PASS PASS PASS
Test 0029: Simple @index map PASS PASS PASS PASS PASS PASS PASS
Test 0030: non-matching @container: @index PASS PASS PASS PASS PASS PASS PASS
Test 0031: Compact @reverse PASS PASS PASS PASS PASS PASS PASS
Test 0032: Compact keys in reverse-maps PASS PASS PASS PASS PASS PASS PASS
Test 0033: Compact reverse-map to reverse property PASS PASS PASS PASS PASS PASS PASS
Test 0034: Skip property with @reverse if no match PASS PASS PASS PASS PASS PASS PASS
Test 0035: Compact @reverse node references using strings PASS PASS PASS PASS PASS PASS PASS
Test 0036: Compact reverse properties using index containers PASS PASS PASS PASS PASS PASS PASS
Test 0037: Compact keys in @reverse using @vocab PASS PASS PASS PASS PASS PASS PASS
Test 0038: Index map round-tripping PASS PASS PASS PASS PASS PASS PASS
Test 0039: @graph is array PASS PASS PASS PASS PASS PASS PASS
Test 0040: @list is array PASS PASS PASS PASS PASS PASS PASS
Test 0041: index rejects term having @list PASS PASS PASS PASS PASS PASS PASS
Test 0042: @list keyword aliasing PASS PASS PASS PASS PASS PASS PASS
Test 0043: select term over @vocab PASS PASS PASS PASS PASS PASS PASS
Test 0044: @type: @vocab in reverse-map PASS PASS PASS PASS PASS PASS PASS
Test 0045: @id value uses relative IRI, not term PASS PASS PASS PASS PASS PASS PASS
Test 0046: multiple objects without @context use @graph PASS PASS PASS PASS PASS PASS PASS
Test 0047: Round-trip relative URLs PASS PASS PASS PASS PASS PASS PASS
Test 0048: term with @language: null PASS PASS PASS PASS PASS PASS PASS
Test 0049: Round tripping of lists that contain just IRIs PASS PASS PASS PASS PASS PASS PASS
Test 0050: Reverse properties require @type: @id to use string values PASS PASS PASS PASS PASS PASS PASS
Test 0051: Round tripping @list with scalar PASS PASS PASS PASS PASS PASS PASS
Test 0052: Round tripping @list with scalar and @graph alias PASS PASS PASS PASS PASS PASS PASS
Test 0053: Use @type: @vocab if no @type: @id PASS PASS PASS PASS PASS PASS PASS
Test 0054: Compact to @type: @vocab and compact @id to term PASS PASS PASS PASS PASS PASS PASS
Test 0055: Round tripping @type: @vocab PASS PASS PASS PASS PASS PASS PASS
Test 0056: Prefer @type: @vocab over @type: @id for terms PASS PASS PASS PASS PASS PASS PASS
Test 0057: Complex round tripping @type: @vocab and @type: @id PASS PASS PASS PASS PASS PASS PASS
Test 0058: Prefer @type: @id over @type: @vocab for non-terms PASS PASS PASS PASS PASS PASS PASS
Test 0059: Term with @type: @vocab if no @type: @id PASS PASS PASS PASS PASS PASS PASS
Test 0060: Term with @type: @id if no @type: @vocab and term value PASS PASS PASS PASS PASS PASS PASS
Test 0061: @type: @vocab/@id with values matching either PASS PASS PASS PASS PASS PASS PASS
Test 0062: @type: @vocab and relative IRIs PASS PASS PASS PASS PASS PASS PASS
Test 0063: Compact IRI round-tripping with @type: @vocab PASS PASS PASS PASS PASS PASS PASS
Test 0064: Compact language-tagged and indexed strings to index-map PASS PASS PASS PASS PASS PASS PASS
Test 0065: Language-tagged and indexed strings with language-map PASS PASS PASS PASS PASS PASS PASS
Test 0066: Relative IRIs PASS PASS PASS PASS PASS PASS PASS
Test 0067: Reverse properties with blank nodes PASS PASS PASS PASS PASS PASS PASS
Test 0068: Single value reverse properties PASS PASS PASS PASS PASS PASS PASS
Test 0069: Single value reverse properties with @set PASS PASS PASS PASS PASS PASS PASS
Test 0070: compactArrays option PASS PASS PASS PASS PASS PASS PASS
Test 0071: input has multiple @contexts, output has one PASS PASS PASS PASS PASS PASS PASS
Percentage passed out of 71 Tests 100.0% 100.0% 100.0% 100.0% 100.0% 100.0% 100.0%

Error handling

JSON-LD to Expansion tests use object compare

Test JSON::LD jsonld.js browser jsonld.js node.js php-json-ld PyLD JSONLD-Java JsonLD
Test 0001: Keywords cannot be aliased to other keywords PASS PASS PASS PASS PASS PASS PASS
Test 0002: A context may not include itself recursively (direct) PASS PASS PASS PASS PASS PASS PASS
Test 0003: A context may not include itself recursively (indirect) PASS PASS PASS PASS PASS PASS PASS
Test 0004: Error dereferencing a remote context PASS PASS PASS PASS PASS PASS PASS
Test 0005: Invalid remote context PASS PASS PASS PASS PASS PASS PASS
Test 0006: Invalid local context PASS PASS PASS PASS PASS PASS PASS
Test 0007: Invalid base IRI PASS PASS PASS PASS PASS PASS PASS
Test 0008: Invalid vocab mapping PASS PASS PASS PASS PASS PASS PASS
Test 0009: Invalid default language PASS PASS PASS PASS PASS PASS PASS
Test 0010: Cyclic IRI mapping PASS PASS PASS PASS PASS PASS PASS
Test 0011: Invalid term definition PASS PASS PASS PASS PASS PASS PASS
Test 0012: Invalid type mapping (not a string) PASS PASS PASS PASS PASS PASS PASS
Test 0013: Invalid type mapping (not absolute IRI) PASS PASS PASS PASS PASS PASS PASS
Test 0014: Invalid reverse property (contains @id) PASS PASS PASS PASS PASS PASS PASS
Test 0015: Invalid IRI mapping (@reverse not a string) PASS PASS PASS PASS PASS PASS PASS
Test 0016: Invalid IRI mapping (not an absolute IRI) PASS PASS PASS PASS PASS PASS PASS
Test 0017: Invalid reverse property (invalid @container) PASS PASS PASS PASS PASS PASS PASS
Test 0018: Invalid IRI mapping (@id not a string) PASS PASS PASS PASS PASS PASS PASS
Test 0019: Invalid keyword alias PASS PASS PASS PASS PASS PASS PASS
Test 0020: Invalid IRI mapping (no vocab mapping) PASS PASS PASS PASS PASS PASS PASS
Test 0021: Invalid container mapping PASS PASS PASS PASS PASS PASS PASS
Test 0022: Invalid language mapping PASS PASS PASS PASS PASS PASS PASS
Test 0023: Invalid IRI mapping (relative IRI in @type) PASS PASS PASS PASS PASS PASS PASS
Test 0024: List of lists (from array) PASS PASS PASS PASS PASS PASS PASS
Test 0025: Invalid reverse property map PASS PASS PASS PASS PASS PASS PASS
Test 0026: Colliding keywords PASS PASS PASS PASS PASS PASS PASS
Test 0027: Invalid @id value PASS PASS PASS PASS PASS PASS PASS
Test 0028: Invalid type value PASS PASS PASS PASS PASS PASS PASS
Test 0029: Invalid value object value PASS PASS PASS PASS PASS PASS PASS
Test 0030: Invalid language-tagged string PASS PASS PASS PASS PASS PASS PASS
Test 0031: Invalid @index value PASS PASS PASS PASS PASS PASS PASS
Test 0032: List of lists (from array) PASS PASS PASS PASS PASS PASS PASS
Test 0033: Invalid @reverse value PASS PASS PASS PASS PASS PASS PASS
Test 0034: Invalid reverse property value (in @reverse) PASS PASS PASS PASS PASS PASS PASS
Test 0035: Invalid language map value PASS PASS PASS PASS PASS PASS PASS
Test 0036: Invalid reverse property value (through coercion) PASS PASS PASS PASS PASS PASS PASS
Test 0037: Invalid value object (unexpected keyword) PASS PASS PASS PASS PASS PASS PASS
Test 0038: Invalid value object (@type and @language) PASS PASS PASS PASS PASS PASS PASS
Test 0039: Invalid language-tagged value PASS PASS PASS PASS PASS PASS PASS
Test 0040: Invalid typed value PASS PASS PASS PASS PASS PASS PASS
Test 0041: Invalid set or list object PASS PASS PASS PASS PASS PASS PASS
Test 0042: Compaction to list of lists PASS PASS PASS PASS PASS PASS PASS
Test 0043: Conflicting indexes PASS PASS PASS PASS PASS PASS PASS
Percentage passed out of 43 Tests 100.0% 100.0% 100.0% 100.0% 100.0% 100.0% 100.0%

Expansion

JSON-LD to Expansion tests use object compare

Test Argo.Core.JsonLd JSON::LD jsonld.js browser jsonld.js node.js php-json-ld PyLD JSONLD-Java JsonLD
Test 0001: drop free-floating nodes PASS PASS PASS PASS PASS PASS PASS PASS
Test 0002: basic PASS PASS PASS PASS PASS PASS PASS PASS
Test 0003: drop null and unmapped properties PASS PASS PASS PASS PASS PASS PASS PASS
Test 0004: optimize @set, keep empty arrays PASS PASS PASS PASS PASS PASS PASS PASS
Test 0005: do not expand aliased @id/@type PASS PASS PASS PASS PASS PASS PASS PASS
Test 0006: alias keywords PASS PASS PASS PASS PASS PASS PASS PASS
Test 0007: date type-coercion PASS PASS PASS PASS PASS PASS PASS PASS
Test 0008: @value with @language PASS PASS PASS PASS PASS PASS PASS PASS
Test 0009: @graph with terms PASS PASS PASS PASS PASS PASS PASS PASS
Test 0010: native types PASS PASS PASS PASS PASS PASS PASS PASS
Test 0011: coerced @id PASS PASS PASS PASS PASS PASS PASS PASS
Test 0012: @graph with embed PASS PASS PASS PASS PASS PASS PASS PASS
Test 0013: expand already expanded PASS PASS PASS PASS PASS PASS PASS PASS
Test 0014: @set of @value objects with keyword aliases PASS PASS PASS PASS PASS PASS PASS PASS
Test 0015: collapse set of sets, keep empty lists PASS PASS PASS PASS PASS PASS PASS PASS
Test 0016: context reset PASS PASS PASS PASS PASS PASS PASS PASS
Test 0017: @graph and @id aliased PASS PASS PASS PASS PASS PASS PASS PASS
Test 0018: override default @language PASS PASS PASS PASS PASS PASS PASS PASS
Test 0019: remove @value = null PASS PASS PASS PASS PASS PASS PASS PASS
Test 0020: do not remove @graph if not at top-level PASS PASS PASS PASS PASS PASS PASS PASS
Test 0021: do not remove @graph at top-level if not only property PASS PASS PASS PASS PASS PASS PASS PASS
Test 0022: expand value with default language PASS PASS PASS PASS PASS PASS PASS PASS
Test 0023: Expanding list/set with coercion PASS PASS PASS PASS PASS PASS PASS PASS
Test 0024: Multiple contexts PASS PASS PASS PASS PASS PASS PASS PASS
Test 0025: Problematic IRI expansion tests PASS PASS PASS PASS PASS PASS PASS PASS
Test 0026: Term definition with @id: @type PASS PASS PASS PASS PASS PASS PASS PASS
Test 0027: Duplicate values in @list and @set PASS PASS PASS PASS PASS PASS PASS PASS
Test 0028: Use @vocab in properties and @type but not in @id PASS PASS PASS PASS PASS PASS PASS PASS
Test 0029: Relative IRIs PASS PASS PASS PASS PASS PASS PASS PASS
Test 0030: Language maps PASS PASS PASS PASS PASS PASS PASS PASS
Test 0031: type-coercion of native types PASS PASS PASS PASS PASS PASS PASS PASS
Test 0032: Null term and @vocab PASS PASS PASS PASS PASS PASS PASS PASS
Test 0033: Using @vocab with with type-coercion PASS PASS PASS PASS PASS PASS PASS PASS
Test 0034: Multiple properties expanding to the same IRI PASS PASS PASS PASS PASS PASS PASS PASS
Test 0035: Language maps with @vocab, default language, and colliding property PASS PASS PASS PASS PASS PASS PASS PASS
Test 0036: Expanding @index PASS PASS PASS PASS PASS PASS PASS PASS
Test 0037: Expanding @reverse PASS PASS PASS PASS PASS PASS PASS PASS
Test 0038: Expanding blank node labels PASS PASS PASS PASS PASS PASS PASS PASS
Test 0039: Using terms in a reverse-maps PASS PASS PASS PASS PASS PASS PASS PASS
Test 0040: language and index expansion on non-objects PASS PASS PASS PASS PASS PASS PASS PASS
Test 0041: @language: null resets the default language PASS PASS PASS PASS PASS PASS PASS PASS
Test 0042: Reverse properties PASS PASS PASS PASS PASS PASS PASS PASS
Test 0043: Using reverse properties inside a @reverse-container PASS PASS PASS PASS PASS PASS PASS PASS
Test 0044: Index maps with language mappings PASS PASS PASS PASS PASS PASS PASS PASS
Test 0045: Top-level value objects PASS PASS PASS PASS PASS PASS PASS PASS
Test 0046: Free-floating nodes PASS PASS PASS PASS PASS PASS PASS PASS
Test 0047: Free-floating values in sets and free-floating lists PASS PASS PASS PASS PASS PASS PASS PASS
Test 0048: Terms are ignored in @id PASS PASS PASS PASS PASS PASS PASS PASS
Test 0049: String values of reverse properties PASS PASS PASS PASS PASS PASS PASS PASS
Test 0050: Term definitions with prefix separate from prefix definitions PASS PASS PASS PASS PASS PASS PASS PASS
Test 0051: Expansion of keyword aliases in term definitions PASS PASS PASS PASS PASS PASS PASS PASS
Test 0052: @vocab-relative IRIs in term definitions PASS PASS PASS PASS PASS PASS PASS PASS
Test 0053: Expand absolute IRI with @type: @vocab PASS PASS PASS PASS PASS PASS PASS PASS
Test 0054: Expand term with @type: @vocab PASS PASS PASS PASS PASS PASS PASS PASS
Test 0055: Expand @vocab-relative term with @type: @vocab PASS PASS PASS PASS PASS PASS PASS PASS
Test 0056: Use terms with @type: @vocab but not with @type: @id PASS PASS PASS PASS PASS PASS PASS PASS
Test 0057: Expand relative IRI with @type: @vocab PASS PASS PASS PASS PASS PASS PASS PASS
Test 0058: Expand compact IRI with @type: @vocab PASS PASS PASS PASS PASS PASS PASS PASS
Test 0059: Reset @vocab by setting it to null PASS PASS PASS PASS PASS PASS PASS PASS
Test 0060: Overwrite document base with @base and reset it again PASS PASS PASS PASS PASS PASS PASS PASS
Test 0061: Coercing native types to arbitrary datatypes PASS PASS PASS PASS PASS PASS PASS PASS
Test 0062: Various relative IRIs with with @base PASS PASS PASS PASS PASS PASS PASS PASS
Test 0063: Reverse property and index container PASS PASS PASS PASS PASS PASS PASS PASS
Test 0064: bnode values of reverse properties PASS PASS PASS PASS PASS PASS PASS PASS
Test 0065: Drop unmapped keys in reverse map PASS PASS PASS PASS PASS PASS PASS PASS
Test 0066: Reverse-map keys with @vocab PASS PASS PASS PASS PASS PASS PASS PASS
Test 0067: prefix://suffix not a compact IRI PASS PASS PASS PASS PASS PASS PASS PASS
Test 0068: _:suffix values are not a compact IRI PASS PASS PASS PASS PASS PASS PASS PASS
Test 0069: Compact IRI as term with type mapping PASS PASS PASS PASS PASS PASS PASS PASS
Test 0070: Compact IRI as term defined using equivalent compact IRI PASS PASS PASS PASS PASS PASS PASS PASS
Test 0071: Redefine terms looking like compact IRIs PASS PASS PASS PASS PASS PASS PASS PASS
Test 0072: Redefine term using @vocab, not itself PASS PASS PASS PASS PASS PASS PASS PASS
Test 0073: @context not first property PASS PASS PASS PASS PASS PASS PASS PASS
Test 0074: @id not first property PASS PASS PASS PASS PASS PASS PASS PASS
Test 0075: @vocab as blank node identifier PASS PASS PASS PASS PASS PASS PASS PASS
Test 0076: base option overrides document location PASS PASS PASS PASS PASS PASS PASS PASS
Test 0077: expandContext option PASS PASS PASS PASS PASS PASS PASS PASS
Percentage passed out of 77 Tests 100.0% 100.0% 100.0% 100.0% 100.0% 100.0% 100.0% 100.0%

Flattening

JSON-LD flattening tests use object comparison.

Test JSON::LD jsonld.js browser jsonld.js node.js php-json-ld PyLD JSONLD-Java JsonLD
Test 0001: drop free-floating nodes PASS PASS PASS PASS PASS PASS PASS
Test 0002: basic PASS PASS PASS PASS PASS PASS PASS
Test 0003: drop null and unmapped properties PASS PASS PASS PASS PASS PASS PASS
Test 0004: optimize @set, keep empty arrays PASS PASS PASS PASS PASS PASS PASS
Test 0005: do not expand aliased @id/@type PASS PASS PASS PASS PASS PASS PASS
Test 0006: alias keywords PASS PASS PASS PASS PASS PASS PASS
Test 0007: date type-coercion PASS PASS PASS PASS PASS PASS PASS
Test 0008: @value with @language PASS PASS PASS PASS PASS PASS PASS
Test 0009: @graph with terms PASS PASS PASS PASS PASS PASS PASS
Test 0010: native types PASS PASS PASS PASS PASS PASS PASS
Test 0011: coerced @id PASS PASS PASS PASS PASS PASS PASS
Test 0012: @graph with embed PASS PASS PASS PASS PASS PASS PASS
Test 0013: flatten already expanded PASS PASS PASS PASS PASS PASS PASS
Test 0014: @set of @value objects with keyword aliases PASS PASS PASS PASS PASS PASS PASS
Test 0015: collapse set of sets, keep empty lists PASS PASS PASS PASS PASS PASS PASS
Test 0016: context reset PASS PASS PASS PASS PASS PASS PASS
Test 0017: @graph and @id aliased PASS PASS PASS PASS PASS PASS PASS
Test 0018: override default @language PASS PASS PASS PASS PASS PASS PASS
Test 0019: remove @value = null PASS PASS PASS PASS PASS PASS PASS
Test 0020: do not remove @graph if not at top-level PASS PASS PASS PASS PASS PASS PASS
Test 0021: do not remove @graph at top-level if not only property PASS PASS PASS PASS PASS PASS PASS
Test 0022: flatten value with default language PASS PASS PASS PASS PASS PASS PASS
Test 0023: Flattening list/set with coercion PASS PASS PASS PASS PASS PASS PASS
Test 0024: Multiple contexts PASS PASS PASS PASS PASS PASS PASS
Test 0025: Problematic IRI flattening tests PASS PASS PASS PASS PASS PASS PASS
Test 0026: Term definition with @id: @type PASS PASS PASS PASS PASS PASS PASS
Test 0027: Duplicate values in @list and @set PASS PASS PASS PASS PASS PASS PASS
Test 0028: Use @vocab in properties and @type but not in @id PASS PASS PASS PASS PASS PASS PASS
Test 0029: Relative IRIs PASS PASS PASS PASS PASS PASS PASS
Test 0030: Language maps PASS PASS PASS PASS PASS PASS PASS
Test 0031: type-coercion of native types PASS PASS PASS PASS PASS PASS PASS
Test 0032: Null term and @vocab PASS PASS PASS PASS PASS PASS PASS
Test 0033: Using @vocab with with type-coercion PASS PASS PASS PASS PASS PASS PASS
Test 0034: Multiple properties expanding to the same IRI PASS PASS PASS PASS PASS PASS PASS
Test 0035: Language maps with @vocab, default language, and colliding property PASS PASS PASS PASS PASS PASS PASS
Test 0036: Flattening @index PASS PASS PASS PASS PASS PASS PASS
Test 0037: Flattening reverse properties PASS PASS PASS PASS PASS PASS PASS
Test 0038: Flattening blank node labels PASS PASS PASS PASS PASS PASS PASS
Test 0039: Using terms in a reverse-maps PASS PASS PASS PASS PASS PASS PASS
Test 0040: language and index expansion on non-objects PASS PASS PASS PASS PASS PASS PASS
Test 0041: Free-floating sets and lists PASS PASS PASS PASS PASS PASS PASS
Test 0042: List objects not equivalent PASS PASS PASS PASS PASS PASS PASS
Test 0043: Sample test manifest extract PASS PASS PASS PASS PASS PASS PASS
Test 0044: compactArrays option PASS PASS PASS PASS PASS PASS PASS
Test 0045: Blank nodes with reverse properties PASS PASS PASS PASS PASS PASS PASS
Percentage passed out of 45 Tests 100.0% 100.0% 100.0% 100.0% 100.0% 100.0% 100.0%

Remote document

Tests appropriate document loading behavior as defined in the API

Test JSON::LD jsonld.js browser jsonld.js node.js php-json-ld PyLD JsonLD
Test 0001: load JSON-LD document PASS PASS PASS PASS PASS PASS
Test 0002: load JSON document PASS PASS PASS PASS PASS PASS
Test 0003: load JSON document with extension-type PASS PASS PASS PASS PASS PASS
Test 0004: loading an unknown type raises loading document failed PASS PASS PASS PASS PASS PASS
Test 0005: Load JSON-LD through 301 redirect PASS PASS PASS PASS PASS PASS
Test 0006: Load JSON-LD through 303 redirect PASS PASS PASS PASS PASS PASS
Test 0007: Load JSON-LD through 307 redirect PASS PASS PASS PASS PASS PASS
Test 0008: Non-existant file (404) PASS PASS PASS PASS PASS PASS
Test 0009: load JSON-LD document with link PASS PASS PASS PASS PASS PASS
Test 0010: load JSON document with link PASS PASS PASS PASS PASS PASS
Test 0011: load JSON document with extension-type with link PASS PASS PASS PASS PASS PASS
Test 0012: Multiple context link headers PASS PASS PASS PASS PASS PASS
Percentage passed out of 12 Tests 100.0% 100.0% 100.0% 100.0% 100.0% 100.0%

Transform JSON-LD to RDF

JSON-LD to RDF tests generate N-Quads output and use string comparison.

Test Argo.Core.JsonLd JSON::LD RDFLib-JSONLD jsonld.js browser jsonld.js node.js php-json-ld PyLD JSONLD-Java JsonLD
Test 0001: Plain literal with URIs PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0002: Plain literal with CURIE from default context PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0003: Default subject is BNode PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0004: Literal with language tag PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0005: Extended character set literal PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0006: Typed literal PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0007: Tests 'a' generates rdf:type and object is implicit IRI PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0008: Test prefix defined in @context PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0009: Test using an empty suffix PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0010: Test object processing defines object PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0011: Test object processing defines object with implicit BNode PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0012: Multiple Objects for a Single Property PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0013: Creation of an empty list PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0014: Creation of a list with single element PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0015: Creation of a list with multiple elements PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0016: Empty IRI expands to resource location PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0017: Relative IRI expands relative resource location PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0018: Frag ID expands relative resource location PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0019: Test type coercion to anyURI PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0020: Test type coercion to typed literal PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0022: Test coercion of double value PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0023: Test coercion of integer value PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0024: Test coercion of boolean value PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0025: Test list coercion with single element PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0026: Test creation of multiple types PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0027: Simple named graph (Wikidata) PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0028: Simple named graph PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0029: named graph with embedded named graph PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0030: top-level graph with string subject reference PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0031: Reverse property PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0032: @context reordering PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0033: @id reordering PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0034: context properties reordering PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0035: non-fractional numbers converted to xsd:double PASS PASS FAIL PASS PASS PASS PASS PASS PASS
Test 0036: Use nodeMapGeneration bnode labels PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0041: drop free-floating nodes PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0042: basic PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0043: drop null and unmapped properties PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0044: optimize @set, keep empty arrays PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0045: do not expand aliased @id/@type PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0046: alias keywords PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0047: date type-coercion PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0048: @value with @language PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0049: @graph with terms PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0050: native types PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0051: coerced @id PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0052: @graph with embed PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0053: expand already expanded PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0054: @set of @value objects with keyword aliases PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0055: collapse set of sets, keep empty lists PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0056: context reset PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0057: @graph and @id aliased PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0058: override default @language PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0059: remove @value = null PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0060: do not remove @graph if not at top-level PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0061: do not remove @graph at top-level if not only property PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0062: expand value with default language PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0063: Lists and sets of properties with list/set coercion PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0064: Multiple contexts PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0065: Problematic IRI expansion tests PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0066: Expanding term mapping to @type uses @type syntax PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0067: Keep duplicate values in @list and @set PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0068: Use @vocab in properties and @type but not in @id PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0069: Relative IRIs PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0070: Language maps PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0071: type-coercion of native types PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0072: Mapping a term to null decouples it from @vocab PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0073: Using @vocab with with type-coercion PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0074: Multiple properties expanding to the same IRI PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0075: Language maps with @vocab, default language, and colliding property PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0076: Expanding @index PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0077: Expanding @reverse PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0078: Drop blank node predicates by default PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0079: Using terms in a reverse-maps PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0080: language and index expansion on non-objects PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0081: Reset the default language PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0082: Expanding reverse properties PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0083: Using reverse properties inside a @reverse-container PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0084: Ensure index maps use language mapping PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0085: Top-level value objects are removed PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0086: Free-floating nodes are removed PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0087: Remove free-floating set values and lists PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0088: Terms are ignored in @id PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0089: Using strings as value of a reverse property PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0090: Term definitions with prefix separate from prefix definitions PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0091: Expansion of keyword aliases in term definitions PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0092: @vocab-relative IRIs in term definitions PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0093: Expand absolute IRI with @type: @vocab PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0094: Expand term with @type: @vocab PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0095: Expand @vocab-relative term with @type: @vocab PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0096: Use terms with @type: @vocab but not with @type: @id PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0097: Expand relative IRI with @type: @vocab PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0098: Expand compact IRI with @type: @vocab PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0099: Reset @vocab by setting it to null PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0100: Overwrite document base with @base and reset it again PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0101: Coercing native types to arbitrary datatypes PASS PASS FAIL PASS PASS PASS PASS PASS PASS
Test 0102: Various relative IRIs with with @base PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0103: Expand a reverse property with an index-container PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0104: Expand reverse property whose values are unlabeled blank nodes PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0105: Keys that are not mapped to an IRI in a reverse-map are dropped PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0106: Use @vocab to expand keys in reverse-maps PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0107: prefix:://sufffix not a compact IRI PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0108: _::sufffix not a compact IRI PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0109: Compact IRI as term with type mapping PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0110: Redefine compact IRI with itself PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0111: Redefine terms looking like compact IRIs PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0112: Redefine term using @vocab, not itself PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0113: Dataset with a IRI named graph PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0114: Dataset with a IRI named graph PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0115: Dataset with a default and two named graphs PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0116: Dataset from node with embedded named graph PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0117: Dataset from node with embedded named graph (bnode) PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0118: produce generalized RDF flag PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0119: Blank nodes with reverse properties UNTESTED PASS PASS PASS PASS PASS PASS PASS PASS
Percentage passed out of 114 Tests 99.1% 100.0% 98.2% 100.0% 100.0% 100.0% 100.0% 100.0% 100.0%

Transform RDF to JSON-LD

Transform RDF to JSON-LD tests take N-Quads input and use object comparison.

Test Argo.Core.JsonLd JSON::LD RDFLib-JSONLD jsonld.js browser jsonld.js node.js php-json-ld PyLD JSONLD-Java JsonLD
Test 0001: Object Lists PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0002: Native Types PASS PASS FAIL PASS PASS PASS PASS PASS PASS
Test 0003: BNodes and references PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0004: Lists PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0005: Document with list PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0006: Two graphs having same subject but different values PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0007: Graph with multiple named graphs PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0008: List conversion PASS PASS FAIL PASS PASS PASS PASS PASS PASS
Test 0009: List conversion with IRI nodes PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0010: List pattern without rdf:nil PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0011: List pattern with extra properties PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0012: List pattern with cycles PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0013: List pattern with multiple values of rdf:first PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0014: List pattern with multiple values of rdf:rest PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0015: List pattern with IRI rdf:rest PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0016: List pattern with type rdf:List PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0017: Remove duplicate triples PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0018: use native types flag set to true PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0019: use rdf:type flag set to false PASS PASS PASS PASS PASS PASS PASS PASS PASS
Percentage passed out of 19 Tests 100.0% 100.0% 89.5% 100.0% 100.0% 100.0% 100.0% 100.0% 100.0%

Test Subjects

This report was tested using the following test subjects:

Argo.Core.JsonLd
Description
Argo.Core.JsonLd library for parsing/serializing JSON-LD data in .Net.
Programming Language
C#
Home Page
http://www.argodata.com/
Developer
Test Suite Compliance
Compaction Untested
Error handling Untested
Expansion 77/77 (100.0%)
Flattening Untested
Remote document Untested
Transform JSON-LD to RDF 113/114 (99.1%)
Transform RDF to JSON-LD 19/19 (100.0%)
JSON::LD
Description
RDF.rb plugin for parsing/serializing JSON-LD data.
Home Page
http://github.com/ruby-rdf/json-ld/
Developer
Test Suite Compliance
Compaction 71/71 (100.0%)
Error handling 43/43 (100.0%)
Expansion 77/77 (100.0%)
Flattening 45/45 (100.0%)
Remote document 12/12 (100.0%)
Transform JSON-LD to RDF 114/114 (100.0%)
Transform RDF to JSON-LD 19/19 (100.0%)
RDFLib-JSONLD
Programming Language
Python
Home Page
https://github.com/RDFLib/rdflib-jsonld
Developer
Test Suite Compliance
Compaction Untested
Error handling Untested
Expansion Untested
Flattening Untested
Remote document Untested
Transform JSON-LD to RDF 112/114 (98.2%)
Transform RDF to JSON-LD 17/19 (89.5%)
jsonld.js browser
Description
A JSON-LD processor for JavaScript
Programming Language
JavaScript
Home Page
https://github.com/digitalbazaar/jsonld.js
Developer
Test Suite Compliance
Compaction 71/71 (100.0%)
Error handling 43/43 (100.0%)
Expansion 77/77 (100.0%)
Flattening 45/45 (100.0%)
Remote document 12/12 (100.0%)
Transform JSON-LD to RDF 114/114 (100.0%)
Transform RDF to JSON-LD 19/19 (100.0%)
jsonld.js node.js
Description
A JSON-LD processor for JavaScript
Programming Language
JavaScript
Home Page
https://github.com/digitalbazaar/jsonld.js
Developer
Test Suite Compliance
Compaction 71/71 (100.0%)
Error handling 43/43 (100.0%)
Expansion 77/77 (100.0%)
Flattening 45/45 (100.0%)
Remote document 12/12 (100.0%)
Transform JSON-LD to RDF 114/114 (100.0%)
Transform RDF to JSON-LD 19/19 (100.0%)
php-json-ld
Description
A JSON-LD processor for PHP
Programming Language
PHP
Home Page
https://github.com/digitalbazaar/php-json-ld
Developer
Test Suite Compliance
Compaction 71/71 (100.0%)
Error handling 43/43 (100.0%)
Expansion 77/77 (100.0%)
Flattening 45/45 (100.0%)
Remote document 12/12 (100.0%)
Transform JSON-LD to RDF 114/114 (100.0%)
Transform RDF to JSON-LD 19/19 (100.0%)
PyLD
Description
A JSON-LD processor for Python
Programming Language
Python
Home Page
https://github.com/digitalbazaar/pyld
Developer
Test Suite Compliance
Compaction 71/71 (100.0%)
Error handling 43/43 (100.0%)
Expansion 77/77 (100.0%)
Flattening 45/45 (100.0%)
Remote document 12/12 (100.0%)
Transform JSON-LD to RDF 114/114 (100.0%)
Transform RDF to JSON-LD 19/19 (100.0%)
JSONLD-Java
Description
An Implementation of the JSON-LD Specification for Java
Programming Language
Java
Home Page
http://github.com/jsonld-java/jsonld-java
Developer
Test Suite Compliance
Compaction 71/71 (100.0%)
Error handling 43/43 (100.0%)
Expansion 77/77 (100.0%)
Flattening 45/45 (100.0%)
Remote document Untested
Transform JSON-LD to RDF 114/114 (100.0%)
Transform RDF to JSON-LD 19/19 (100.0%)
JsonLD
Description
JSON-LD processor for PHP
Programming Language
PHP
Home Page
https://github.com/lanthaler/JsonLD
Developer
Test Suite Compliance
Compaction 71/71 (100.0%)
Error handling 43/43 (100.0%)
Expansion 77/77 (100.0%)
Flattening 45/45 (100.0%)
Remote document 12/12 (100.0%)
Transform JSON-LD to RDF 114/114 (100.0%)
Transform RDF to JSON-LD 19/19 (100.0%)

Individual Test Results

Individual test results used to construct this report are available here:

Test Definitions

Test 0001: drop free-floating nodes

Unreferenced nodes not containing properties are dropped

{"@id": "http://example.org/test#example"}
{}
Test 0002: basic

Basic term and value compaction

[{
"@id": "http://example.com/id1",
"@type": ["http://example.com/t1"],
"http://example.com/term1": ["v1"],
"http://example.com/term2": [{"@value": "v2", "@type": "http://example.com/t2"}],
"http://example.com/term3": [{"@value": "v3", "@language": "en"}],
"http://example.com/term4": [4],
"http://example.com/term5": [50, 51]
}]
{
"@context": {
"t1": "http://example.com/t1",
"t2": "http://example.com/t2",
"term1": "http://example.com/term1",
"term2": "http://example.com/term2",
"term3": "http://example.com/term3",
"term4": "http://example.com/term4",
"term5": "http://example.com/term5"
},
"@id": "http://example.com/id1",
"@type": "t1",
"term1": "v1",
"term2": {"@value": "v2", "@type": "t2"},
"term3": {"@value": "v3", "@language": "en"},
"term4": 4,
"term5": [50, 51]
}
Test 0003: drop null and unmapped properties

Properties mapped to null or which are never mapped are dropped

{
"@id": "http://example.org/id",
"http://example.org/property": null,
"regularJson": {
"nonJsonLd": "property",
"deep": [{
"foo": "bar"
}, {
"bar": "foo"
}]
}
}
{}
Test 0004: optimize @set, keep empty arrays

Containers mapped to @set keep empty arrays

{
"@id": "http://example.org/id",
"http://example.com/mylist1": {"@list": []},
"http://example.com/myset2": {"@set": []},
"http://example.com/myset3": "v1",
"http://example.org/list1": {"@list": []},
"http://example.org/list2": {"@list": [null]},
"http://example.org/set1": {"@set": []},
"http://example.org/set2": {"@set": [null]},
"http://example.org/set3": [],
"http://example.org/set4": [null]
}
{
"@context": {
"mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
"myset2": {"@id": "http://example.com/myset2", "@container": "@set"},
"myset3": {"@id": "http://example.com/myset3", "@container": "@set"}
},
"@id": "http://example.org/id",
"mylist1": [],
"myset2": [],
"myset3": ["v1"],
"http://example.org/list1": {"@list": []},
"http://example.org/list2": {"@list": []},
"http://example.org/set1": [],
"http://example.org/set2": [],
"http://example.org/set3": [],
"http://example.org/set4": []
}
Test 0005: @type and prefix compaction

Compact uses prefixes in @type

{
"@id": "http://example.org/id1",
"@type": ["http://example.org/Type1", "http://example.org/Type2"],
"http://example.org/term1": {"@value": "v1", "@type": "http://example.org/datatype"},
"http://example.org/term2": {"@id": "http://example.org/id2"}
}
{
"@context": {
"ex": "http://example.org/",
"term1": {"@id": "ex:term1", "@type": "ex:datatype"},
"term2": {"@id": "ex:term2", "@type": "@id"}
},
"@id": "ex:id1",
"@type": ["ex:Type1", "ex:Type2"],
"term1": "v1",
"term2": "ex:id2"
}
Test 0006: keep expanded object format if @type doesn't match

Values not matching a coerced @type remain in expanded form

{
"@id": "http://example.org/id1",
"@type": ["http://example.org/Type1", "http://example.org/Type2"],
"http://example.org/term1": {"@value": "v1", "@type": "http://example.org/different-datatype"},
"http://example.org/term2": {"@id": "http://example.org/id2"}
}
{
"@context": {
"ex": "http://example.org/",
"term1": {
"@id": "ex:term1",
"@type": "ex:datatype"
},
"term2": "ex:term2"
},
"@id": "ex:id1",
"@type": ["ex:Type1", "ex:Type2"],
"ex:term1": {"@value": "v1", "@type": "ex:different-datatype"},
"term2": {"@id": "ex:id2"}
}
Test 0007: add context

External context is added to the compacted document

{
"@graph": [
{
"@id": "http://example.org/test#chapter",
"http://purl.org/dc/elements/1.1/description": ["Fun"],
"http://purl.org/dc/elements/1.1/title": ["Chapter One"]
},
{
"@id": "http://example.org/test#jane",
"http://example.org/vocab#authored": [{"@id": "http://example.org/test#chapter"}],
"http://xmlns.com/foaf/0.1/name": ["Jane"]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": ["John"]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [ "this-is-not-an-IRI" ],
"http://purl.org/dc/elements/1.1/contributor": ["Writer"],
"http://purl.org/dc/elements/1.1/title": ["My Book"]
}]
}
]
}
{
"@context": {
"dc": "http://purl.org/dc/elements/1.1/",
"ex": "http://example.org/vocab#",
"ex:authored": {"@type": "@id"},
"ex:contains": {"@type": "@id"},
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@graph": [
{
"@id": "http://example.org/test#chapter",
"dc:description": "Fun",
"dc:title": "Chapter One"
},
{
"@id": "http://example.org/test#jane",
"ex:authored": "http://example.org/test#chapter",
"foaf:name": "Jane"
},
{
"@id": "http://example.org/test#john",
"foaf:name": "John"
},
{
"@id": "http://example.org/test#library",
"ex:contains": {
"@id": "http://example.org/test#book",
"dc:contributor": "Writer",
"dc:title": "My Book",
"http://example.org/vocab#contains": "this-is-not-an-IRI"
}
}
]
}
Test 0008: alias keywords

Aliases for keywords are used in compacted document

[{
"@id": "http://example.org/test#example1",
"http://example.org/test#property1": [{
"@id": "http://example.org/test#example2",
"http://example.org/test#property4": ["foo"]
}],
"http://example.org/test#property2": [{
"@id": "http://example.org/test#example3"
}],
"http://example.org/test#property3": [{
"@id": "http://example.org/test#example4"
}]
}]
{
"@context": {
"http://example.org/test#property1": {"@type": "@id"},
"http://example.org/test#property2": {"@type": "@id"},
"http://example.org/test#property3": {"@type": "@id"},
"uri": "@id"
},
"http://example.org/test#property1": {
"http://example.org/test#property4": "foo",
"uri": "http://example.org/test#example2"
},
"http://example.org/test#property2": "http://example.org/test#example3",
"http://example.org/test#property3": "http://example.org/test#example4",
"uri": "http://example.org/test#example1"
}
Test 0009: compact @id

Value with @id is compacted to string if property cast to @id

{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": {
"@id": "http://example.org/test#chapter"
},
"http://purl.org/dc/elements/1.1/title": "Title"
}
{
"@context": {
"dc": "http://purl.org/dc/elements/1.1/",
"ex": "http://example.org/vocab#",
"ex:contains": {"@type": "@id"}
},
"@id": "http://example.org/test#book",
"dc:title": "Title",
"ex:contains": "http://example.org/test#chapter"
}
Test 0010: array to @graph

An array of objects is serialized with @graph

[
{
"@id": "http://example.com/john",
"http://xmlns.com/foaf/0.1/homepage": {
"@id": "http://john.doe.org/"
},
"http://xmlns.com/foaf/0.1/name": "John Doe"
},
{
"@id": "http://example.com/jane",
"http://xmlns.com/foaf/0.1/name": "Jane Doe"
}
]
{
"@context": {
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
},
"name": "http://xmlns.com/foaf/0.1/name"
},
"@graph": [
{
"@id": "http://example.com/john",
"homepage": "http://john.doe.org/",
"name": "John Doe"
},
{
"@id": "http://example.com/jane",
"name": "Jane Doe"
}
]
}
Test 0011: compact date

Expanded value with type xsd:dateTime is represented as string with type coercion

{
"@id": "http://example.org/test#example1",
"http://example.org/vocab#date": {
"@value": "2011-01-25T00:00:00Z",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"http://example.org/vocab#embed": {
"@id": "http://example.org/test#example2",
"http://example.org/vocab#parent": {
"@id": "http://example.org/test#example1"
}
}
}
{
"@context": {
"ex": "http://example.org/vocab#",
"ex:date": {"@type": "xsd:dateTime"},
"ex:parent": {"@type": "@id"},
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "http://example.org/test#example1",
"ex:date": "2011-01-25T00:00:00Z",
"ex:embed": {
"@id": "http://example.org/test#example2",
"ex:parent": "http://example.org/test#example1"
}
}
Test 0012: native types

Native values are unmodified during compaction

{
"@id": "http://example.org/test",
"http://example.org/vocab#bool": true,
"http://example.org/vocab#int": 123
}
{
"@context": {
"ex": "http://example.org/vocab#"
},
"@id": "http://example.org/test",
"ex:bool": true,
"ex:int": 123
}
Test 0013: @value with @language

Values with @language remain in expended form by default

{
"@id": "http://example.org/test",
"http://example.org/vocab#test": {"@value": "test", "@language": "en"}
}
{
"@context": {
"ex": "http://example.org/vocab#"
},
"@id": "http://example.org/test",
"ex:test": {"@value": "test", "@language": "en"}
}
Test 0014: array to aliased @graph

Aliasing @graph uses alias in compacted document

[
{
"@id": "http://example.com/john",
"http://xmlns.com/foaf/0.1/homepage": {
"@id": "http://john.doe.org/"
},
"http://xmlns.com/foaf/0.1/name": "John Doe"
},
{
"@id": "http://example.com/jane",
"http://xmlns.com/foaf/0.1/name": "Jane Doe"
}
]
{
"@context": {
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
},
"name": "http://xmlns.com/foaf/0.1/name",
"data": "@graph"
},
"data": [
{
"@id": "http://example.com/john",
"homepage": "http://john.doe.org/",
"name": "John Doe"
},
{
"@id": "http://example.com/jane",
"name": "Jane Doe"
}
]
}
Test 0015: best match compaction

Property with values of different types use most appropriate term when compacting

[{
"@id": "http://example.com/id1",
"@type": ["http://example.com/t1"],
"http://example.com/term": [
{"@value": "v1", "@language": "de"},
{"@value": "v2", "@type": "http://example.com/t2"},
{"@value": "v3", "@language": "en"},
{"@list": [1, 2]},
"v5",
{"@value": "plain literal"}
]
}]
{
"@context": {
"t1": "http://example.com/t1",
"t2": "http://example.com/t2",
"term1": "http://example.com/term",
"term2": {"@id": "http://example.com/term", "@type": "t2"},
"term3": {"@id": "http://example.com/term", "@language": "en"},
"term4": {"@id": "http://example.com/term", "@container": "@list"},
"term5": {"@id": "http://example.com/term", "@language": null},
"@language": "de"
},
"@id": "http://example.com/id1",
"@type": "t1",
"term1": "v1",
"term2": "v2",
"term3": "v3",
"term4": [ 1, 2 ],
"term5": [ "v5", "plain literal" ]
}
Test 0016: recursive named graphs

Compacting a document with multiple embedded uses of @graph

[
{
"@id": "http://data.wikipedia.org/snaks/Assertions",
"@type": "http://data.wikipedia.org/vocab#SnakSet",
"http://data.wikipedia.org/vocab#assertedBy": [
{ "@value": "Gregg Kellogg" }
],
"@graph": [
{
"@id": "http://data.wikipedia.org/snaks/BerlinFact",
"@type": [ "http://data.wikipedia.org/vocab#Snak" ],
"http://data.wikipedia.org/vocab#assertedBy": [ { "@value": "Statistik Berlin/Brandenburg" } ],
"@graph": [
{
"@id": "http://en.wikipedia.org/wiki/Berlin",
"http://data.wikipedia.org/vocab#population": [ 3499879 ]
}
]
}
]
}
]
{
"@context": {
"wd": "http://data.wikipedia.org/vocab#",
"ws": "http://data.wikipedia.org/snaks/",
"wp": "http://en.wikipedia.org/wiki/"
},
"@id": "ws:Assertions",
"@type": "wd:SnakSet",
"@graph": [
{
"@id": "ws:BerlinFact",
"@type": "wd:Snak",
"@graph": [
{
"@id": "wp:Berlin",
"wd:population": 3499879
}
],
"wd:assertedBy": "Statistik Berlin/Brandenburg"
}
],
"wd:assertedBy": "Gregg Kellogg"
}
Test 0017: A term mapping to null removes the mapping

Mapping a term to null causes the property and its values to be removed from the compacted document

{
"http://www.w3.org/2000/01/rdf-schema#comment": [
{ "@value": "Kommentar auf Deutsch.", "@language": "de" },
{ "@value": "Comment in English.", "@language": "en" }
]
}
{
"@context": [
{
"comment": { "@id": "http://www.w3.org/2000/01/rdf-schema#comment", "@language": "en" }
},
{
"comment": null,
"comment_en": { "@id": "http://www.w3.org/2000/01/rdf-schema#comment", "@language": "en" }
}
],
"comment_en": "Comment in English.",
"http://www.w3.org/2000/01/rdf-schema#comment": { "@value": "Kommentar auf Deutsch.", "@language": "de" }
}
Test 0018: best matching term for lists

Lists with values of different types use best term in compacted document

{
"@context": {
"type1": "http://example.com/t1",
"type2": "http://example.com/t2"
},
"@id": "http://example.com/id1",
"http://example.com/term": [
{
"@set": [
{ "@value": "v0.1", "@language": "de" },
{ "@value": "v0.2", "@language": "en" },
"v0.3",
4,
true,
false
]
},
{
"@list": [
{ "@value": "v1.1", "@language": "de" },
{ "@value": "v1.2", "@language": "en" },
"v1.3",
14,
true,
false
]
},
{
"@list": [
{ "@value": "v2.1", "@language": "en" },
{ "@value": "v2.2", "@language": "en" },
{ "@value": "v2.3", "@language": "en" },
{ "@value": "v2.4", "@language": "en" },
{ "@value": "v2.5", "@language": "en" },
{ "@value": "v2.6", "@language": "en" }
]
},
{
"@list": [
"v3.1",
"v3.2",
"v3.3",
"v3.4",
"v3.5",
"v3.6"
]
},
{
"@list": [
{ "@value": "v4.1", "@type": "type1" },
{ "@value": "v4.2", "@type": "type1" },
{ "@value": "v4.3", "@type": "type1" },
{ "@value": "v4.4", "@type": "type1" },
{ "@value": "v4.5", "@type": "type1" },
{ "@value": "v4.6", "@type": "type1" }
]
},
{
"@list": [
{ "@value": "v5.1", "@type": "type2" },
{ "@value": "v5.2", "@type": "type2" },
{ "@value": "v5.3", "@type": "type2" },
{ "@value": "v5.4", "@type": "type2" },
{ "@value": "v5.5", "@type": "type2" },
{ "@value": "v5.6", "@type": "type2" }
]
}
]
}
{
"@context": {
"type1": "http://example.com/t1",
"type2": "http://example.com/t2",
"@language": "de",
"term": { "@id": "http://example.com/term" },
"term1": { "@id": "http://example.com/term", "@container": "@list" },
"term2": { "@id": "http://example.com/term", "@container": "@list", "@language": "en" },
"term3": { "@id": "http://example.com/term", "@container": "@list", "@language": null },
"term4": { "@id": "http://example.com/term", "@container": "@list", "@type": "type1" },
"term5": { "@id": "http://example.com/term", "@container": "@list", "@type": "type2" }
},
"@id": "http://example.com/id1",
"term": [
"v0.1",
{ "@value": "v0.2", "@language": "en" },
{ "@value": "v0.3" },
4,
true,
false
],
"term1": [
"v1.1",
{ "@value": "v1.2", "@language": "en" },
{ "@value": "v1.3" },
14,
true,
false
],
"term2": [
"v2.1",
"v2.2",
"v2.3",
"v2.4",
"v2.5",
"v2.6"
],
"term3": [
"v3.1",
"v3.2",
"v3.3",
"v3.4",
"v3.5",
"v3.6"
],
"term4": [
"v4.1",
"v4.2",
"v4.3",
"v4.4",
"v4.5",
"v4.6"
],
"term5": [
"v5.1",
"v5.2",
"v5.3",
"v5.4",
"v5.5",
"v5.6"
]
}
Test 0019: Keep duplicate values in @list and @set

Duplicate values in @list or @set are retained in compacted document

[{
"@id": "http://example.org/id",
"http://example.com/mylist": [{
"@list": [
{"@value": 1},
{"@value": 2},
{"@value": 2},
{"@value": 3}
]
}],
"http://example.com/myset": [
{"@value": 1},
{"@value": 2},
{"@value": 2},
{"@value": 3}
]
}]
{
"@context": {
"mylist": {"@id": "http://example.com/mylist", "@container": "@list"},
"myset": {"@id": "http://example.com/myset", "@container": "@set"}
},
"@id": "http://example.org/id",
"mylist": [1, 2, 2, 3],
"myset": [1, 2, 2, 3]
}
Test 0020: Compact @id that is a property IRI when @container is @list

A term with @container: @list is also used as the value of an @id, if appropriate

{
"@context": {
"ex": "http://example.org/ns#"
},
"@id": "ex:property",
"ex:property": {
"@list": [1, 2]
}
}
{
"@context": {
"ex": "http://example.org/ns#",
"ex:property": {
"@container": "@list"
}
},
"@id": "ex:property",
"ex:property": [1, 2]
}
Test 0021: Compact properties and types using @vocab

@vocab is used to create relative properties and types if no other term matches

[
{
"@id": "http://example.com/subdir/id/1",
"@type": [ "http://example.com/subdir/vocab/types/Test" ],
"http://example.com/subdir/vocab/date": [
{
"@value": "2011-01-25T00:00:00Z",
"@type": "http://example.com/subdir/vocab/types/dateTime"
}
],
"http://example.com/subdir/vocab/embed": [
{
"@id": "http://example.com/subdir/id/2",
"http://example.com/subdir/vocab/expandedDate": [
{
"@value": "2012-08-01T00:00:00Z",
"@type": "http://example.com/subdir/vocab/types/dateTime"
}
]
}
]
}
]
{
"@context": {
"@vocab": "http://example.com/subdir/",
"vocab/date": { "@type": "vocab/types/dateTime" }
},
"@id": "http://example.com/subdir/id/1",
"@type": "vocab/types/Test",
"vocab/date": "2011-01-25T00:00:00Z",
"vocab/embed": {
"@id": "http://example.com/subdir/id/2",
"vocab/expandedDate": {
"@value": "2012-08-01T00:00:00Z",
"@type": "vocab/types/dateTime"
}
}
}
Test 0022: @list compaction of nested properties

Compact nested properties using @list containers

[
{
"@id": "https://example.org/ns#Game",
"@type": [
"http://www.w3.org/2002/07/owl#Class"
],
"https://example.org/ns#properties": [
{
"@list": [
{
"@id": "https://example.org/ns#title"
},
{
"@id": "https://example.org/ns#slug"
}
]
}
]
},
{
"@id": "https://example.org/ns#properties",
"@type": [
"http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"
]
},
{
"@id": "https://example.org/ns#slug",
"@type": [
"http://www.w3.org/2002/07/owl#DataProperty",
"http://www.w3.org/2002/07/owl#FunctionalProperty"
]
},
{
"@id": "https://example.org/ns#title",
"@type": [
"http://www.w3.org/2002/07/owl#DataProperty"
]
}
]
{
"@context": {
"owl": "http://www.w3.org/2002/07/owl#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"ex": "https://example.org/ns#",
"id": "@id",
"type": "@type",
"ex:properties": {
"@container": "@list"
}
},
"@graph": [
{
"id": "ex:Game",
"type": "owl:Class",
"ex:properties": [
{ "id": "ex:title" },
{ "id": "ex:slug" }
]
},
{
"id": "ex:properties",
"type": "rdf:Property"
},
{
"id": "ex:slug",
"type": [ "owl:DataProperty", "owl:FunctionalProperty" ]
},
{
"id": "ex:title",
"type": "owl:DataProperty"
}
]
}
Test 0023: prefer @vocab over compacted IRIs

@vocab takes precedence over prefixes - even if the result is longer

[
{
"@id": "http://example.com/subdir/id/1",
"@type": [ "http://example.com/subdir/vocab/types/Test" ],
"http://example.com/subdir/vocab/date": [
{
"@value": "2011-01-25T00:00:00Z",
"@type": "http://example.com/subdir/vocab/types/dateTime"
}
],
"http://example.com/subdir/vocab/embed": [
{
"@id": "http://example.com/subdir/id/2",
"http://example.com/subdir/vocab/expandedDate": [
{
"@value": "2012-08-01T00:00:00Z",
"@type": "http://example.com/subdir/vocab/types/dateTime"
}
]
}
]
}
]
{
"@context": {
"@vocab": "http://example.com/",
"ex": "http://example.com/subdir/",
"ex:vocab/date": { "@type": "ex:vocab/types/dateTime" }
},
"@id": "ex:id/1",
"@type": "subdir/vocab/types/Test",
"ex:vocab/date": "2011-01-25T00:00:00Z",
"subdir/vocab/embed": {
"@id": "ex:id/2",
"subdir/vocab/expandedDate": {
"@value": "2012-08-01T00:00:00Z",
"@type": "subdir/vocab/types/dateTime"
}
}
}
Test 0024: most specific term matching in @list.

The most specific term that matches all of the elements in the list, taking into account the default language, must be selected.

{

"@context": {
"type1": "http://example.com/t1",
"type2": "http://example.com/t2"
},
"@id": "http://example.com/id1",
"http://example.com/termLanguage": [
{
"@list": [
{ "@value": "termLL0.1", "@language": "de" },
{ "@value": "termLL0.2", "@language": "de" }
]
},
{
"@list": [
{ "@value": "termLL1.1", "@language": "en" },
{ "@value": "termLL1.2", "@language": "en" }
]
},
{
"@list": [
"termLL2.1",
"termLL2.2"
]
}
],
"http://example.com/termType": [
{
"@list": [
{ "@value": "termTL0.1", "@type": "type1" },
{ "@value": "termTL0.2", "@type": "type2" }
]
},
{
"@list": [
{ "@value": "termTL1.1", "@type": "type1" },
{ "@value": "termTL1.2", "@type": "type1" }
]
},
{
"@list": [
{ "@value": "termTL2.1", "@type": "type2" },
{ "@value": "termTL2.2", "@type": "type2" }
]
}
]
}
{
"@context": {
"type1": "http://example.com/t1",
"type2": "http://example.com/t2",
"@language": "de",
"termL": { "@id": "http://example.com/termLanguage" },
"termLL0": { "@id": "http://example.com/termLanguage", "@container": "@list" },
"termLL1": { "@id": "http://example.com/termLanguage", "@container": "@list", "@language": "en" },
"termLL2": { "@id": "http://example.com/termLanguage", "@container": "@list", "@language": null },
"termT": { "@id": "http://example.com/termType" },
"termTL0": { "@id": "http://example.com/termType", "@container": "@list" },
"termTL1": { "@id": "http://example.com/termType", "@container": "@list", "@type": "type1" },
"termTL2": { "@id": "http://example.com/termType", "@container": "@list", "@type": "type2" }
},
"@id": "http://example.com/id1",
"termLL0": [
"termLL0.1",
"termLL0.2"
],
"termLL1": [
"termLL1.1",
"termLL1.2"
],
"termLL2": [
"termLL2.1",
"termLL2.2"
],
"termTL0": [
{
"@type": "type1",
"@value": "termTL0.1"
},
{
"@type": "type2",
"@value": "termTL0.2"
}
],
"termTL1": [
"termTL1.1",
"termTL1.2"
],
"termTL2": [
"termTL2.1",
"termTL2.2"
]
}
Test 0025: Language maps

Multiple values with different languages use language maps if property has @container: @language

[
{
"@id": "http://example.com/queen",
"http://example.com/vocab/label":
[
{
"@value": "The Queen",
"@language": "en"
}, {
"@value": "Die Königin",
"@language": "de"
}, {
"@value": "Ihre Majestät",
"@language": "de"
}
]
}
]
{
"@context": {
"vocab": "http://example.com/vocab/",
"label": {
"@id": "vocab:label",
"@container": "@language"
}
},
"@id": "http://example.com/queen",
"label": {
"en": "The Queen",
"de": [ "Die Königin", "Ihre Majestät" ]
}
}
Test 0026: Language map term selection with complications

Test appropriate property use given language maps with @vocab, a default language, and a competing term

[{
"@id": "http://example.com/queen",
"http://example.com/vocab/label": [
{
"@value": "Il re",
"@language": "it"
}, {
"@value": "The king",
"@language": "en"
}, {
"@value": "The Queen",
"@language": "en"
}, {
"@value": "Die Königin",
"@language": "de"
}, {
"@value": "Ihre Majestät",
"@language": "de"
}
]
}]
{
"@context": {
"@vocab": "http://example.com/vocab/",
"@language": "it",
"s": { "@id": "label", "@language": "en" },
"label": {
"@container": "@language"
}
},
"@id": "http://example.com/queen",
"label": {
"it": "Il re",
"en": [ "The king", "The Queen" ],
"de": [ "Die Königin", "Ihre Majestät" ]
}
}
Test 0027: @container: @set with multiple values

Fall back to term with @set container if term with language map is defined

[{
"@id": "http://example.com/queen",
"http://example.com/vocab/label": [
{
"@value": "Il re",
"@language": "it"
}, {
"@value": "The king",
"@language": "en"
}, {
"@value": "The Queen",
"@language": "en"
}, {
"@value": "Die Königin",
"@language": "de"
}, {
"@value": "Ihre Majestät",
"@language": "de"
}
]
}]
{
"@context": {
"label": "http://example.com/vocab/label",
"container": { "@id": "label", "@container": "@set" }
},
"@id": "http://example.com/queen",
"container": [
{
"@value": "Il re",
"@language": "it"
}, {
"@value": "The king",
"@language": "en"
}, {
"@value": "The Queen",
"@language": "en"
}, {
"@value": "Die Königin",
"@language": "de"
}, {
"@value": "Ihre Majestät",
"@language": "de"
}
]
}
Test 0028: Alias keywords and use @vocab

Combination of keyword aliases and @vocab

{
"@context": {
"@vocab": "http://xmlns.com/foaf/0.1/",
"homepage": {
"@type": "@id"
},
"uri": "@id"
},
"uri": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"homepage": "http://www.markus-lanthaler.com/"
}
{
"@context": {
"@vocab": "http://xmlns.com/foaf/0.1/",
"homepage": {
"@type": "@id"
},
"uri": "@id"
},
"uri": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"homepage": "http://www.markus-lanthaler.com/"
}
Test 0029: Simple @index map

Output uses index mapping if term is defined with @container: @index

[{
"@id": "http://example.com/article",
"http://example.com/vocab/author": [{
"@id": "http://example.org/person/1",
"@index": "regular"
}, {
"@id": "http://example.org/guest/cd24f329aa",
"@index": "guest"
}]
}]
{
"@context": {
"author": {
"@id": "http://example.com/vocab/author",
"@container": "@index"
}
},
"@id": "http://example.com/article",
"author": {
"regular": {
"@id": "http://example.org/person/1"
},
"guest": {
"@id": "http://example.org/guest/cd24f329aa"
}
}
}
Test 0030: non-matching @container: @index

Preserve @index tags if not compacted to an index map

[
{
"@id": "http://example.org/indexTest",
"http://example.com/container": [
{
"@id": "http://example.org/nodeWithoutIndexA",
"@index": "A"
},
{
"@id": "http://example.org/nodeWithIndexA",
"@index": "this overrides the 'A' index from the container"
},
{
"@value": 1,
"@index": "A"
},
{
"@value": true,
"@index": "A"
},
{
"@value": false,
"@index": "A"
},
{
"@value": "simple string A",
"@index": "A"
},
{
"@value": "typed literal A",
"@type": "http://example.org/type",
"@index": "A"
},
{
"@value": "language-tagged string A",
"@language": "en",
"@index": "A"
},
{
"@value": "simple string B",
"@index": "B"
},
{
"@id": "http://example.org/nodeWithoutIndexC",
"@index": "C"
},
{
"@id": "http://example.org/nodeWithIndexC",
"@index": "this overrides the 'C' index from the container"
},
{
"@value": 3,
"@index": "C"
},
{
"@value": true,
"@index": "C"
},
{
"@value": false,
"@index": "C"
},
{
"@value": "simple string C",
"@index": "C"
},
{
"@value": "typed literal C",
"@type": "http://example.org/type",
"@index": "C"
},
{
"@value": "language-tagged string C",
"@language": "en",
"@index": "C"
}
],
"http://example.com/property": [
{
"@id": "http://example.org/nodeWithoutIndexProp"
},
{
"@id": "http://example.org/nodeWithIndexProp",
"@index": "prop"
},
{
"@value": 3,
"@index": "prop"
},
{
"@value": true,
"@index": "prop"
},
{
"@value": false,
"@index": "prop"
},
{
"@value": "simple string no index"
},
{
"@value": "typed literal Prop",
"@type": "http://example.org/type",
"@index": "prop"
},
{
"@value": "language-tagged string Prop",
"@language": "en",
"@index": "prop"
},
{
"@value": "index using an array with just one element (automatic recovery)",
"@index": "prop"
}
]
}
]
{
"@context": {
"property": "http://example.com/property",
"indexContainer": { "@id": "http://example.com/container", "@container": "@index" }
},
"@id": "http://example.org/indexTest",
"indexContainer": {
"A": [
{
"@id": "http://example.org/nodeWithoutIndexA"
},
1,
true,
false,
"simple string A",
{
"@value": "typed literal A",
"@type": "http://example.org/type"
},
{
"@value": "language-tagged string A",
"@language": "en"
}
],
"this overrides the 'A' index from the container": {
"@id": "http://example.org/nodeWithIndexA"
},
"B": "simple string B",
"C": [
{
"@id": "http://example.org/nodeWithoutIndexC"
},
3,
true,
false,
"simple string C",
{
"@value": "typed literal C",
"@type": "http://example.org/type"
},
{
"@value": "language-tagged string C",
"@language": "en"
}
],
"this overrides the 'C' index from the container": {
"@id": "http://example.org/nodeWithIndexC"
}
},
"property": [
{
"@id": "http://example.org/nodeWithoutIndexProp"
},
{
"@id": "http://example.org/nodeWithIndexProp",
"@index": "prop"
},
{
"@value": 3,
"@index": "prop"
},
{
"@value": true,
"@index": "prop"
},
{
"@value": false,
"@index": "prop"
},
"simple string no index",
{
"@value": "typed literal Prop",
"@type": "http://example.org/type",
"@index": "prop"
},
{
"@value": "language-tagged string Prop",
"@language": "en",
"@index": "prop"
},
{
"@value": "index using an array with just one element (automatic recovery)",
"@index": "prop"
}
]
}
Test 0031: Compact @reverse

Compact traverses through @reverse

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
}
}
}
Test 0032: Compact keys in reverse-maps

Compact traverses through @reverse

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
}
}
}
Test 0033: Compact reverse-map to reverse property

A reverse map is replaced with a matching property defined with @reverse

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
}
}
Test 0034: Skip property with @reverse if no match

Do not use reverse property if no other property matches as normal property

[
{
"@id": "http://example.com/people/markus",
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
},
{
"@id": "http://example.com/people/gregg",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Gregg Kellogg" } ]
}
],
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
{
"@id": "http://example.com/people/gregg",
"name": "Gregg Kellogg"
}
]
}
Test 0035: Compact @reverse node references using strings

Compact node references to strings for reverse properties using @type: @id

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave"
},
{
"@id": "http://example.com/people/gregg"
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@type": "@id" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": [
"http://example.com/people/dave",
"http://example.com/people/gregg"
]
}
Test 0036: Compact reverse properties using index containers

Compact using both reverse properties and index containers

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"@index": "Dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
},
{
"@id": "http://example.com/people/gregg",
"@index": "Gregg",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Gregg Kellogg" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@container": "@index" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": {
"Dave": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
"Gregg": {
"@id": "http://example.com/people/gregg",
"name": "Gregg Kellogg"
}
}
}
Test 0037: Compact keys in @reverse using @vocab

Compact keys in @reverse using @vocab

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
}
],
"http://example.com/vocab/noTerm": [
{
"@id": "http://json-ld.org/test-suite/tests/relative-node",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Compact keys using @vocab" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows",
"@vocab": "http://example.com/vocab/"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
"noTerm": {
"@id": "relative-node",
"name": "Compact keys using @vocab"
}
}
}
Test 0038: Index map round-tripping

Complext round-tripping use case from Drupal

{
"@context": {
"site": "http://example.com/",
"site-cd": "site:site-schema/content-deployment/",
"title": {
"@id": "site-cd:node/article/title",
"@container": "@index"
},
"body": {
"@id": "site-cd:node/article/body",
"@container": "@index"
},
"field_tags": {
"@id": "site-cd:node/article/field_tags",
"@container": "@index"
}
},
"@id": "site:node/1",
"@type": "site-cd:node/article",
"title": {
"en": [
{
"@context": {
"value": "site-cd:node/article/title/value"
},
"@type": "site-cd:field-types/title_field",
"value": "This is the English title"
}
],
"es": [
{
"@context": {
"value": "site-cd:node/article/title/value"
},
"@type": "site-cd:field-types/title_field",
"value": "Este es el t’tulo espa–ol"
}
]
},
"body": {
"en": [
{
"@context": {
"value": "site-cd:node/article/body/value",
"summary": "site-cd:node/article/body/summary",
"format": "site-cd:node/article/body/format"
},
"@type": "site-cd:field-types/text_with_summary",
"value": "This is the English body. There is no Spanish body, so this will be displayed for both the English and Spanish versions.",
"summary": "This is the teaser for the body.",
"format": "full_html"
}
]
},
"field_tags": {
"en": [
{
"@context": {
"uuid": "site-cd:taxonomy/term/uuid"
},
"@type": "site-cd:taxonomy/term",
"@id": "site:taxonomy/term/1",
"uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
}
],
"es": [
{
"@context": {
"uuid": "site-cd:taxonomy/term/uuid"
},
"@type": "site-cd:taxonomy/term",
"@id": "site:taxonomy/term/1",
"uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
},
{
"@context": {
"uuid": "site-cd:taxonomy/term/uuid"
},
"@type": "site-cd:taxonomy/term",
"@id": "site:taxonomy/term/2",
"uuid": "a55b982c-58ac-4862-9b00-aa221a388010"
}
]
}
}
{
"@context": {
"site": "http://example.com/",
"site-cd": "site:site-schema/content-deployment/",
"title": {
"@id": "site-cd:node/article/title",
"@container": "@index"
},
"body": {
"@id": "site-cd:node/article/body",
"@container": "@index"
},
"field_tags": {
"@id": "site-cd:node/article/field_tags",
"@container": "@index"
}
},
"@id": "site:node/1",
"@type": "site-cd:node/article",
"title": {
"en": {
"@type": "site-cd:field-types/title_field",
"title:/value": "This is the English title"
},
"es": {
"@type": "site-cd:field-types/title_field",
"title:/value": "Este es el t’tulo espa–ol"
}
},
"body": {
"en": {
"@type": "site-cd:field-types/text_with_summary",
"body:/value": "This is the English body. There is no Spanish body, so this will be displayed for both the English and Spanish versions.",
"body:/summary": "This is the teaser for the body.",
"body:/format": "full_html"
}
},
"field_tags": {
"en": {
"@type": "site-cd:taxonomy/term",
"@id": "site:taxonomy/term/1",
"site-cd:taxonomy/term/uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
},
"es": [
{
"@type": "site-cd:taxonomy/term",
"@id": "site:taxonomy/term/1",
"site-cd:taxonomy/term/uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
},
{
"@type": "site-cd:taxonomy/term",
"@id": "site:taxonomy/term/2",
"site-cd:taxonomy/term/uuid": "a55b982c-58ac-4862-9b00-aa221a388010"
}
]
}
}
Test 0039: @graph is array

Value of @graph is always an array

[
{
"@id": "http://example.com/graph/1",
"@graph": [
{
"@id": "http://example.com/node/1",
"http://example.com/property": [ { "@value": "property" } ]
}
]
}
]
{
"@id": "http://example.com/graph/1",
"@graph": [
{
"@id": "http://example.com/node/1",
"http://example.com/property": "property"
}
]
}
Test 0040: @list is array

Ensure that value of @list is always an array

[
{
"@id": "http://me.markus-lanthaler.com/",
"http://example.com/list": {
"@list": [
"one item"
]
}
}
]
{
"@id": "http://me.markus-lanthaler.com/",
"http://example.com/list": {
"@list": [
"one item"
]
}
}
Test 0041: index rejects term having @list

If an index is present, a term having an @list container is not selected

[
{
"@id": "http://example.com/node",
"http://example.com/property": [
{
"@index": "an index",
"@list": [
{
"@value": "one item"
}
]
}
]
}
]
{
"@context": {
"name": { "@id": "http://example.com/property", "@container": "@list" }
},
"@id": "http://example.com/node",
"http://example.com/property": {
"@list": [
"one item"
],
"@index": "an index"
}
}
Test 0042: @list keyword aliasing

Make sure keyword aliasing works if a list can't be compacted

[
{
"@id": "http://example.com/node",
"http://example.com/property": [
{
"@list": [
{
"@value": "one item"
}
],
"@index": "an index"
}
]
}
]
{
"@context": {
"listAlias": "@list",
"indexAlias": "@index"
},
"@id": "http://example.com/node",
"http://example.com/property": {
"listAlias": [
"one item"
],
"indexAlias": "an index"
}
}
Test 0043: select term over @vocab

Ensure that @vocab compaction isn't used if the result collides with a term

[
{
"@id": "http://example.com/node",
"http://example.com/name": [
{ "@value": "Markus Lanthaler" }
]
}
]
{
"@context": {
"@vocab": "http://example.com/",
"name": "http://xmlns.com/foaf/0.1/name"
},
"@id": "http://example.com/node",
"http://example.com/name": "Markus Lanthaler"
}
Test 0044: @type: @vocab in reverse-map

Prefer properties with @type: @vocab in reverse-maps if the value can be compacted to a term

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave"
},
{
"@id": "http://example.com/people/DefinedTerm"
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": { "@id": "http://xmlns.com/foaf/0.1/knows", "@type": "@id" },
"knowsVocab": { "@id": "http://xmlns.com/foaf/0.1/knows", "@type": "@vocab" },
"DefinedTerm": "http://example.com/people/DefinedTerm"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"knows": "http://example.com/people/dave",
"knowsVocab": "DefinedTerm"
}
}
Test 0045: @id value uses relative IRI, not term

Values of @id are transformed to relative IRIs, terms are ignored

[
{
"@id": "http://json-ld.org/test-suite/tests/term",
"http://example.com/property": [
{
"@id": "http://example.com/compact-iris-are-considered",
"http://example.com/property": [
{ "@value": "@id supports the following values: relative, absolute, and compact IRIs" }
]
},
{
"@id": "http://json-ld.org/test-suite/parent-node",
"http://example.com/property": [
{ "@value": "relative IRIs get resolved against the document's base IRI" }
]
}
]
}
]
{
"@context": {
"term": "http://example.com/terms-are-not-considered-in-id",
"compact-iris": "http://example.com/compact-iris-",
"property": "http://example.com/property",
"@vocab": "http://example.org/vocab-is-not-considered-for-id"
},
"@id": "term",
"property": [
{
"@id": "compact-iris:are-considered",
"property": "@id supports the following values: relative, absolute, and compact IRIs"
},
{
"@id": "../parent-node",
"property": "relative IRIs get resolved against the document's base IRI"
}
]
}
Test 0046: multiple objects without @context use @graph

Wrap top-level array into @graph even if no context is passed

[
{
"@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"
}
]
{
"@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"
}
]
}
Test 0047: Round-trip relative URLs

Relative URLs remain relative after compaction

{
"@context": {
"@base": "http://example.com/",
"link": { "@id": "http://example.com/link", "@type": "@id" }
},
"link": "relative-url"
}
{
"@context": {
"@base": "http://example.com/",
"link": { "@id": "http://example.com/link", "@type": "@id" }
},
"link": "relative-url"
}
Test 0048: term with @language: null

Prefer terms with a language mapping set to null over terms without language-mapping for non-strings

{
"http://example.com/propertyA": 5,
"http://example.com/propertyB": 5
}
{
"@context": {
"@language": "de",
"propertyLanguageNull": {
"@id": "http://example.com/propertyA",
"@language": null
},
"propertyNoLang": "http://example.com/propertyA",
"propertyB": "http://example.com/propertyB"
},
"propertyLanguageNull": 5,
"propertyB": 5
}
Test 0049: Round tripping of lists that contain just IRIs

List compaction without @container: @list still uses strings if @type: @id

{
"@context": {
"property": { "@id": "http://example.org", "@type": "@id" }
},
"property": { "@list": [ "http://example.com/node/a", "http://example.com/node/b", "http://example.com/node/c" ] }
}
{
"@context": {
"property": { "@id": "http://example.org", "@type": "@id" }
},
"property": { "@list": [ "http://example.com/node/a", "http://example.com/node/b", "http://example.com/node/c" ] }
}
Test 0050: Reverse properties require @type: @id to use string values

Node references in reverse properties are not compacted to strings without explicit type-coercion

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave"
},
{
"@id": "http://example.com/people/gregg"
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": [
{ "@id": "http://example.com/people/dave" },
{ "@id": "http://example.com/people/gregg" }
]
}
Test 0051: Round tripping @list with scalar

Native values survive round-tripping with @list

{
"http://example.org/term": {
"@list": [1]
}
}
{
"http://example.org/term": {
"@list": [1]
}
}
Test 0052: Round tripping @list with scalar and @graph alias

Native values survive round-tripping with @list and @graph alias

{
"@context": {
"graph": "@graph",
"term": "http://example.org/term"
},
"graph": [
{
"term": {
"@list": [1]
}
},
{
"term": {
"@list": [2]
}
}
]
}
{
"@context": {
"graph": "@graph",
"term": "http://example.org/term"
},
"graph": [
{
"term": {
"@list": [1]
}
},
{
"term": {
"@list": [2]
}
}
]
}
Test 0053: Use @type: @vocab if no @type: @id

Compact to @type: @vocab when no @type: @id term available

[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"}
},
"term": "http://example.org/enum"
}
Test 0054: Compact to @type: @vocab and compact @id to term

Compact to @type: @vocab and compact @id to term

[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"},
"enum": {"@id": "http://example.org/enum"}
},
"term": "enum"
}
Test 0055: Round tripping @type: @vocab

Compacting IRI value of property with @type: @vocab can use term

{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"},
"enum": {"@id": "http://example.org/enum"}
},
"term": "enum"
}
{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"},
"enum": {"@id": "http://example.org/enum"}
},
"term": "enum"
}
Test 0056: Prefer @type: @vocab over @type: @id for terms

Compacting IRI value of property with @type: @vocab can use term

[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"},
"doNotSelect": {"@id": "http://example.org/term"},
"enum": {"@id": "http://example.org/enum"}
},
"term": "enum"
}
Test 0057: Complex round tripping @type: @vocab and @type: @id

Compacting IRI value of property with @type: @vocab can use term; more complex

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepageID": { "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id" },
"homepageV": { "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@vocab" },
"linkID": { "@id": "http://example.com/link", "@type": "@id" },
"linkV": { "@id": "http://example.com/link", "@type": "@vocab" },
"MarkusHomepage": "http://www.markus-lanthaler.com/",
"relative-iri": "http://example.com/error-if-this-is-used-for-link"
},
"@id": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"homepageV": "MarkusHomepage",
"linkID": "relative-iri"
}
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepageID": { "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id" },
"homepageV": { "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@vocab" },
"linkID": { "@id": "http://example.com/link", "@type": "@id" },
"linkV": { "@id": "http://example.com/link", "@type": "@vocab" },
"MarkusHomepage": "http://www.markus-lanthaler.com/",
"relative-iri": "http://example.com/error-if-this-is-used-for-link"
},
"@id": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"homepageV": "MarkusHomepage",
"linkID": "relative-iri"
}
Test 0058: Prefer @type: @id over @type: @vocab for non-terms

Choose a term having @type: @id over @type: @value if value is not a term

[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
{
"@context": {
"notChosen": {"@id": "http://example.org/term", "@type": "@vocab"},
"chosen": {"@id": "http://example.org/term", "@type": "@id"}
},
"chosen": "http://example.org/enum"
}
Test 0059: Term with @type: @vocab if no @type: @id

If there's no term with @type: @id, use terms with @type: @vocab for IRIs not mapped to terms

[
{
"http://example.com/vocab#foo": [
{ "@id": "http://example.com/vocab#Bar" },
{ "@id": "http://example.com/vocab#Baz" }
]
}
]
{
"@context": {
"Bar": "http://example.com/vocab#Bar",
"foo": {
"@id": "http://example.com/vocab#foo",
"@type": "@vocab"
}
},
"foo": [
"Bar",
"http://example.com/vocab#Baz"
]
}
Test 0060: Term with @type: @id if no @type: @vocab and term value

If there's no term with @type: @vocab, use terms with @type: @id for IRIs mapped to terms

[
{
"http://example.com/vocab#foo": [
{ "@id": "http://example.com/vocab#Bar" },
{ "@id": "http://example.com/vocab#Baz" }
]
}
]
{
"@context": {
"Bar": "http://example.com/vocab#Bar",
"foo": {
"@id": "http://example.com/vocab#foo",
"@type": "@id"
}
},
"foo": [
"http://example.com/vocab#Bar",
"http://example.com/vocab#Baz"
]
}
Test 0061: @type: @vocab/@id with values matching either

Separate IRIs for the same property to use term with more specific @type (@id vs. @vocab)

[
{
"http://example.com/vocab#foo": [
{ "@id": "http://example.com/vocab#Bar" },
{ "@id": "http://example.com/vocab#Baz" }
]
}
]
{
"@context": {
"Bar": "http://example.com/vocab#Bar",
"fooI": {
"@id": "http://example.com/vocab#foo",
"@type": "@id"
},
"fooV": {
"@id": "http://example.com/vocab#foo",
"@type": "@vocab"
}
},
"fooV": "Bar",
"fooI": "http://example.com/vocab#Baz"
}
Test 0062: @type: @vocab and relative IRIs

Relative IRIs don't round-trip with @type: @vocab

{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" }
},
"term": "not-a-term-thus-a-relative-IRI"
}
{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" }
},
"term": "http://json-ld.org/test-suite/tests/not-a-term-thus-a-relative-IRI"
}
Test 0063: Compact IRI round-tripping with @type: @vocab

Term with @type: @vocab will use compact IRIs

{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" },
"prefix": "http://example.com/vocab#"
},
"term": "prefix:suffix"
}
{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" },
"prefix": "http://example.com/vocab#"
},
"term": "prefix:suffix"
}
Test 0064: Compact language-tagged and indexed strings to index-map

Given values with both @index and @language and term index-map term, use index map

[
{
"@id": "http://example.com.com/",
"http://example.com/property": [
{
"@value": "Deutsche Zeichenfolge in @index-map",
"@index": "first",
"@language": "de"
},
{
"@value": "English string in @index-map",
"@index": "second",
"@language": "en"
}
]
}
]
{
"@context": {
"property": { "@id": "http://example.com/property", "@container": "@index" }
},
"@id": "http://example.com.com/",
"property": {
"first": {
"@language": "de",
"@value": "Deutsche Zeichenfolge in @index-map"
},
"second": {
"@language": "en",
"@value": "English string in @index-map"
}
}
}
Test 0065: Language-tagged and indexed strings with language-map

Language-tagged and indexed strings don't compact to language-map

[
{
"@id": "http://example.com.com/",
"http://example.com/property": [
{
"@value": "Deutsche Zeichenfolge in @index-map",
"@index": "first",
"@language": "de"
},
{
"@value": "English string in @index-map",
"@index": "second",
"@language": "en"
}
]
}
]
{
"@context": {
"property": { "@id": "http://example.com/property", "@container": "@language" }
},
"@id": "http://example.com.com/",
"http://example.com/property": [
{
"@index": "first",
"@language": "de",
"@value": "Deutsche Zeichenfolge in @index-map"
},
{
"@index": "second",
"@language": "en",
"@value": "English string in @index-map"
}
]
}
Test 0066: Relative IRIs

Complex use cases for relative IRI compaction

[
{
"@id": "http://json-ld.org/test-suite/tests/relativeIris",
"@type": [
"http://json-ld.org/test-suite/tests/link",
"http://json-ld.org/test-suite/tests/compact-0066-in.jsonld#fragment-works",
"http://json-ld.org/test-suite/tests/compact-0066-in.jsonld?query=works",
"http://json-ld.org/test-suite/tests/",
"http://json-ld.org/test-suite/",
"http://json-ld.org/test-suite/parent",
"http://json-ld.org/parent-parent-eq-root",
"http://json-ld.org/still-root",
"http://json-ld.org/too-many-dots",
"http://json-ld.org/absolute",
"http://example.org/scheme-relative"
],
"http://www.example.com/link": [ {
"@list": [
{ "@id": "http://json-ld.org/test-suite/tests/link" },
{ "@id": "http://json-ld.org/test-suite/tests/compact-0066-in.jsonld#fragment-works" },
{ "@id": "http://json-ld.org/test-suite/tests/compact-0066-in.jsonld?query=works" },
{ "@id": "http://json-ld.org/test-suite/tests/" },
{ "@id": "http://json-ld.org/test-suite/" },
{ "@id": "http://json-ld.org/test-suite/parent" },
{ "@id": "http://json-ld.org/test-suite/parent#fragment" },
{ "@id": "http://json-ld.org/parent-parent-eq-root" },
{ "@id": "http://json-ld.org/still-root" },
{ "@id": "http://json-ld.org/too-many-dots" },
{ "@id": "http://json-ld.org/absolute" },
{ "@id": "http://example.org/scheme-relative" }
]
} ]
}
]
{
"@context": {
"links": { "@id": "http://www.example.com/link", "@type": "@id", "@container": "@list" }
},
"@id": "relativeIris",
"@type": [
"http://json-ld.org/test-suite/tests/link",
"http://json-ld.org/test-suite/tests/compact-0066-in.jsonld#fragment-works",
"http://json-ld.org/test-suite/tests/compact-0066-in.jsonld?query=works",
"http://json-ld.org/test-suite/tests/",
"http://json-ld.org/test-suite/",
"http://json-ld.org/test-suite/parent",
"http://json-ld.org/parent-parent-eq-root",
"http://json-ld.org/still-root",
"http://json-ld.org/too-many-dots",
"http://json-ld.org/absolute",
"http://example.org/scheme-relative"
],
"links": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../parent#fragment",
"../../parent-parent-eq-root",
"../../still-root",
"../../too-many-dots",
"../../absolute",
"http://example.org/scheme-relative"
]
}
Test 0067: Reverse properties with blank nodes

Compact reverse property whose values are unlabeled blank nodes

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
},
{
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Gregg Kellogg" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": [
{
"name": "Dave Longley"
},
{
"name": "Gregg Kellogg"
}
]
}
Test 0068: Single value reverse properties

Single values of reverse properties are compacted as values of ordinary properties

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave"
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@container": "@set" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": [
{ "@id": "http://example.com/people/dave" }
]
}
Test 0069: Single value reverse properties with @set

Single values are kept in array form for reverse properties if the container is to @set

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave"
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@container": "@set" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": [
{ "@id": "http://example.com/people/dave" }
]
}
Test 0070: compactArrays option

Setting compactArrays to false causes single element arrays to be retained

[{
"@id": "http://example/foo",
"http://example/term": [{"@value": "value"}]
}]
{
"@context": {
"term": "http://example/term"
},
"@graph": [{
"@id": "http://example/foo",
"term": ["value"]
}]
}
Test 0071: input has multiple @contexts, output has one

Expanding input with multiple @contexts and compacting with just one doesn't output undefined properties

{
"@context": [{
"foo": "http://example.com/foo"
}, {
"bar": "http://example.com/bar"
}],
"foo": "foo-value",
"bar": "bar-value"
}
{
"@context": {
"foo": "http://example.com/foo"
},
"foo": "foo-value",
"http://example.com/bar": "bar-value"
}
Test 0001: Keywords cannot be aliased to other keywords

Verifies that an exception is raised on expansion when processing an invalid context aliasing a keyword to another keyword

{
"@context": {
"@type": "@id"
},
"@type": "http://example.org/type"
}
http://json-ld.org/test-suite/tests/keyword redefinition not loaded
Test 0002: A context may not include itself recursively (direct)

Verifies that an exception is raised on expansion when processing a context referencing itself

{
"@context": "error-0002-in.jsonld",
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/recursive context inclusion not loaded
Test 0003: A context may not include itself recursively (indirect)

Verifies that an exception is raised on expansion when processing a context referencing itself indirectly

{
"@context": "error-0003-ctx.jsonld",
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/recursive context inclusion not loaded
Test 0004: Error dereferencing a remote context

Verifies that an exception is raised on expansion when a context dereference results in an error

{
"@context": "tag:non-dereferencable-iri",
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/loading remote context failed not loaded
Test 0005: Invalid remote context

Verifies that an exception is raised on expansion when a remote context is not an object containing @context

[{
"@context": "error-0005-in.jsonld",
"@id": "http://example/test#example"
}]
http://json-ld.org/test-suite/tests/invalid remote context not loaded
Test 0006: Invalid local context

Verifies that an exception is raised on expansion when a context is not a string or object

{
"@context": true,
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid local context not loaded
Test 0007: Invalid base IRI

Verifies that an exception is raised on expansion when a context contains an invalid @base

{
"@context": {"@base": true},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid base IRI not loaded
Test 0008: Invalid vocab mapping

Verifies that an exception is raised on expansion when a context contains an invalid @vocab mapping

{
"@context": {"@vocab": true},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid vocab mapping not loaded
Test 0009: Invalid default language

Verifies that an exception is raised on expansion when a context contains an invalid @language

{
"@context": {"@language": true},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid default language not loaded
Test 0010: Cyclic IRI mapping

Verifies that an exception is raised on expansion when a cyclic IRI mapping is found

{
"@context": {
"term": {"@id": "term:term"}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/cyclic IRI mapping not loaded
Test 0011: Invalid term definition

Verifies that an exception is raised on expansion when a invalid term definition is found

{
"@context": {
"term": true
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid term definition not loaded
Test 0012: Invalid type mapping (not a string)

Verifies that an exception is raised on expansion when a invalid type mapping is found

{
"@context": {
"term": {"@id": "http://example/term", "@type": true}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid type mapping not loaded
Test 0013: Invalid type mapping (not absolute IRI)

Verifies that an exception is raised on expansion when a invalid type mapping is found

{
"@context": {
"term": {"@id": "http://example/term", "@type": "_:not-an-iri"}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid type mapping not loaded
Test 0014: Invalid reverse property (contains @id)

Verifies that an exception is raised on expansion when a invalid reverse property is found

{
"@context": {
"term": {"@id": "http://example/term", "@reverse": "http://example/reverse"}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid reverse property not loaded
Test 0015: Invalid IRI mapping (@reverse not a string)

Verifies that an exception is raised on expansion when a invalid IRI mapping is found

{
"@context": {
"term": {"@reverse": true}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid IRI mapping not loaded
Test 0016: Invalid IRI mapping (not an absolute IRI)

Verifies that an exception is raised on expansion when a invalid IRI mapping is found

{
"@context": {
"term": {"@reverse": "@reverse"}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid IRI mapping not loaded
Test 0017: Invalid reverse property (invalid @container)

Verifies that an exception is raised on expansion when a invalid reverse property is found

{
"@context": {
"term": {"@reverse": "http://example/reverse", "@container": "@list"}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid reverse property not loaded
Test 0018: Invalid IRI mapping (@id not a string)

Verifies that an exception is raised on expansion when a invalid IRI mapping is found

{
"@context": {
"term": {"@id": true}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid IRI mapping not loaded
Test 0019: Invalid keyword alias

Verifies that an exception is raised on expansion when a invalid keyword alias is found

{
"@context": {
"term": {"@id": "@context"}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid keyword alias not loaded
Test 0020: Invalid IRI mapping (no vocab mapping)

Verifies that an exception is raised on expansion when a invalid IRI mapping is found

{
"@context": {
"term": {"@container": "@set"}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid IRI mapping not loaded
Test 0021: Invalid container mapping

Verifies that an exception is raised on expansion when a invalid container mapping is found

{
"@context": {
"term": {"@id": "http://example/term", "@container": "@id"}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid container mapping not loaded
Test 0022: Invalid language mapping

Verifies that an exception is raised on expansion when a invalid language mapping is found

{
"@context": {
"term": {"@id": "http://example/term", "@language": true}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid language mapping not loaded
Test 0023: Invalid IRI mapping (relative IRI in @type)

Verifies that an exception is raised on expansion when a invalid type mapping is found

{
"@context": {
"term": {"@id": "http://example/term", "@type": "relative/iri"}
},
"@id": "http://example/test#example"
}
http://json-ld.org/test-suite/tests/invalid type mapping not loaded
Test 0024: List of lists (from array)

Verifies that an exception is raised in Expansion when a list of lists is found

{
"@context": {"foo": {"@id": "http://example.com/foo", "@container": "@list"}},
"foo": [{"@list": ["baz"]}]
}
http://json-ld.org/test-suite/tests/list of lists not loaded
Test 0025: Invalid reverse property map

Verifies that an exception is raised in Expansion when a invalid reverse property map is found

{
"@id": "http://example/foo",
"@reverse": {
"@id": "http://example/bar"
}
}
http://json-ld.org/test-suite/tests/invalid reverse property map not loaded
Test 0026: Colliding keywords

Verifies that an exception is raised in Expansion when colliding keywords are found

{
"@context": {
"id": "@id",
"ID": "@id"
},
"id": "http://example/foo",
"ID": "http://example/bar"
}
http://json-ld.org/test-suite/tests/colliding keywords not loaded
Test 0027: Invalid @id value

Verifies that an exception is raised in Expansion when an invalid @id value is found

{
"@id": true
}
http://json-ld.org/test-suite/tests/invalid @id value not loaded
Test 0028: Invalid type value

Verifies that an exception is raised in Expansion when an invalid type value is found

{
"@type": true
}
http://json-ld.org/test-suite/tests/invalid type value not loaded
Test 0029: Invalid value object value

Verifies that an exception is raised in Expansion when an invalid value object value is found

{
"http://example/prop": {"@value": ["foo"]}
}
http://json-ld.org/test-suite/tests/invalid value object value not loaded
Test 0030: Invalid language-tagged string

Verifies that an exception is raised in Expansion when an invalid language-tagged string value is found

{
"http://example/prop": {"@value": "foo", "@language": true}
}
http://json-ld.org/test-suite/tests/invalid language-tagged string not loaded
Test 0031: Invalid @index value

Verifies that an exception is raised in Expansion when an invalid @index value value is found

{
"http://example.com/vocab/indexMap": {
"@value": "simple string",
"@language": "en",
"@index": true
}
}
http://json-ld.org/test-suite/tests/invalid @index value not loaded
Test 0032: List of lists (from array)

Verifies that an exception is raised in Expansion when a list of lists is found

{
"http://example.com/foo": {"@list": [{"@list": ["baz"]}]}
}
http://json-ld.org/test-suite/tests/list of lists not loaded
Test 0033: Invalid @reverse value

Verifies that an exception is raised in Expansion when an invalid @reverse value is found

{
"http://example/prop": {
"@reverse": true
}
}
http://json-ld.org/test-suite/tests/invalid @reverse value not loaded
Test 0034: Invalid reverse property value (in @reverse)

Verifies that an exception is raised in Expansion when an invalid reverse property value is found

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": "Dave Longley"
}
}
http://json-ld.org/test-suite/tests/invalid reverse property value not loaded
Test 0035: Invalid language map value

Verifies that an exception is raised in Expansion when an invalid language map value is found

{
"@context": {
"vocab": "http://example.com/vocab/",
"label": {
"@id": "vocab:label",
"@container": "@language"
}
},
"@id": "http://example.com/queen",
"label": {
"en": true
}
}
http://json-ld.org/test-suite/tests/invalid language map value not loaded
Test 0036: Invalid reverse property value (through coercion)

Verifies that an exception is raised in Expansion when an invalid reverse property value is found

{
"@context": {
"term": {"@reverse": "http://example/reverse"}
},
"@id": "http://example/foo",
"term": {"@list": ["http://example/bar"]}
}
http://json-ld.org/test-suite/tests/invalid reverse property value not loaded
Test 0037: Invalid value object (unexpected keyword)

Verifies that an exception is raised in Expansion when an invalid value object is found

{
"http://example/foo": {"@value": "bar", "@id": "http://example/baz"}
}
http://json-ld.org/test-suite/tests/invalid value object not loaded
Test 0038: Invalid value object (@type and @language)

Verifies that an exception is raised in Expansion when an invalid value object is found

{
"http://example/foo": {"@value": "bar", "@language": "en", "@type": "http://example/type"}
}
http://json-ld.org/test-suite/tests/invalid value object not loaded
Test 0039: Invalid language-tagged value

Verifies that an exception is raised in Expansion when an invalid language-tagged value is found

{
"http://example/foo": {"@value": true, "@language": "en"}
}
http://json-ld.org/test-suite/tests/invalid language-tagged value not loaded
Test 0040: Invalid typed value

Verifies that an exception is raised in Expansion when an invalid typed value is found

{
"http://example/foo": {"@value": "bar", "@type": "_:dt"}
}
http://json-ld.org/test-suite/tests/invalid typed value not loaded
Test 0041: Invalid set or list object

Verifies that an exception is raised in Expansion when an invalid set or list object is found

{
"http://example/prop": {"@list": ["foo"], "@id": "http://example/bar"}
}
http://json-ld.org/test-suite/tests/invalid set or list object not loaded
Test 0042: Compaction to list of lists

Verifies that an exception is raised in Compaction when attempting to compact a list of lists

{
"http://example/list": [{"@list": ["foo"]}, {"@list": ["bar"]}]
}
http://json-ld.org/test-suite/tests/compaction to list of lists not loaded
Test 0043: Conflicting indexes

Verifies that an exception is raised in Flattening when conflicting indexes are found

[
{
"@id": "http://example/foo",
"@index": "bar"
},
{
"@id": "http://example/foo",
"@index": "baz"
}
]
http://json-ld.org/test-suite/tests/conflicting indexes not loaded
Test 0001: drop free-floating nodes

Expand drops unreferenced nodes having only @id

{"@id": "http://example.org/test#example"}
[ ]
Test 0002: basic

Expanding terms with different types of values

{
"@context": {
"t1": "http://example.com/t1",
"t2": "http://example.com/t2",
"term1": "http://example.com/term1",
"term2": "http://example.com/term2",
"term3": "http://example.com/term3",
"term4": "http://example.com/term4",
"term5": "http://example.com/term5"
},
"@id": "http://example.com/id1",
"@type": "t1",
"term1": "v1",
"term2": {"@value": "v2", "@type": "t2"},
"term3": {"@value": "v3", "@language": "en"},
"term4": 4,
"term5": [50, 51]
}
[{
"@id": "http://example.com/id1",
"@type": ["http://example.com/t1"],
"http://example.com/term1": [{"@value": "v1"}],
"http://example.com/term2": [{"@value": "v2", "@type": "http://example.com/t2"}],
"http://example.com/term3": [{"@value": "v3", "@language": "en"}],
"http://example.com/term4": [{"@value": 4}],
"http://example.com/term5": [{"@value": 50}, {"@value": 51}]
}]
Test 0003: drop null and unmapped properties

Verifies that null values and unmapped properties are removed from expanded output

{
"@id": "http://example.org/id",
"http://example.org/property": null,
"regularJson": {
"nonJsonLd": "property",
"deep": [{
"foo": "bar"
}, {
"bar": "foo"
}]
}
}
[ ]
Test 0004: optimize @set, keep empty arrays

Uses of @set are removed in expansion; values of @set, or just plain values which are empty arrays are retained

{
"@context": {
"mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
"mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
"myset2": {"@id": "http://example.com/myset2", "@container": "@set"},
"myset3": {"@id": "http://example.com/myset3", "@container": "@set"}
},
"@id": "http://example.org/id",
"mylist1": { "@list": [ ] },
"mylist2": "one item",
"myset2": { "@set": [ ] },
"myset3": [ "v1" ],
"http://example.org/list1": { "@list": [ null ] },
"http://example.org/list2": { "@list": [ {"@value": null} ] },
"http://example.org/set1": { "@set": [ ] },
"http://example.org/set1": { "@set": [ null ] },
"http://example.org/set3": [ ],
"http://example.org/set4": [ null ],
"http://example.org/set5": "one item",
"http://example.org/property": { "@list": "one item" }
}
[{
"@id": "http://example.org/id",
"http://example.com/mylist1": [ { "@list": [ ] } ],
"http://example.com/mylist2": [ { "@list": [ {"@value": "one item"} ] } ],
"http://example.com/myset2": [ ],
"http://example.com/myset3": [ {"@value": "v1"} ],
"http://example.org/list1": [ { "@list": [ ] } ],
"http://example.org/list2": [ { "@list": [ ] } ],
"http://example.org/set1": [ ],
"http://example.org/set1": [ ],
"http://example.org/set3": [ ],
"http://example.org/set4": [ ],
"http://example.org/set5": [ {"@value": "one item"} ],
"http://example.org/property": [ { "@list": [ {"@value": "one item"} ] } ]
}]
Test 0005: do not expand aliased @id/@type

If a keyword is aliased, it is not used when expanding

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
},
"know": "http://xmlns.com/foaf/0.1/knows",
"@iri": "@id"
},
"@id": "#me",
"know": [
{
"@id": "http://example.com/bob#me",
"name": "Bob",
"homepage": "http://example.com/bob"
}, {
"@id": "http://example.com/alice#me",
"name": "Alice",
"homepage": "http://example.com/alice"
}
]
}
[{
"@id": "http://json-ld.org/test-suite/tests/expand-0005-in.jsonld#me",
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/bob#me",
"http://xmlns.com/foaf/0.1/name": [{"@value": "Bob"}],
"http://xmlns.com/foaf/0.1/homepage": [{
"@id": "http://example.com/bob"
}]
}, {
"@id": "http://example.com/alice#me",
"http://xmlns.com/foaf/0.1/name": [{"@value": "Alice"}],
"http://xmlns.com/foaf/0.1/homepage": [{
"@id": "http://example.com/alice"
}]
}
]
}]
Test 0006: alias keywords

Aliased keywords expand in resulting document

{
"@context": {
"http://example.org/test#property1": {
"@type": "@id"
},
"http://example.org/test#property2": {
"@type": "@id"
},
"uri": "@id"
},
"http://example.org/test#property1": {
"http://example.org/test#property4": "foo",
"uri": "http://example.org/test#example2"
},
"http://example.org/test#property2": "http://example.org/test#example3",
"http://example.org/test#property3": {
"uri": "http://example.org/test#example4"
},
"uri": "http://example.org/test#example1"
}
[{
"@id": "http://example.org/test#example1",
"http://example.org/test#property1": [{
"@id": "http://example.org/test#example2",
"http://example.org/test#property4": [{"@value": "foo"}]
}],
"http://example.org/test#property2": [{
"@id": "http://example.org/test#example3"
}],
"http://example.org/test#property3": [{
"@id": "http://example.org/test#example4"
}]
}]
Test 0007: date type-coercion

Expand strings to expanded value with @type: xsd:dateTime

{
"@context": {
"ex": "http://example.org/vocab#",
"ex:date": {
"@type": "xsd:dateTime"
},
"ex:parent": {
"@type": "@id"
},
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "http://example.org/test#example1",
"ex:date": "2011-01-25T00:00:00Z",
"ex:embed": {
"@id": "http://example.org/test#example2",
"ex:parent": "http://example.org/test#example1"
}
}
[{
"@id": "http://example.org/test#example1",
"http://example.org/vocab#date": [{
"@value": "2011-01-25T00:00:00Z",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
}],
"http://example.org/vocab#embed": [{
"@id": "http://example.org/test#example2",
"http://example.org/vocab#parent": [{
"@id": "http://example.org/test#example1"
}]
}]
}]
Test 0008: @value with @language

Keep expanded values with @language, drop non-conforming value objects containing just @language

{
"@context": {
"ex": "http://example.org/vocab#"
},
"@id": "http://example.org/test",
"ex:test": { "@value": "test", "@language": "en" },
"ex:drop-lang-only": { "@language": "en" },
"ex:keep-full-value": { "@value": "only value" }
}
[
{
"@id": "http://example.org/test",
"http://example.org/vocab#test": [ { "@value": "test", "@language": "en" } ],
"http://example.org/vocab#keep-full-value": [ {"@value": "only value"} ]
}
]
Test 0009: @graph with terms

Use of @graph to contain multiple nodes within array

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
}
},
"@graph": [
{
"@id": "http://example.org/test#chapter",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#jane",
"authored": "http://example.org/test#chapter",
"name": "Jane"
},
{
"@id": "http://example.org/test#john",
"name": "John"
},
{
"@id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
[
{
"@id": "http://example.org/test#chapter",
"http://purl.org/dc/elements/1.1/description": [{"@value": "Fun"}],
"http://purl.org/dc/elements/1.1/title": [{"@value": "Chapter One"}]
},
{
"@id": "http://example.org/test#jane",
"http://example.org/vocab#authored": [{
"@id": "http://example.org/test#chapter"
}],
"http://xmlns.com/foaf/0.1/name": [{"@value": "Jane"}]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": [{"@value": "John"}]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [{
"@id": "http://example.org/test#chapter"
}],
"http://purl.org/dc/elements/1.1/contributor": [{"@value": "Writer"}],
"http://purl.org/dc/elements/1.1/title": [{"@value": "My Book"}]
}]
}
]
Test 0010: native types

Expanding native scalar retains native scalar within expanded value

{
"@context": {
"d": "http://purl.org/dc/elements/1.1/",
"e": "http://example.org/vocab#",
"f": "http://xmlns.com/foaf/0.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "http://example.org/test",
"e:bool": true,
"e:int": 123
}
[{
"@id": "http://example.org/test",
"http://example.org/vocab#bool": [{"@value": true}],
"http://example.org/vocab#int": [{"@value": 123}]
}]
Test 0011: coerced @id

A value of a property with @type: @id coercion expands to a node reference

{
"@context": {
"dc": "http://purl.org/dc/elements/1.1/",
"ex": "http://example.org/vocab#",
"ex:contains": {
"@type": "@id"
},
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "http://example.org/test#book",
"dc:title": "Title",
"ex:contains": "http://example.org/test#chapter"
}
[{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [{
"@id": "http://example.org/test#chapter"
}],
"http://purl.org/dc/elements/1.1/title": [{"@value": "Title"}]
}]
Test 0012: @graph with embed

Use of @graph to contain multiple nodes within array

{
"@context": {
"dc": "http://purl.org/dc/elements/1.1/",
"ex": "http://example.org/vocab#",
"ex:authored": {
"@type": "@id"
},
"ex:contains": {
"@type": "@id"
},
"foaf": "http://xmlns.com/foaf/0.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@graph": [
{
"@id": "http://example.org/test#chapter",
"dc:description": "Fun",
"dc:title": "Chapter One"
},
{
"@id": "http://example.org/test#jane",
"ex:authored": "http://example.org/test#chapter",
"foaf:name": "Jane"
},
{
"@id": "http://example.org/test#john",
"foaf:name": "John"
},
{
"@id": "http://example.org/test#library",
"ex:contains": {
"@id": "http://example.org/test#book",
"dc:contributor": "Writer",
"dc:title": "My Book",
"ex:contains": "http://example.org/test#chapter"
}
}
]
}
[
{
"@id": "http://example.org/test#chapter",
"http://purl.org/dc/elements/1.1/description": [{"@value": "Fun"}],
"http://purl.org/dc/elements/1.1/title": [{"@value": "Chapter One"}]
},
{
"@id": "http://example.org/test#jane",
"http://example.org/vocab#authored": [{
"@id": "http://example.org/test#chapter"
}],
"http://xmlns.com/foaf/0.1/name": [{"@value": "Jane"}]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": [{"@value": "John"}]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [{
"@id": "http://example.org/test#chapter"
}],
"http://purl.org/dc/elements/1.1/contributor": [{"@value": "Writer"}],
"http://purl.org/dc/elements/1.1/title": [{"@value": "My Book"}]
}]
}
]
Test 0013: expand already expanded

Expand does not mess up already expanded document

[{
"@id": "http://example.com/id1",
"@type": ["http://example.com/t1"],
"http://example.com/term1": ["v1"],
"http://example.com/term2": [{"@value": "v2", "@type": "http://example.com/t2"}],
"http://example.com/term3": [{"@value": "v3", "@language": "en"}],
"http://example.com/term4": [4],
"http://example.com/term5": [50, 51]
}]
[{
"@id": "http://example.com/id1",
"@type": ["http://example.com/t1"],
"http://example.com/term1": [{"@value": "v1"}],
"http://example.com/term2": [{"@value": "v2", "@type": "http://example.com/t2"}],
"http://example.com/term3": [{"@value": "v3", "@language": "en"}],
"http://example.com/term4": [{"@value": 4}],
"http://example.com/term5": [{"@value": 50}, {"@value": 51}]
}]
Test 0014: @set of @value objects with keyword aliases

Expanding aliased @set and @value

{
"@context": {
"ex": "http://example.org/test#",
"property1": {
"@id": "http://example.org/test#property1",
"@type": "@id"
},
"property2": {
"@id": "ex:property2",
"@type": "@id"
},
"uri": "@id",
"set": "@set",
"value": "@value",
"type": "@type",
"xsd": { "@id": "http://www.w3.org/2001/XMLSchema#" }
},
"property1": {
"uri": "ex:example2",
"http://example.org/test#property4": "foo"
},
"property2": "http://example.org/test#example3",
"http://example.org/test#property3": {
"uri": "http://example.org/test#example4"
},
"ex:property4": {
"uri": "ex:example4",
"ex:property5": [
{
"set": [
{
"value": "2012-03-31",
"type": "xsd:date"
}
]
}
]
},
"ex:property6": [
{
"set": [
{
"value": null,
"type": "xsd:date"
}
]
}
],
"uri": "http://example.org/test#example1"
}
[
{
"http://example.org/test#property1": [
{
"@id": "http://example.org/test#example2",
"http://example.org/test#property4": [
{"@value": "foo"}
]
}
],
"http://example.org/test#property2": [
{ "@id": "http://example.org/test#example3" }
],
"http://example.org/test#property3": [
{ "@id": "http://example.org/test#example4" }
],
"http://example.org/test#property4": [
{
"@id": "http://example.org/test#example4",
"http://example.org/test#property5": [
{
"@value": "2012-03-31",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
]
}
],
"http://example.org/test#property6": [],
"@id": "http://example.org/test#example1"
}
]
Test 0015: collapse set of sets, keep empty lists

An array of multiple @set nodes are collapsed into a single array

{
"@context": {
"mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
"mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
"myset1": {"@id": "http://example.com/myset1", "@container": "@set" },
"myset2": {"@id": "http://example.com/myset2", "@container": "@set" },
"myset3": {"@id": "http://example.com/myset3", "@container": "@set" }
},
"@id": "http://example.org/id",
"mylist1": [],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
"myset3": [ { "@set": [ "hello", "this" ] }, "will", { "@set": [ "be", "collapsed" ] } ]
}
[
{
"@id": "http://example.org/id",
"http://example.com/mylist1": [ { "@list": [] } ],
"http://example.com/myset1": [ ],
"http://example.com/myset2": [ ],
"http://example.com/myset3": [
{"@value": "hello"},
{"@value": "this"},
{"@value": "will"},
{"@value": "be"},
{"@value": "collapsed"} ]
}
]
Test 0016: context reset

Setting @context to null within an embedded object resets back to initial context state

{
"@context": {
"myproperty": { "@id": "http://example.com/myproperty" },
"mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
"mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
"myset1": {"@id": "http://example.com/myset1", "@container": "@set" },
"myset2": {"@id": "http://example.com/myset2", "@container": "@set" }
},
"@id": "http://example.org/id1",
"mylist1": [],
"mylist2": [ 2, "hi" ],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
"myproperty": {
"@context": null,
"@id": "http://example.org/id2",
"mylist1": [],
"mylist2": [ 2, "hi" ],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
"http://example.org/myproperty2": "ok"
},
"http://example.com/emptyobj": {
"@context": null,
"mylist1": [],
"mylist2": [ 2, "hi" ],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ]
}
}
[
{
"@id": "http://example.org/id1",
"http://example.com/mylist1": [ { "@list": [] } ],
"http://example.com/mylist2": [
{ "@list": [ {"@value": 2}, {"@value": "hi"} ] }
],
"http://example.com/myset1": [ ],
"http://example.com/myset2": [ ],
"http://example.com/myproperty": [
{
"@id": "http://example.org/id2",
"http://example.org/myproperty2": [ {"@value": "ok"} ]
}
],
"http://example.com/emptyobj": [ { } ]
}
]
Test 0017: @graph and @id aliased

Expanding with @graph and @id aliases

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
},
"id": "@id",
"data": "@graph"
},
"data": [
{
"id": "http://example.org/test#chapter",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#jane",
"authored": "http://example.org/test#chapter",
"name": "Jane"
},
{
"id": "http://example.org/test#john",
"name": "John"
},
{
"id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
[
{
"@id": "http://example.org/test#chapter",
"http://purl.org/dc/elements/1.1/description": [{"@value": "Fun"}],
"http://purl.org/dc/elements/1.1/title": [{"@value": "Chapter One"}]
},
{
"@id": "http://example.org/test#jane",
"http://example.org/vocab#authored": [{
"@id": "http://example.org/test#chapter"
}],
"http://xmlns.com/foaf/0.1/name": [{"@value": "Jane"}]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": [{"@value": "John"}]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [{
"@id": "http://example.org/test#chapter"
}],
"http://purl.org/dc/elements/1.1/contributor": [{"@value": "Writer"}],
"http://purl.org/dc/elements/1.1/title": [{"@value": "My Book"}]
}]
}
]
Test 0018: override default @language

override default @language in terms; only language-tag strings

{
"@context": {
"ex": "http://example.org/vocab#",
"@language": "en",
"de": { "@id": "ex:german", "@language": "de" },
"nolang": { "@id": "ex:nolang", "@language": null }
},
"@id": "http://example.org/test",
"ex:test-default": [
"hello",
1,
true
],
"de": [
"hallo",
2,
true
],
"nolang": [
"no language",
3,
false
]
}
[
{
"@id": "http://example.org/test",
"http://example.org/vocab#test-default": [ { "@value": "hello", "@language": "en" }, { "@value": 1 }, { "@value": true } ],
"http://example.org/vocab#german": [ { "@value": "hallo", "@language": "de" }, { "@value": 2 }, { "@value": true } ],
"http://example.org/vocab#nolang": [ {"@value": "no language"}, { "@value": 3 }, { "@value": false } ]
}
]
Test 0019: remove @value = null

Expanding a value of null removes the value

{
"@context": {
"myproperty": "http://example.com/myproperty"
},
"myproperty": { "@value" : null }
}
[ ]
Test 0020: do not remove @graph if not at top-level

@graph used under a node is retained

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
}
},
"@graph": [
{
"@id": "http://example.org/test#jane",
"name": "Jane",
"authored": {
"@graph": [
{
"@id": "http://example.org/test#chapter1",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#chapter2",
"description": "More fun",
"title": "Chapter Two"
}
]
}
},
{
"@id": "http://example.org/test#john",
"name": "John"
},
{
"@id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
[
{
"@id": "http://example.org/test#jane",
"http://xmlns.com/foaf/0.1/name": [ {"@value": "Jane"} ],
"http://example.org/vocab#authored": [
{
"@graph": [
{
"@id": "http://example.org/test#chapter1",
"http://purl.org/dc/elements/1.1/description": [ {"@value": "Fun"} ],
"http://purl.org/dc/elements/1.1/title": [ {"@value": "Chapter One"} ]
},
{
"@id": "http://example.org/test#chapter2",
"http://purl.org/dc/elements/1.1/description": [ {"@value": "More fun"} ],
"http://purl.org/dc/elements/1.1/title": [ {"@value": "Chapter Two"} ]
}
]
}
]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": [ {"@value": "John"} ]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [ { "@id": "http://example.org/test#chapter" } ],
"http://purl.org/dc/elements/1.1/contributor": [ {"@value": "Writer"} ],
"http://purl.org/dc/elements/1.1/title": [ {"@value": "My Book"} ]
}
]
}
]
Test 0021: do not remove @graph at top-level if not only property

@graph used at the top level is retained if there are other properties

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
}
},
"title": "My first graph",
"@graph": [
{
"@id": "http://example.org/test#jane",
"name": "Jane",
"authored": {
"@graph": [
{
"@id": "http://example.org/test#chapter1",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#chapter2",
"description": "More fun",
"title": "Chapter Two"
},
{
"@id": "http://example.org/test#chapter3",
"title": "Chapter Three"
}
]
}
},
{
"@id": "http://example.org/test#john",
"name": "John"
},
{
"@id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
[
{
"http://purl.org/dc/elements/1.1/title": [ {"@value": "My first graph"} ],
"@graph": [
{
"@id": "http://example.org/test#jane",
"http://xmlns.com/foaf/0.1/name": [ {"@value": "Jane"} ],
"http://example.org/vocab#authored": [
{
"@graph": [
{
"@id": "http://example.org/test#chapter1",
"http://purl.org/dc/elements/1.1/description": [ {"@value": "Fun"} ],
"http://purl.org/dc/elements/1.1/title": [ {"@value": "Chapter One"} ]
},
{
"@id": "http://example.org/test#chapter2",
"http://purl.org/dc/elements/1.1/description": [ {"@value": "More fun"} ],
"http://purl.org/dc/elements/1.1/title": [ {"@value": "Chapter Two"} ]
},
{
"@id": "http://example.org/test#chapter3",
"http://purl.org/dc/elements/1.1/title": [ {"@value": "Chapter Three"} ]
}
]
}
]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": [ {"@value": "John"} ]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [ { "@id": "http://example.org/test#chapter" } ],
"http://purl.org/dc/elements/1.1/contributor": [ {"@value": "Writer"} ],
"http://purl.org/dc/elements/1.1/title": [ {"@value": "My Book"} ]
}
]
}
]
}
]
Test 0022: expand value with default language

Expanding with a default language applies that language to string values

{
"@context": {
"term": "http://example.com/term",
"@language": "en"
},
"term": "v"
}
[{
"http://example.com/term": [{"@value": "v", "@language": "en"}]
}]
Test 0023: Expanding list/set with coercion

Expanding lists and sets with properties having coercion coerces list/set values

{
"@context": {
"xsd": "http://www.w3.org/2001/XMLSchema#",
"idlist": {"@id": "http://example.com/idlist", "@container": "@list", "@type": "@id"},
"datelist": {"@id": "http://example.com/datelist", "@container": "@list", "@type": "xsd:date"},
"idset": {"@id": "http://example.com/idset", "@container": "@set", "@type": "@id"},
"dateset": {"@id": "http://example.com/dateset", "@container": "@set", "@type": "xsd:date"},
"idprop": {"@id": "http://example.com/idprop", "@type": "@id" },
"dateprop": {"@id": "http://example.com/dateprop", "@type": "xsd:date" },
"idprop2": {"@id": "http://example.com/idprop2", "@type": "@id" },
"dateprop2": {"@id": "http://example.com/dateprop2", "@type": "xsd:date" }
},
"idlist": ["http://example.org/id"],
"datelist": ["2012-04-12"],
"idprop": {"@list": ["http://example.org/id"]},
"dateprop": {"@list": ["2012-04-12"]},
"idset": ["http://example.org/id"],
"dateset": ["2012-04-12"],
"idprop2": {"@set": ["http://example.org/id"]},
"dateprop2": {"@set": ["2012-04-12"]}
}
[
{
"http://example.com/idlist": [{"@list": [{"@id": "http://example.org/id"}]}],
"http://example.com/datelist": [{"@list": [{"@value": "2012-04-12","@type": "http://www.w3.org/2001/XMLSchema#date"}]}],
"http://example.com/idprop": [{"@list": [{"@id": "http://example.org/id"}]}],
"http://example.com/dateprop": [{"@list": [{"@value": "2012-04-12","@type": "http://www.w3.org/2001/XMLSchema#date"}]}],
"http://example.com/idset": [{"@id": "http://example.org/id"}],
"http://example.com/dateset": [{"@value": "2012-04-12","@type": "http://www.w3.org/2001/XMLSchema#date"}],
"http://example.com/idprop2": [{"@id": "http://example.org/id"}],
"http://example.com/dateprop2": [{"@value": "2012-04-12","@type": "http://www.w3.org/2001/XMLSchema#date"}]
}
]
Test 0024: Multiple contexts

Tests that contexts in an array are merged

{
"@context": [
{
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {"@id": "http://xmlns.com/foaf/0.1/homepage","@type": "@id"}
},
{"ical": "http://www.w3.org/2002/12/cal/ical#"}
],
"@id": "http://example.com/speakers#Alice",
"name": "Alice",
"homepage": "http://xkcd.com/177/",
"ical:summary": "Alice Talk",
"ical:location": "Lyon Convention Centre, Lyon, France"
}
[{
"@id": "http://example.com/speakers#Alice",
"http://xmlns.com/foaf/0.1/name": [{"@value": "Alice"}],
"http://xmlns.com/foaf/0.1/homepage": [{"@id": "http://xkcd.com/177/"}],
"http://www.w3.org/2002/12/cal/ical#summary": [{"@value": "Alice Talk"}],
"http://www.w3.org/2002/12/cal/ical#location": [{"@value": "Lyon Convention Centre, Lyon, France"}]
}]
Test 0025: Problematic IRI expansion tests

Expanding different kinds of terms and Compact IRIs

{
"@context": {
"foo": "http://example.com/foo/",
"foo:bar": "http://example.com/bar",
"bar": {"@id": "foo:bar", "@type": "@id"},
"_": "http://example.com/underscore/"
},
"@type": [ "foo", "foo:bar", "_" ]
}
[{
"@type": [
"http://example.com/foo/",
"http://example.com/bar",
"http://example.com/underscore/"
]
}]
Test 0026: Term definition with @id: @type

Expanding term mapping to @type uses @type syntax

{
"@context": {
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {"@id": "@type", "@type": "@id"}
},
"@graph": [
{
"@id": "http://example.com/a",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/b"
}, {
"@id": "http://example.com/c",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
"http://example.com/d",
"http://example.com/e"
]
}, {
"@id": "http://example.com/f",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/g"
}
]
}
[
{
"@id": "http://example.com/a",
"@type": [
"http://example.com/b"
]
},
{
"@id": "http://example.com/c",
"@type": [
"http://example.com/d",
"http://example.com/e"
]
},
{
"@id": "http://example.com/f",
"@type": [
"http://example.com/g"
]
}
]
Test 0027: Duplicate values in @list and @set

Duplicate values in @list and @set are not merged

{
"@context": {
"mylist": {"@id": "http://example.com/mylist", "@container": "@list"},
"myset": {"@id": "http://example.com/myset", "@container": "@set"}
},
"@id": "http://example.org/id",
"mylist": [1, 2, 2, 3],
"myset": [1, 2, 2, 3]
}
[{
"@id": "http://example.org/id",
"http://example.com/mylist": [{
"@list": [
{"@value": 1},
{"@value": 2},
{"@value": 2},
{"@value": 3}
]
}],
"http://example.com/myset": [
{"@value": 1},
{"@value": 2},
{"@value": 2},
{"@value": 3}
]
}]
Test 0028: Use @vocab in properties and @type but not in @id

@vocab is used to compact properties and @type, but is not used for @id

{
"@context": {
"@vocab": "http://example.org/vocab#",
"date": { "@type": "dateTime" }
},
"@id": "example1",
"@type": "test",
"date": "2011-01-25T00:00:00Z",
"embed": {
"@id": "example2",
"expandedDate": { "@value": "2012-08-01T00:00:00Z", "@type": "dateTime" }
}
}
[
{
"@id": "http://json-ld.org/test-suite/tests/example1",
"@type": [ "http://example.org/vocab#test" ],
"http://example.org/vocab#date": [
{
"@value": "2011-01-25T00:00:00Z",
"@type": "http://example.org/vocab#dateTime"
}
],
"http://example.org/vocab#embed": [
{
"@id": "http://json-ld.org/test-suite/tests/example2",
"http://example.org/vocab#expandedDate": [
{
"@value": "2012-08-01T00:00:00Z",
"@type": "http://example.org/vocab#dateTime"
}
]
}
]
}
]
Test 0029: Relative IRIs

@base is used to compact @id; test with different relative IRIs

{
"@context": {
"links": { "@id": "http://www.example.com/link", "@type": "@id", "@container": "@list" }
},
"@id": "relativeIris",
"@type": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../../parent-parent-eq-root",
"../../../../../still-root",
"../.././.././../../too-many-dots",
"/absolute",
"//example.org/scheme-relative"
],
"links": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../../parent-parent-eq-root",
"./../../../useless/../../../still-root",
"../.././.././../../too-many-dots",
"/absolute",
"//example.org/scheme-relative"
]
}
[
{
"@id": "http://json-ld.org/test-suite/tests/relativeIris",
"@type": [
"http://json-ld.org/test-suite/tests/link",
"http://json-ld.org/test-suite/tests/expand-0029-in.jsonld#fragment-works",
"http://json-ld.org/test-suite/tests/expand-0029-in.jsonld?query=works",
"http://json-ld.org/test-suite/tests/",
"http://json-ld.org/test-suite/",
"http://json-ld.org/test-suite/parent",
"http://json-ld.org/parent-parent-eq-root",
"http://json-ld.org/still-root",
"http://json-ld.org/too-many-dots",
"http://json-ld.org/absolute",
"http://example.org/scheme-relative"
],
"http://www.example.com/link": [ {
"@list": [
{ "@id": "http://json-ld.org/test-suite/tests/link" },
{ "@id": "http://json-ld.org/test-suite/tests/expand-0029-in.jsonld#fragment-works" },
{ "@id": "http://json-ld.org/test-suite/tests/expand-0029-in.jsonld?query=works" },
{ "@id": "http://json-ld.org/test-suite/tests/" },
{ "@id": "http://json-ld.org/test-suite/" },
{ "@id": "http://json-ld.org/test-suite/parent" },
{ "@id": "http://json-ld.org/parent-parent-eq-root" },
{ "@id": "http://json-ld.org/still-root" },
{ "@id": "http://json-ld.org/too-many-dots" },
{ "@id": "http://json-ld.org/absolute" },
{ "@id": "http://example.org/scheme-relative" }
]
} ]
}
]
Test 0030: Language maps

Language Maps expand values to include @language

{
"@context": {
"vocab": "http://example.com/vocab/",
"label": {
"@id": "vocab:label",
"@container": "@language"
}
},
"@id": "http://example.com/queen",
"label": {
"en": "The Queen",
"de": [ "Die Königin", "Ihre Majestät" ]
}
}
[
{
"@id": "http://example.com/queen",
"http://example.com/vocab/label":
[
{
"@value": "Die Königin",
"@language": "de"
}, {
"@value": "Ihre Majestät",
"@language": "de"
}, {
"@value": "The Queen",
"@language": "en"
}
]
}
]
Test 0031: type-coercion of native types

Expanding native types with type coercion adds the coerced type to an expanded value representation and retains the native value representation

{
"@context": {
"ex": "http://example.org/vocab#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"ex:integer": { "@type": "xsd:integer" },
"ex:double": { "@type": "xsd:double" },
"ex:boolean": { "@type": "xsd:boolean" }
},
"@id": "http://example.org/test#example1",
"ex:integer": 1,
"ex:double": 123.45,
"ex:boolean": true
}
[
{
"@id": "http://example.org/test#example1",
"http://example.org/vocab#integer": [ {
"@value": 1,
"@type": "http://www.w3.org/2001/XMLSchema#integer"
} ],
"http://example.org/vocab#double": [ {
"@value": 123.45,
"@type": "http://www.w3.org/2001/XMLSchema#double"
} ],
"http://example.org/vocab#boolean": [ {
"@value": true,
"@type": "http://www.w3.org/2001/XMLSchema#boolean"
} ]
}
]
Test 0032: Null term and @vocab

Mapping a term to null decouples it from @vocab

{
"@context": {
"@vocab": "http://xmlns.com/foaf/0.1/",
"from": null,
"university": { "@id": null }
},
"@id": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"from": "Italy",
"university": "TU Graz"
}
[
{
"@id": "http://me.markus-lanthaler.com/",
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "Markus Lanthaler"
}
]
}
]
Test 0033: Using @vocab with with type-coercion

Verifies that terms can be defined using @vocab

{
"@context": {
"@vocab": "http://example.com/vocab#",
"homepage": {
"@type": "@id"
},
"created_at": {
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
},
"name": "Markus Lanthaler",
"homepage": "http://www.markus-lanthaler.com/",
"created_at": "2012-10-28"
}
[{
"http://example.com/vocab#name": [{
"@value": "Markus Lanthaler"
}],
"http://example.com/vocab#homepage": [{
"@id": "http://www.markus-lanthaler.com/"
}],
"http://example.com/vocab#created_at": [{
"@value": "2012-10-28",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}]
}]
Test 0034: Multiple properties expanding to the same IRI

Verifies multiple values from separate terms are deterministically made multiple values of the IRI associated with the terms

{
"@context": {
"@vocab": "http://example.com/vocab/",
"colliding": "http://example.com/vocab/collidingTerm"
},
"@id": "http://example.com/IriCollissions",
"colliding": [
"value 1",
2
],
"collidingTerm": [
3,
"four"
],
"http://example.com/vocab/collidingTerm": 5
}
[{
"@id": "http://example.com/IriCollissions",
"http://example.com/vocab/collidingTerm": [
{
"@value": "value 1"
}, {
"@value": 2
}, {
"@value": 3
}, {
"@value": "four"
},
{
"@value": 5
}
]
}]
Test 0035: Language maps with @vocab, default language, and colliding property

Pathological tests of language maps

{
"@context": {
"@vocab": "http://example.com/vocab/",
"@language": "it",
"label": {
"@container": "@language"
}
},
"@id": "http://example.com/queen",
"label": {
"en": "The Queen",
"de": [ "Die Königin", "Ihre Majestät" ]
},
"http://example.com/vocab/label": [
"Il re",
{ "@value": "The king", "@language": "en" }
]
}
[{
"@id": "http://example.com/queen",
"http://example.com/vocab/label": [
{
"@value": "Il re",
"@language": "it"
}, {
"@value": "The king",
"@language": "en"
}, {
"@value": "Die Königin",
"@language": "de"
}, {
"@value": "Ihre Majestät",
"@language": "de"
}, {
"@value": "The Queen",
"@language": "en"
}
]
}]
Test 0036: Expanding @index

Expanding index maps for terms defined with @container: @index

{
"@context": {
"property": "http://example.com/property",
"indexContainer": { "@id": "http://example.com/container", "@container": "@index" }
},
"@id": "http://example.org/indexTest",
"indexContainer": {
"A": [
{
"@id": "http://example.org/nodeWithoutIndexA"
},
{
"@id": "http://example.org/nodeWithIndexA",
"@index": "this overrides the 'A' index from the container"
},
1,
true,
false,
null,
"simple string A",
{
"@value": "typed literal A",
"@type": "http://example.org/type"
},
{
"@value": "language-tagged string A",
"@language": "en"
}
],
"B": "simple string B",
"C": [
{
"@id": "http://example.org/nodeWithoutIndexC"
},
{
"@id": "http://example.org/nodeWithIndexC",
"@index": "this overrides the 'C' index from the container"
},
3,
true,
false,
null,
"simple string C",
{
"@value": "typed literal C",
"@type": "http://example.org/type"
},
{
"@value": "language-tagged string C",
"@language": "en"
}
]
},
"property": [
{
"@id": "http://example.org/nodeWithoutIndexProp"
},
{
"@id": "http://example.org/nodeWithIndexProp",
"@index": "prop"
},
{
"@value": 3,
"@index": "prop"
},
{
"@value": true,
"@index": "prop"
},
{
"@value": false,
"@index": "prop"
},
{
"@value": null,
"@index": "prop"
},
"simple string no index",
{
"@value": "typed literal Prop",
"@type": "http://example.org/type",
"@index": "prop"
},
{
"@value": "language-tagged string Prop",
"@language": "en",
"@index": "prop"
}
]
}
[
{
"@id": "http://example.org/indexTest",
"http://example.com/container": [
{
"@id": "http://example.org/nodeWithoutIndexA",
"@index": "A"
},
{
"@id": "http://example.org/nodeWithIndexA",
"@index": "this overrides the 'A' index from the container"
},
{
"@value": 1,
"@index": "A"
},
{
"@value": true,
"@index": "A"
},
{
"@value": false,
"@index": "A"
},
{
"@value": "simple string A",
"@index": "A"
},
{
"@value": "typed literal A",
"@type": "http://example.org/type",
"@index": "A"
},
{
"@value": "language-tagged string A",
"@language": "en",
"@index": "A"
},
{
"@value": "simple string B",
"@index": "B"
},
{
"@id": "http://example.org/nodeWithoutIndexC",
"@index": "C"
},
{
"@id": "http://example.org/nodeWithIndexC",
"@index": "this overrides the 'C' index from the container"
},
{
"@value": 3,
"@index": "C"
},
{
"@value": true,
"@index": "C"
},
{
"@value": false,
"@index": "C"
},
{
"@value": "simple string C",
"@index": "C"
},
{
"@value": "typed literal C",
"@type": "http://example.org/type",
"@index": "C"
},
{
"@value": "language-tagged string C",
"@language": "en",
"@index": "C"
}
],
"http://example.com/property": [
{
"@id": "http://example.org/nodeWithoutIndexProp"
},
{
"@id": "http://example.org/nodeWithIndexProp",
"@index": "prop"
},
{
"@value": 3,
"@index": "prop"
},
{
"@value": true,
"@index": "prop"
},
{
"@value": false,
"@index": "prop"
},
{
"@value": "simple string no index"
},
{
"@value": "typed literal Prop",
"@type": "http://example.org/type",
"@index": "prop"
},
{
"@value": "language-tagged string Prop",
"@language": "en",
"@index": "prop"
}
]
}
]
Test 0037: Expanding @reverse

Expanding @reverse keeps @reverse

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
}
}
}
[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0038: Expanding blank node labels

Blank nodes are not relabeled during expansion

{
"@context": {
"term": "_:term",
"termId": { "@id": "term", "@type": "@id" }
},
"@id": "_:term",
"@type": "_:term",
"term": [
{
"@id": "_:term",
"@type": "term"
},
{
"@id": "_:Bx",
"term": "term"
},
"plain value",
{
"@id": "_:term"
}
],
"termId": [
{
"@id": "_:term",
"@type": "term"
},
{
"@id": "_:Cx",
"term": "termId"
},
"term:AppendedToBlankNode",
"_:termAppendedToBlankNode",
"relativeIri",
{
"@id": "_:term"
}
]
}
[
{
"@id": "_:term",
"@type": [
"_:term"
],
"_:term": [
{
"@id": "_:term",
"@type": [
"_:term"
]
},
{
"@id": "_:Bx",
"_:term": [
{
"@value": "term"
}
]
},
{
"@value": "plain value"
},
{
"@id": "_:term"
},
{
"@id": "_:term",
"@type": [
"_:term"
]
},
{
"@id": "_:Cx",
"_:term": [
{
"@value": "termId"
}
]
},
{
"@id": "_:termAppendedToBlankNode"
},
{
"@id": "_:termAppendedToBlankNode"
},
{
"@id": "http://json-ld.org/test-suite/tests/relativeIri"
},
{
"@id": "_:term"
}
]
}
]
Test 0039: Using terms in a reverse-maps

Terms within @reverse are expanded

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
}
}
}
[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0040: language and index expansion on non-objects

Only invoke language and index map expansion if the value is a JSON object

{
"@context": {
"vocab": "http://example.com/vocab/",
"label": {
"@id": "vocab:label",
"@container": "@language"
},
"indexes": {
"@id": "vocab:index",
"@container": "@index"
}
},
"@id": "http://example.com/queen",
"label": [
"The Queen"
],
"indexes":
[
"No",
"indexes",
{ "@id": "asTheValueIsntAnObject" }
]
}
[
{
"@id": "http://example.com/queen",
"http://example.com/vocab/label":
[
{
"@value": "The Queen"
}
],
"http://example.com/vocab/index":
[
{
"@value": "No"
},
{
"@value": "indexes"
},
{
"@id": "http://json-ld.org/test-suite/tests/asTheValueIsntAnObject"
}
]
}
]
Test 0041: @language: null resets the default language
{
"@context": {
"property": "http://example.com/property",
"nested": "http://example.com/nested",
"@language": "en"
},
"property": "this is English",
"nested": {
"@context": {
"@language": null
},
"property": "and this is a plain string"
}
}
[
{
"http://example.com/property": [ { "@value": "this is English", "@language": "en" } ],
"http://example.com/nested": [
{
"http://example.com/property": [ { "@value": "and this is a plain string" } ]
}
]
}
]
Test 0042: Reverse properties

Expanding terms defined as reverse properties uses @reverse in expanded document

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
}
}
[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0043: Using reverse properties inside a @reverse-container

Expanding a reverse property within a @reverse undoes both reversals

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"isKnownBy": [
{
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
{
"@id": "http://example.com/people/gregg",
"name": "Gregg Kellogg"
}
]
}
}
[
{
"@id": "http://example.com/people/markus",
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
},
{
"@id": "http://example.com/people/gregg",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Gregg Kellogg" } ]
}
],
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0044: Index maps with language mappings

Ensure index maps use language mapping

{
"@context": {
"property": { "@id": "http://example.com/vocab/property", "@language": "de" },
"indexMap": { "@id": "http://example.com/vocab/indexMap", "@language": "en", "@container": "@index" }
},
"@id": "http://example.com/node",
"property": [
{
"@id": "http://example.com/propertyValueNode",
"indexMap": {
"expands to english string": "simple string"
}
},
"einfacher String"
]
}
[
{
"@id": "http://example.com/node",
"http://example.com/vocab/property": [
{
"@id": "http://example.com/propertyValueNode",
"http://example.com/vocab/indexMap": [
{
"@value": "simple string",
"@language": "en",
"@index": "expands to english string"
}
]
},
{
"@value": "einfacher String",
"@language": "de"
}
]
}
]
Test 0045: Top-level value objects

Expanding top-level value objects causes them to be removed

{
"@value": "free-floating value"
}
[ ]
Test 0046: Free-floating nodes

Expanding free-floating nodes causes them to be removed

{
"@graph": [
{ "@id": "http://example.com/free-floating-node" },
{ "@value": "free-floating value object" },
{ "@value": "free-floating value language-tagged string", "@language": "en" },
{ "@value": "free-floating value typed value", "@type": "http://example.com/type" },
"free-floating plain string",
true,
false,
null,
1,
1.5
]
}
[ ]
Test 0047: Free-floating values in sets and free-floating lists

Free-floating values in sets are removed, free-floating lists are removed completely

{
"@context": {
"property": "http://example.com/property"
},
"@graph": [
{
"@set": [
"free-floating strings in set objects are removed",
{
"@id": "http://example.com/free-floating-node"
},
{
"@id": "http://example.com/node",
"property": "nodes with properties are not removed"
}
]
},
{
"@list": [
"lists are removed even though they represent an invisible linked structure, they have no real meaning",
{
"@id": "http://example.com/node-in-free-floating-list",
"property": "everything inside a free-floating list is removed with the list; also nodes with properties"
}
]
}
]
}
[
{
"@id": "http://example.com/node",
"http://example.com/property": [
{
"@value": "nodes with properties are not removed"
}
]
}
]
Test 0048: Terms are ignored in @id

Values of @id are not expanded as terms

{
"@context": {
"term": "http://example.com/terms-are-not-considered-in-id",
"compact-iris": "http://example.com/compact-iris-",
"property": "http://example.com/property",
"@vocab": "http://example.org/vocab-is-not-considered-for-id"
},
"@id": "term",
"property": [
{
"@id": "compact-iris:are-considered",
"property": "@id supports the following values: relative, absolute, and compact IRIs"
},
{
"@id": "../parent-node",
"property": "relative IRIs get resolved against the document's base IRI"
}
]
}
[
{
"@id": "http://json-ld.org/test-suite/tests/term",
"http://example.com/property": [
{
"@id": "http://example.com/compact-iris-are-considered",
"http://example.com/property": [
{ "@value": "@id supports the following values: relative, absolute, and compact IRIs" }
]
},
{
"@id": "http://json-ld.org/test-suite/parent-node",
"http://example.com/property": [
{ "@value": "relative IRIs get resolved against the document's base IRI" }
]
}
]
}
]
Test 0049: String values of reverse properties

String values of a reverse property with @type: @id are treated as IRIs

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@type": "@id" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": [
"http://example.com/people/dave",
"http://example.com/people/gregg"
]
}
[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave"
},
{
"@id": "http://example.com/people/gregg"
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0050: Term definitions with prefix separate from prefix definitions

Term definitions using compact IRIs don't inherit the definitions of the prefix

{
"@context": {
"issue": { "@id": "http://example.com/issue/", "@type": "@id" },
"issue:raisedBy": { "@container": "@set" }
},
"issue": "/issue/1",
"issue:raisedBy": "Markus"
}
[
{
"http://example.com/issue/": [ { "@id": "http://json-ld.org/issue/1" } ],
"http://example.com/issue/raisedBy": [ { "@value": "Markus" } ]
}
]
Test 0051: Expansion of keyword aliases in term definitions

Expanding terms which are keyword aliases

{
"@context": [
{ "id": "@id" },
{ "url": "id" }
],
"url": "/issue/1",
"http://example.com/property": "ok"
}
[{
"http://example.com/property": [{
"@value": "ok"
}],
"@id": "http://json-ld.org/issue/1"
}]
Test 0052: @vocab-relative IRIs in term definitions

If @vocab is defined, term definitions are expanded relative to @vocab

{
"@context": {
"@vocab": "http://example.org/",
"property": "vocabRelativeProperty"
},
"property": "must expand to http://example.org/vocabRelativeProperty",
"http://example.org/property": "ok"
}
[
{
"http://example.org/property": [ { "@value": "ok" } ],
"http://example.org/vocabRelativeProperty": [ { "@value": "must expand to http://example.org/vocabRelativeProperty" } ]
}
]
Test 0053: Expand absolute IRI with @type: @vocab

Expanding values of properties of @type: @vocab does not further expand absolute IRIs

{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"}
},
"term": "http://example.org/enum"
}
[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
Test 0054: Expand term with @type: @vocab

Expanding values of properties of @type: @vocab does not expand term values

{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"},
"enum": {"@id": "http://example.org/enum"}
},
"term": "enum"
}
[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
Test 0055: Expand @vocab-relative term with @type: @vocab

Expanding values of properties of @type: @vocab expands relative IRIs using @vocab

{
"@context": {
"@vocab": "http://example.org/",
"term": {"@id": "http://example.org/term", "@type": "@vocab"}
},
"term": "enum"
}
[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
Test 0056: Use terms with @type: @vocab but not with @type: @id

Checks that expansion uses appropriate base depending on term definition having @type @id or @vocab

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": { "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@vocab" },
"link": { "@id": "http://example.com/link", "@type": "@id" },
"MarkusHomepage": "http://www.markus-lanthaler.com/",
"relative-iri": "http://example.com/error-if-this-is-used-for-link"
},
"@id": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"homepage": "MarkusHomepage",
"link": "relative-iri"
}
[
{
"@id": "http://me.markus-lanthaler.com/",
"http://xmlns.com/foaf/0.1/homepage": [ { "@id": "http://www.markus-lanthaler.com/" } ],
"http://example.com/link": [ { "@id": "http://json-ld.org/test-suite/tests/relative-iri" } ],
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0057: Expand relative IRI with @type: @vocab

Relative values of terms with @type: @vocab expand relative to @vocab

{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" }
},
"term": "not-a-term-thus-a-relative-IRI"
}
[
{
"http://example.org/term": [ { "@id": "http://json-ld.org/test-suite/tests/not-a-term-thus-a-relative-IRI" } ]
}
]
Test 0058: Expand compact IRI with @type: @vocab

Compact IRIs are expanded normally even if term has @type: @vocab

{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" },
"prefix": "http://example.com/vocab#"
},
"term": "prefix:suffix"
}
[
{
"http://example.org/term": [ { "@id": "http://example.com/vocab#suffix" } ]
}
]
Test 0059: Reset @vocab by setting it to null

Setting @vocab to null removes a previous definition

{
"@context": {
"@vocab": "http://example.org/vocab#"
},
"@id": "example-with-vocab",
"@type": "vocab-prefixed",
"property": "property expanded using @vocab",
"embed": {
"@context": {
"@vocab": null
},
"@id": "example-vocab-reset",
"@type": "document-relative",
"property": "@vocab reset, property will be dropped"
}
}
[
{
"@id": "http://json-ld.org/test-suite/tests/example-with-vocab",
"@type": [ "http://example.org/vocab#vocab-prefixed" ],
"http://example.org/vocab#embed": [
{
"@id": "http://json-ld.org/test-suite/tests/example-vocab-reset",
"@type": [ "http://json-ld.org/test-suite/tests/document-relative" ]
}
],
"http://example.org/vocab#property": [ { "@value": "property expanded using @vocab" } ]
}
]
Test 0060: Overwrite document base with @base and reset it again

Setting @base to an IRI and then resetting it to nil

{
"@context": {
"property": "http://example.com/vocab#property"
},
"@id": "../document-relative",
"@type": "#document-relative",
"property": {
"@context": {
"@base": "http://example.org/test/"
},
"@id": "../document-base-overwritten",
"@type": "#document-base-overwritten",
"property": [
{
"@context": null,
"@id": "../document-relative",
"@type": "#document-relative",
"property": "context completely reset, drops property"
},
{
"@context": {
"@base": null
},
"@id": "../document-relative",
"@type": "#document-relative",
"property": "only @base is cleared"
}
]
}
}
[
{
"@id": "http://json-ld.org/test-suite/document-relative",
"@type": [ "http://json-ld.org/test-suite/tests/expand-0060-in.jsonld#document-relative" ],
"http://example.com/vocab#property": [
{
"@id": "http://example.org/document-base-overwritten",
"@type": [ "http://example.org/test/#document-base-overwritten" ],
"http://example.com/vocab#property": [
{
"@id": "http://json-ld.org/test-suite/document-relative",
"@type": [ "http://json-ld.org/test-suite/tests/expand-0060-in.jsonld#document-relative" ]
},
{
"@id": "../document-relative",
"@type": [ "#document-relative" ],
"http://example.com/vocab#property": [ { "@value": "only @base is cleared" } ]
}
]
}
]
}
]
Test 0061: Coercing native types to arbitrary datatypes

Expanding native types when coercing to arbitrary datatypes

{
"@context": {
"property": {
"@id": "http://example.com/property",
"@type": "http://example.com/datatype"
}
},
"property": [ 1, true, false, 5.1 ]
}
[
{
"http://example.com/property": [
{ "@value": 1, "@type": "http://example.com/datatype" },
{ "@value": true, "@type": "http://example.com/datatype" },
{ "@value": false, "@type": "http://example.com/datatype" },
{ "@value": 5.1, "@type": "http://example.com/datatype" }
]
}
]
Test 0062: Various relative IRIs with with @base

Pathological relative IRIs

{
"@context": {
"@base": "http://example.com/some/deep/directory/and/file#with-a-fragment",
"links": { "@id": "http://www.example.com/link", "@type": "@id", "@container": "@list" }
},
"@id": "relativeIris",
"@type": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../../parent-parent-eq-root",
"../../../../../still-root",
"../.././.././../../too-many-dots",
"/absolute",
"//example.org/scheme-relative"
],
"links": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../../parent-parent-eq-root",
"./../../../../../still-root",
"../.././.././../../too-many-dots",
"/absolute",
"//example.org/scheme-relative",
"//example.org/../scheme-relative",
"//example.org/.././useless/../../scheme-relative"
]
}
[
{
"@id": "http://example.com/some/deep/directory/and/relativeIris",
"@type": [
"http://example.com/some/deep/directory/and/link",
"http://example.com/some/deep/directory/and/file#fragment-works",
"http://example.com/some/deep/directory/and/file?query=works",
"http://example.com/some/deep/directory/and/",
"http://example.com/some/deep/directory/",
"http://example.com/some/deep/directory/parent",
"http://example.com/some/deep/parent-parent-eq-root",
"http://example.com/still-root",
"http://example.com/too-many-dots",
"http://example.com/absolute",
"http://example.org/scheme-relative"
],
"http://www.example.com/link": [ {
"@list": [
{ "@id": "http://example.com/some/deep/directory/and/link" },
{ "@id": "http://example.com/some/deep/directory/and/file#fragment-works" },
{ "@id": "http://example.com/some/deep/directory/and/file?query=works" },
{ "@id": "http://example.com/some/deep/directory/and/" },
{ "@id": "http://example.com/some/deep/directory/" },
{ "@id": "http://example.com/some/deep/directory/parent" },
{ "@id": "http://example.com/some/deep/parent-parent-eq-root" },
{ "@id": "http://example.com/still-root" },
{ "@id": "http://example.com/too-many-dots" },
{ "@id": "http://example.com/absolute" },
{ "@id": "http://example.org/scheme-relative" },
{ "@id": "http://example.org/scheme-relative" },
{ "@id": "http://example.org/scheme-relative" }
]
} ]
}
]
Test 0063: Reverse property and index container

Expaning reverse properties with an index-container

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@container": "@index" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": {
"Dave": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
"Gregg": {
"@id": "http://example.com/people/gregg",
"name": "Gregg Kellogg"
}
}
}
[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"@index": "Dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
},
{
"@id": "http://example.com/people/gregg",
"@index": "Gregg",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Gregg Kellogg" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0064: bnode values of reverse properties

Expand reverse property whose values are unlabeled blank nodes

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": [
{
"name": "Dave Longley"
},
{
"name": "Gregg Kellogg"
}
]
}
[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
},
{
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Gregg Kellogg" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0065: Drop unmapped keys in reverse map

Keys that are not mapped to an IRI in a reverse-map are dropped

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
"relative-iri": {
"@id": "relative-node",
"name": "Keys that are not mapped to an IRI in a reverse-map are dropped"
}
}
}
[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0066: Reverse-map keys with @vocab

Expand uses @vocab to expand keys in reverse-maps

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows",
"@vocab": "http://example.com/vocab/"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
"noTerm": {
"@id": "relative-node",
"name": "Compact keys using @vocab"
}
}
}
[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
}
],
"http://example.com/vocab/noTerm": [
{
"@id": "http://json-ld.org/test-suite/tests/relative-node",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Compact keys using @vocab" } ]
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0067: prefix://suffix not a compact IRI

prefix:suffix values are not interpreted as compact IRIs if suffix begins with two slashes

{
"@context": {
"http": "http://example.com/this-prefix-would-overwrite-all-http-iris"
},
"@id": "http://example.org/node1",
"@type": "http://example.org/type",
"http://example.org/property": "all these IRIs remain unchanged because they are interpreted as absolute IRIs"
}
[
{
"@id": "http://example.org/node1",
"@type": ["http://example.org/type"],
"http://example.org/property": [
{ "@value": "all these IRIs remain unchanged because they are interpreted as absolute IRIs" }
]
}
]
Test 0068: _:suffix values are not a compact IRI

prefix:suffix values are not interpreted as compact IRIs if prefix is an underscore

{
"@context": {
"_": "http://example.com/this-prefix-would-overwrite-all-blank-node-identifiers"
},
"@id": "_:node1",
"@type": "_:type",
"_:property": "all these IRIs remain unchanged because they are interpreted as blank node identifiers"
}
[
{
"@id": "_:node1",
"@type": [ "_:type" ],
"_:property": [
{ "@value": "all these IRIs remain unchanged because they are interpreted as blank node identifiers" }
]
}
]
Test 0069: Compact IRI as term with type mapping

Redefine compact IRI to define type mapping using the compact IRI itself as value of @id

{
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"rdfs:subClassOf": { "@id": "rdfs:subClassOf", "@type": "@id" }
},
"@id": "http://example.com/vocab#class",
"@type": "rdfs:Class",
"rdfs:subClassOf": "http://example.com/vocab#someOtherClass"
}
[
{
"@id": "http://example.com/vocab#class",
"@type": [ "http://www.w3.org/2000/01/rdf-schema#Class" ],
"http://www.w3.org/2000/01/rdf-schema#subClassOf": [
{ "@id": "http://example.com/vocab#someOtherClass"}
]
}
]
Test 0070: Compact IRI as term defined using equivalent compact IRI

Redefine compact IRI to define type mapping using the compact IRI itself as string value

{
"@context": {
"prefix": "http://www.example.org/vocab#",
"prefix:foo": "prefix:foo"
},
"@id": "http://example.com/vocab#id",
"@type": "prefix:Class",
"prefix:foo": "bar"
}
[
{
"@id": "http://example.com/vocab#id",
"@type": [ "http://www.example.org/vocab#Class" ],
"http://www.example.org/vocab#foo": [
{ "@value": "bar"}
]
}
]
Test 0071: Redefine terms looking like compact IRIs

Term definitions may look like compact IRIs

{
"@context": [
{
"v": "http://example.com/vocab#",
"v:term": "v:somethingElse",
"v:termId": { "@id": "v:somethingElseId" }
},
{
"v:term": "v:term",
"v:termId": { "@id": "v:termId" }
}
],
"v:term": "value of v:term",
"v:termId": "value of v:termId"
}
[
{
"http://example.com/vocab#term": [
{ "@value": "value of v:term" }
],
"http://example.com/vocab#termId": [
{ "@value": "value of v:termId" }
]
}
]
Test 0072: Redefine term using @vocab, not itself

Redefining a term as itself when @vocab is defined uses @vocab, not previous term definition

{
"@context": [
{
"v": "http://example.com/vocab#",
"term": "v:somethingElse"
},
{
"@vocab": "http://example.com/anotherVocab#",
"term": "term"
}
],
"term": "value of term"
}
[
{
"http://example.com/anotherVocab#term": [
{ "@value": "value of term" }
]
}
]
Test 0073: @context not first property

Objects are unordered, so serialized node definition containing @context may have @context at the end of the node definition

{
"@id": "ex:node1",
"owl:sameAs": {
"@id": "ex:node2",
"rdfs:label": "Node 2",
"link": "ex:node3",
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
}
},
"@context": {
"ex": "http://example.org/",
"owl": "http://www.w3.org/2002/07/owl#",
"link": { "@id": "ex:link", "@type": "@id" }
}
}
[
{
"@id": "http://example.org/node1",
"http://www.w3.org/2002/07/owl#sameAs": [
{
"@id": "http://example.org/node2",
"http://example.org/link": [
{ "@id": "http://example.org/node3" }
],
"http://www.w3.org/2000/01/rdf-schema#label": [ { "@value": "Node 2" } ]
}
]
}
]
Test 0074: @id not first property

Objects are unordered, so serialized node definition containing @id may have @id at the end of the node definition

{
"@context": {
"ex": "http://example.org/",
"owl": "http://www.w3.org/2002/07/owl#",
"link": {
"@id": "ex:link",
"@type": "@id"
}
},
"owl:sameAs": {
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
},
"rdfs:label": "Node 2",
"link": "ex:node3",
"@id": "ex:node2"
},
"@id": "ex:node1"
}
[
{
"@id": "http://example.org/node1",
"http://www.w3.org/2002/07/owl#sameAs": [
{
"@id": "http://example.org/node2",
"http://example.org/link": [
{ "@id": "http://example.org/node3" }
],
"http://www.w3.org/2000/01/rdf-schema#label": [ { "@value": "Node 2" } ]
}
]
}
]
Test 0075: @vocab as blank node identifier

Use @vocab to map all properties to blank node identifiers

{
"@context": {
"@vocab": "_:"
},
"@id": "ex:node1",
"b1": "blank node property 1",
"b2": "blank node property 1"
}
[
{
"@id": "ex:node1",
"_:b1": [ { "@value": "blank node property 1" } ],
"_:b2": [ { "@value": "blank node property 1" } ]
}
]
Test 0076: base option overrides document location

Use of the base option overrides the document location

{
"@id": "relative-iri",
"http://prop": "value"
}
[{
"@id": "http://example/base/relative-iri",
"http://prop": [{"@value": "value"}]
}]
Test 0077: expandContext option

Use of the expandContext option to expand the input document

{
"@id": "http://example.com/id1",
"@type": "t1",
"term1": "v1",
"term2": {"@value": "v2", "@type": "t2"},
"term3": {"@value": "v3", "@language": "en"},
"term4": 4,
"term5": [50, 51]
}
[{
"@id": "http://example.com/id1",
"@type": ["http://example.com/t1"],
"http://example.com/term1": [{"@value": "v1"}],
"http://example.com/term2": [{"@value": "v2", "@type": "http://example.com/t2"}],
"http://example.com/term3": [{"@value": "v3", "@language": "en"}],
"http://example.com/term4": [{"@value": 4}],
"http://example.com/term5": [{"@value": 50}, {"@value": 51}]
}]
Test 0001: drop free-floating nodes

Flattening drops unreferenced nodes having only @id

{"@id": "http://example.org/test#example"}
[ ]
Test 0002: basic

Flattening terms with different types of values

{
"@context": {
"t1": "http://example.com/t1",
"t2": "http://example.com/t2",
"term1": "http://example.com/term1",
"term2": "http://example.com/term2",
"term3": "http://example.com/term3",
"term4": "http://example.com/term4",
"term5": "http://example.com/term5"
},
"@id": "http://example.com/id1",
"@type": "t1",
"term1": "v1",
"term2": {"@value": "v2", "@type": "t2"},
"term3": {"@value": "v3", "@language": "en"},
"term4": 4,
"term5": [50, 51]
}
[
{
"@id": "http://example.com/id1",
"@type": [
"http://example.com/t1"
],
"http://example.com/term1": [
{
"@value": "v1"
}
],
"http://example.com/term2": [
{
"@type": "http://example.com/t2",
"@value": "v2"
}
],
"http://example.com/term3": [
{
"@language": "en",
"@value": "v3"
}
],
"http://example.com/term4": [
{
"@value": 4
}
],
"http://example.com/term5": [
{
"@value": 50
},
{
"@value": 51
}
]
}
]
Test 0003: drop null and unmapped properties

Verifies that null values and unmapped properties are removed from expanded output

{
"@id": "http://example.org/id",
"http://example.org/property": null,
"regularJson": {
"nonJsonLd": "property",
"deep": [{
"foo": "bar"
}, {
"bar": "foo"
}]
}
}
[ ]
Test 0004: optimize @set, keep empty arrays

Uses of @set are removed in expansion; values of @set, or just plain values which are empty arrays are retained

{
"@context": {
"mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
"mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
"myset2": {"@id": "http://example.com/myset2", "@container": "@set"},
"myset3": {"@id": "http://example.com/myset3", "@container": "@set"}
},
"@id": "http://example.org/id",
"mylist1": { "@list": [ ] },
"mylist2": "one item",
"myset2": { "@set": [ ] },
"myset3": [ "v1" ],
"http://example.org/list1": { "@list": [ null ] },
"http://example.org/list2": { "@list": [ {"@value": null} ] },
"http://example.org/set1": { "@set": [ ] },
"http://example.org/set1": { "@set": [ null ] },
"http://example.org/set3": [ ],
"http://example.org/set4": [ null ],
"http://example.org/set5": "one item",
"http://example.org/property": { "@list": "one item" }
}
[
{
"@id": "http://example.org/id",
"http://example.com/mylist1": [
{
"@list": [

]
}
],
"http://example.com/mylist2": [
{
"@list": [
{
"@value": "one item"
}
]
}
],
"http://example.com/myset2": [

],
"http://example.com/myset3": [
{
"@value": "v1"
}
],
"http://example.org/list1": [
{
"@list": [

]
}
],
"http://example.org/list2": [
{
"@list": [

]
}
],
"http://example.org/property": [
{
"@list": [
{
"@value": "one item"
}
]
}
],
"http://example.org/set1": [

],
"http://example.org/set3": [

],
"http://example.org/set4": [

],
"http://example.org/set5": [
{
"@value": "one item"
}
]
}
]
Test 0005: do not expand aliased @id/@type

If a keyword is aliased, it is not used when flattening

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
},
"know": "http://xmlns.com/foaf/0.1/knows",
"@iri": "@id"
},
"@id": "#me",
"know": [
{
"@id": "http://example.com/bob#me",
"name": "Bob",
"homepage": "http://example.com/bob"
}, {
"@id": "http://example.com/alice#me",
"name": "Alice",
"homepage": "http://example.com/alice"
}
]
}
[
{
"@id": "http://example.com/alice#me",
"http://xmlns.com/foaf/0.1/homepage": [
{
"@id": "http://example.com/alice"
}
],
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "Alice"
}
]
},
{
"@id": "http://example.com/bob#me",
"http://xmlns.com/foaf/0.1/homepage": [
{
"@id": "http://example.com/bob"
}
],
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "Bob"
}
]
},
{
"@id": "http://json-ld.org/test-suite/tests/flatten-0005-in.jsonld#me",
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/bob#me"
},
{
"@id": "http://example.com/alice#me"
}
]
}
]
Test 0006: alias keywords

Aliased keywords expand in resulting document

{
"@context": {
"http://example.org/test#property1": {
"@type": "@id"
},
"http://example.org/test#property2": {
"@type": "@id"
},
"uri": "@id"
},
"http://example.org/test#property1": {
"http://example.org/test#property4": "foo",
"uri": "http://example.org/test#example2"
},
"http://example.org/test#property2": "http://example.org/test#example3",
"http://example.org/test#property3": {
"uri": "http://example.org/test#example4"
},
"uri": "http://example.org/test#example1"
}
[
{
"@id": "http://example.org/test#example1",
"http://example.org/test#property1": [
{
"@id": "http://example.org/test#example2"
}
],
"http://example.org/test#property2": [
{
"@id": "http://example.org/test#example3"
}
],
"http://example.org/test#property3": [
{
"@id": "http://example.org/test#example4"
}
]
},
{
"@id": "http://example.org/test#example2",
"http://example.org/test#property4": [
{
"@value": "foo"
}
]
}
]
Test 0007: date type-coercion

Expand strings to expanded value with @type: xsd:dateTime

{
"@context": {
"ex": "http://example.org/vocab#",
"ex:date": {
"@type": "xsd:dateTime"
},
"ex:parent": {
"@type": "@id"
},
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "http://example.org/test#example1",
"ex:date": "2011-01-25T00:00:00Z",
"ex:embed": {
"@id": "http://example.org/test#example2",
"ex:parent": "http://example.org/test#example1"
}
}
[
{
"@id": "http://example.org/test#example1",
"http://example.org/vocab#date": [
{
"@value": "2011-01-25T00:00:00Z",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
}
],
"http://example.org/vocab#embed": [
{
"@id": "http://example.org/test#example2"
}
]
},
{
"@id": "http://example.org/test#example2",
"http://example.org/vocab#parent": [
{
"@id": "http://example.org/test#example1"
}
]
}
]
Test 0008: @value with @language

Keep expanded values with @language, drop non-conforming value objects containing just @language

{
"@context": {
"ex": "http://example.org/vocab#"
},
"@id": "http://example.org/test",
"ex:test": { "@value": "test", "@language": "en" },
"ex:drop-lang-only": { "@language": "en" },
"ex:keep-full-value": { "@value": "only value" }
}
[
{
"@id": "http://example.org/test",
"http://example.org/vocab#keep-full-value": [
{
"@value": "only value"
}
],
"http://example.org/vocab#test": [
{
"@language": "en",
"@value": "test"
}
]
}
]
Test 0009: @graph with terms

Use of @graph to contain multiple nodes within array

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
}
},
"@graph": [
{
"@id": "http://example.org/test#chapter",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#jane",
"authored": "http://example.org/test#chapter",
"name": "Jane"
},
{
"@id": "http://example.org/test#john",
"name": "John"
},
{
"@id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
[
{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#chapter"
}
],
"http://purl.org/dc/elements/1.1/contributor": [
{
"@value": "Writer"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "My Book"
}
]
},
{
"@id": "http://example.org/test#chapter",
"http://purl.org/dc/elements/1.1/description": [
{
"@value": "Fun"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "Chapter One"
}
]
},
{
"@id": "http://example.org/test#jane",
"http://example.org/vocab#authored": [
{
"@id": "http://example.org/test#chapter"
}
],
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "Jane"
}
]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "John"
}
]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#book"
}
]
}
]
Test 0010: native types

Flattening native scalar retains native scalar within expanded value

{
"@context": {
"d": "http://purl.org/dc/elements/1.1/",
"e": "http://example.org/vocab#",
"f": "http://xmlns.com/foaf/0.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "http://example.org/test",
"e:bool": true,
"e:int": 123
}
[
{
"@id": "http://example.org/test",
"http://example.org/vocab#bool": [
{
"@value": true
}
],
"http://example.org/vocab#int": [
{
"@value": 123
}
]
}
]
Test 0011: coerced @id

A value of a property with @type: @id coercion expands to a node reference

{
"@context": {
"dc": "http://purl.org/dc/elements/1.1/",
"ex": "http://example.org/vocab#",
"ex:contains": {
"@type": "@id"
},
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "http://example.org/test#book",
"dc:title": "Title",
"ex:contains": "http://example.org/test#chapter"
}
[
{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#chapter"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "Title"
}
]
}
]
Test 0012: @graph with embed

Flattening objects containing chained objects flattens all objects

{
"@context": {
"dc": "http://purl.org/dc/elements/1.1/",
"ex": "http://example.org/vocab#",
"ex:authored": {
"@type": "@id"
},
"ex:contains": {
"@type": "@id"
},
"foaf": "http://xmlns.com/foaf/0.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@graph": [
{
"@id": "http://example.org/test#chapter",
"dc:description": "Fun",
"dc:title": "Chapter One"
},
{
"@id": "http://example.org/test#jane",
"ex:authored": "http://example.org/test#chapter",
"foaf:name": "Jane"
},
{
"@id": "http://example.org/test#john",
"foaf:name": "John"
},
{
"@id": "http://example.org/test#library",
"ex:contains": {
"@id": "http://example.org/test#book",
"dc:contributor": "Writer",
"dc:title": "My Book",
"ex:contains": "http://example.org/test#chapter"
}
}
]
}
[
{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#chapter"
}
],
"http://purl.org/dc/elements/1.1/contributor": [
{
"@value": "Writer"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "My Book"
}
]
},
{
"@id": "http://example.org/test#chapter",
"http://purl.org/dc/elements/1.1/description": [
{
"@value": "Fun"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "Chapter One"
}
]
},
{
"@id": "http://example.org/test#jane",
"http://example.org/vocab#authored": [
{
"@id": "http://example.org/test#chapter"
}
],
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "Jane"
}
]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "John"
}
]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#book"
}
]
}
]
Test 0013: flatten already expanded

Flattening an expanded/flattened document maintains input document

[{
"@id": "http://example.com/id1",
"@type": ["http://example.com/t1"],
"http://example.com/term1": ["v1"],
"http://example.com/term2": [{"@value": "v2", "@type": "http://example.com/t2"}],
"http://example.com/term3": [{"@value": "v3", "@language": "en"}],
"http://example.com/term4": [4],
"http://example.com/term5": [50, 51]
}]
[
{
"@id": "http://example.com/id1",
"@type": [
"http://example.com/t1"
],
"http://example.com/term1": [
{
"@value": "v1"
}
],
"http://example.com/term2": [
{
"@type": "http://example.com/t2",
"@value": "v2"
}
],
"http://example.com/term3": [
{
"@language": "en",
"@value": "v3"
}
],
"http://example.com/term4": [
{
"@value": 4
}
],
"http://example.com/term5": [
{
"@value": 50
},
{
"@value": 51
}
]
}
]
Test 0014: @set of @value objects with keyword aliases

Flattening aliased @set and @value

{
"@context": {
"ex": "http://example.org/test#",
"property1": {
"@id": "http://example.org/test#property1",
"@type": "@id"
},
"property2": {
"@id": "ex:property2",
"@type": "@id"
},
"uri": "@id",
"set": "@set",
"value": "@value",
"type": "@type",
"xsd": { "@id": "http://www.w3.org/2001/XMLSchema#" }
},
"property1": {
"uri": "ex:example2",
"http://example.org/test#property4": "foo"
},
"property2": "http://example.org/test#example3",
"http://example.org/test#property3": {
"uri": "http://example.org/test#example4"
},
"ex:property4": {
"uri": "ex:example4",
"ex:property5": [
{
"set": [
{
"value": "2012-03-31",
"type": "xsd:date"
}
]
}
]
},
"ex:property6": [
{
"set": [
{
"value": null,
"type": "xsd:date"
}
]
}
],
"uri": "http://example.org/test#example1"
}
[
{
"@id": "http://example.org/test#example1",
"http://example.org/test#property1": [
{
"@id": "http://example.org/test#example2"
}
],
"http://example.org/test#property2": [
{
"@id": "http://example.org/test#example3"
}
],
"http://example.org/test#property3": [
{
"@id": "http://example.org/test#example4"
}
],
"http://example.org/test#property4": [
{
"@id": "http://example.org/test#example4"
}
],
"http://example.org/test#property6": [

]
},
{
"@id": "http://example.org/test#example2",
"http://example.org/test#property4": [
{
"@value": "foo"
}
]
},
{
"@id": "http://example.org/test#example4",
"http://example.org/test#property5": [
{
"@type": "http://www.w3.org/2001/XMLSchema#date",
"@value": "2012-03-31"
}
]
}
]
Test 0015: collapse set of sets, keep empty lists

An array of multiple @set nodes are collapsed into a single array

{
"@context": {
"mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
"mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
"myset1": {"@id": "http://example.com/myset1", "@container": "@set" },
"myset2": {"@id": "http://example.com/myset2", "@container": "@set" },
"myset3": {"@id": "http://example.com/myset3", "@container": "@set" }
},
"@id": "http://example.org/id",
"mylist1": [],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
"myset3": [ { "@set": [ "hello", "this" ] }, "will", { "@set": [ "be", "collapsed" ] } ]
}
[
{
"@id": "http://example.org/id",
"http://example.com/mylist1": [
{
"@list": [

]
}
],
"http://example.com/myset1": [

],
"http://example.com/myset2": [

],
"http://example.com/myset3": [
{
"@value": "hello"
},
{
"@value": "this"
},
{
"@value": "will"
},
{
"@value": "be"
},
{
"@value": "collapsed"
}
]
}
]
Test 0016: context reset

Setting @context to null within an embedded object resets back to initial context state

{
"@context": {
"myproperty": { "@id": "http://example.com/myproperty" },
"mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
"mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
"myset1": {"@id": "http://example.com/myset1", "@container": "@set" },
"myset2": {"@id": "http://example.com/myset2", "@container": "@set" }
},
"@id": "http://example.org/id1",
"mylist1": [],
"mylist2": [ 2, "hi" ],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
"myproperty": {
"@context": null,
"@id": "http://example.org/id2",
"mylist1": [],
"mylist2": [ 2, "hi" ],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
"http://example.org/myproperty2": "ok"
},
"http://example.com/emptyobj": {
"@context": null,
"mylist1": [],
"mylist2": [ 2, "hi" ],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ]
}
}
[
{
"@id": "http://example.org/id1",
"http://example.com/emptyobj": [
{
"@id": "_:b0"
}
],
"http://example.com/mylist1": [
{
"@list": [

]
}
],
"http://example.com/mylist2": [
{
"@list": [
{
"@value": 2
},
{
"@value": "hi"
}
]
}
],
"http://example.com/myproperty": [
{
"@id": "http://example.org/id2"
}
],
"http://example.com/myset1": [

],
"http://example.com/myset2": [

]
},
{
"@id": "http://example.org/id2",
"http://example.org/myproperty2": [
{
"@value": "ok"
}
]
}
]
Test 0017: @graph and @id aliased

Flattening with @graph and @id aliases

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
},
"id": "@id",
"data": "@graph"
},
"data": [
{
"id": "http://example.org/test#chapter",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#jane",
"authored": "http://example.org/test#chapter",
"name": "Jane"
},
{
"id": "http://example.org/test#john",
"name": "John"
},
{
"id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
[
{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#chapter"
}
],
"http://purl.org/dc/elements/1.1/contributor": [
{
"@value": "Writer"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "My Book"
}
]
},
{
"@id": "http://example.org/test#chapter",
"http://purl.org/dc/elements/1.1/description": [
{
"@value": "Fun"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "Chapter One"
}
]
},
{
"@id": "http://example.org/test#jane",
"http://example.org/vocab#authored": [
{
"@id": "http://example.org/test#chapter"
}
],
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "Jane"
}
]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "John"
}
]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#book"
}
]
}
]
Test 0018: override default @language

override default @language in terms; only language-tag strings

{
"@context": {
"ex": "http://example.org/vocab#",
"@language": "en",
"de": { "@id": "ex:german", "@language": "de" },
"nolang": { "@id": "ex:nolang", "@language": null }
},
"@id": "http://example.org/test",
"ex:test-default": [
"hello",
1,
true
],
"de": [
"hallo",
2,
true
],
"nolang": [
"no language",
3,
false
]
}
[
{
"@id": "http://example.org/test",
"http://example.org/vocab#german": [
{
"@value": "hallo",
"@language": "de"
},
{
"@value": 2
},
{
"@value": true
}
],
"http://example.org/vocab#nolang": [
{
"@value": "no language"
},
{
"@value": 3
},
{
"@value": false
}
],
"http://example.org/vocab#test-default": [
{
"@value": "hello",
"@language": "en"
},
{
"@value": 1
},
{
"@value": true
}
]
}
]
Test 0019: remove @value = null

Flattening a value of null removes the value

{
"@context": {
"myproperty": "http://example.com/myproperty"
},
"myproperty": { "@value" : null }
}
[ ]
Test 0020: do not remove @graph if not at top-level

@graph used under a node is retained

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
}
},
"@graph": [
{
"@id": "http://example.org/test#jane",
"name": "Jane",
"authored": {
"@graph": [
{
"@id": "http://example.org/test#chapter1",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#chapter2",
"description": "More fun",
"title": "Chapter Two"
}
]
}
},
{
"@id": "http://example.org/test#john",
"name": "John"
},
{
"@id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
[
{
"@id": "_:b0",
"@graph": [
{
"@id": "http://example.org/test#chapter1",
"http://purl.org/dc/elements/1.1/description": [
{
"@value": "Fun"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "Chapter One"
}
]
},
{
"@id": "http://example.org/test#chapter2",
"http://purl.org/dc/elements/1.1/description": [
{
"@value": "More fun"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "Chapter Two"
}
]
}
]
},
{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#chapter"
}
],
"http://purl.org/dc/elements/1.1/contributor": [
{
"@value": "Writer"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "My Book"
}
]
},
{
"@id": "http://example.org/test#jane",
"http://example.org/vocab#authored": [
{
"@id": "_:b0"
}
],
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "Jane"
}
]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "John"
}
]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#book"
}
]
}
]
Test 0021: do not remove @graph at top-level if not only property

@graph used at the top level is retained if there are other properties

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
}
},
"title": "My first graph",
"@graph": [
{
"@id": "http://example.org/test#jane",
"name": "Jane",
"authored": {
"@graph": [
{
"@id": "http://example.org/test#chapter1",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#chapter2",
"description": "More fun",
"title": "Chapter Two"
},
{
"@id": "http://example.org/test#chapter3",
"title": "Chapter Three"
}
]
}
},
{
"@id": "http://example.org/test#john",
"name": "John"
},
{
"@id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
[
{
"@id": "_:b0",
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "My first graph"
}
],
"@graph": [
{
"@id": "http://example.org/test#book",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#chapter"
}
],
"http://purl.org/dc/elements/1.1/contributor": [
{
"@value": "Writer"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "My Book"
}
]
},
{
"@id": "http://example.org/test#jane",
"http://example.org/vocab#authored": [
{
"@id": "_:b1"
}
],
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "Jane"
}
]
},
{
"@id": "http://example.org/test#john",
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "John"
}
]
},
{
"@id": "http://example.org/test#library",
"http://example.org/vocab#contains": [
{
"@id": "http://example.org/test#book"
}
]
}
]
},
{
"@id": "_:b1",
"@graph": [
{
"@id": "http://example.org/test#chapter1",
"http://purl.org/dc/elements/1.1/description": [
{
"@value": "Fun"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "Chapter One"
}
]
},
{
"@id": "http://example.org/test#chapter2",
"http://purl.org/dc/elements/1.1/description": [
{
"@value": "More fun"
}
],
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "Chapter Two"
}
]
},
{
"@id": "http://example.org/test#chapter3",
"http://purl.org/dc/elements/1.1/title": [
{
"@value": "Chapter Three"
}
]
}
]
}
]
Test 0022: flatten value with default language

Flattening with a default language applies that language to string values

{
"@context": {
"term": "http://example.com/term",
"@language": "en"
},
"term": "v"
}
[
{
"@id": "_:b0",
"http://example.com/term": [
{
"@value": "v",
"@language": "en"
}
]
}
]
Test 0023: Flattening list/set with coercion

Flattening lists and sets with properties having coercion coerces list/set values

{
"@context": {
"xsd": "http://www.w3.org/2001/XMLSchema#",
"idlist": {"@id": "http://example.com/idlist", "@container": "@list", "@type": "@id"},
"datelist": {"@id": "http://example.com/datelist", "@container": "@list", "@type": "xsd:date"},
"idset": {"@id": "http://example.com/idset", "@container": "@set", "@type": "@id"},
"dateset": {"@id": "http://example.com/dateset", "@container": "@set", "@type": "xsd:date"},
"idprop": {"@id": "http://example.com/idprop", "@type": "@id" },
"dateprop": {"@id": "http://example.com/dateprop", "@type": "xsd:date" },
"idprop2": {"@id": "http://example.com/idprop2", "@type": "@id" },
"dateprop2": {"@id": "http://example.com/dateprop2", "@type": "xsd:date" }
},
"idlist": ["http://example.org/id"],
"datelist": ["2012-04-12"],
"idprop": {"@list": ["http://example.org/id"]},
"dateprop": {"@list": ["2012-04-12"]},
"idset": ["http://example.org/id"],
"dateset": ["2012-04-12"],
"idprop2": {"@set": ["http://example.org/id"]},
"dateprop2": {"@set": ["2012-04-12"]}
}
[
{
"@id": "_:b0",
"http://example.com/datelist": [
{
"@list": [
{
"@value": "2012-04-12",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
]
}
],
"http://example.com/dateprop": [
{
"@list": [
{
"@value": "2012-04-12",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
]
}
],
"http://example.com/dateprop2": [
{
"@value": "2012-04-12",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
],
"http://example.com/dateset": [
{
"@value": "2012-04-12",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
],
"http://example.com/idlist": [
{
"@list": [
{
"@id": "http://example.org/id"
}
]
}
],
"http://example.com/idprop": [
{
"@list": [
{
"@id": "http://example.org/id"
}
]
}
],
"http://example.com/idprop2": [
{
"@id": "http://example.org/id"
}
],
"http://example.com/idset": [
{
"@id": "http://example.org/id"
}
]
}
]
Test 0024: Multiple contexts

Tests that contexts in an array are merged

{
"@context": [
{
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {"@id": "http://xmlns.com/foaf/0.1/homepage","@type": "@id"}
},
{"ical": "http://www.w3.org/2002/12/cal/ical#"}
],
"@id": "http://example.com/speakers#Alice",
"name": "Alice",
"homepage": "http://xkcd.com/177/",
"ical:summary": "Alice Talk",
"ical:location": "Lyon Convention Centre, Lyon, France"
}
[
{
"@id": "http://example.com/speakers#Alice",
"http://www.w3.org/2002/12/cal/ical#location": [
{
"@value": "Lyon Convention Centre, Lyon, France"
}
],
"http://www.w3.org/2002/12/cal/ical#summary": [
{
"@value": "Alice Talk"
}
],
"http://xmlns.com/foaf/0.1/homepage": [
{
"@id": "http://xkcd.com/177/"
}
],
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "Alice"
}
]
}
]
Test 0025: Problematic IRI flattening tests

Flattening different kinds of terms and Compact IRIs

{
"@context": {
"foo": "http://example.com/foo/",
"foo:bar": "http://example.com/bar",
"bar": {"@id": "foo:bar", "@type": "@id"},
"_": "http://example.com/underscore/"
},
"@type": ["foo", "foo:bar", "_"]
}
[
{
"@id": "_:b0",
"@type": [
"http://example.com/foo/",
"http://example.com/bar",
"http://example.com/underscore/"
]
}
]
Test 0026: Term definition with @id: @type

Flattening term mapping to @type uses @type syntax

{
"@context": {
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {"@id": "@type", "@type": "@id"}
},
"@graph": [
{
"@id": "http://example.com/a",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/b"
}, {
"@id": "http://example.com/c",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
"http://example.com/d",
"http://example.com/e"
]
}, {
"@id": "http://example.com/f",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/g"
}
]
}
[
{
"@id": "http://example.com/a",
"@type": [
"http://example.com/b"
]
},
{
"@id": "http://example.com/c",
"@type": [
"http://example.com/d",
"http://example.com/e"
]
},
{
"@id": "http://example.com/f",
"@type": [
"http://example.com/g"
]
}
]
Test 0027: Duplicate values in @list and @set

Duplicate values in @list and @set are not merged

{
"@context": {
"mylist": {"@id": "http://example.com/mylist", "@container": "@list"},
"myset": {"@id": "http://example.com/myset", "@container": "@set"}
},
"@id": "http://example.org/id",
"mylist": [1, 2, 2, 3],
"myset": [1, 2, 2, 3]
}
[
{
"@id": "http://example.org/id",
"http://example.com/mylist": [
{
"@list": [
{
"@value": 1
},
{
"@value": 2
},
{
"@value": 2
},
{
"@value": 3
}
]
}
],
"http://example.com/myset": [
{
"@value": 1
},
{
"@value": 2
},
{
"@value": 3
}
]
}
]
Test 0028: Use @vocab in properties and @type but not in @id

@vocab is used to compact properties and @type, but is not used for @id

{
"@context": {
"@vocab": "http://example.org/vocab#",
"date": { "@type": "dateTime" }
},
"@id": "example1",
"@type": "test",
"date": "2011-01-25T00:00:00Z",
"embed": {
"@id": "example2",
"expandedDate": { "@value": "2012-08-01T00:00:00Z", "@type": "dateTime" }
}
}
[
{
"@id": "http://json-ld.org/test-suite/tests/example1",
"@type": [
"http://example.org/vocab#test"
],
"http://example.org/vocab#date": [
{
"@value": "2011-01-25T00:00:00Z",
"@type": "http://example.org/vocab#dateTime"
}
],
"http://example.org/vocab#embed": [
{
"@id": "http://json-ld.org/test-suite/tests/example2"
}
]
},
{
"@id": "http://json-ld.org/test-suite/tests/example2",
"http://example.org/vocab#expandedDate": [
{
"@type": "http://example.org/vocab#dateTime",
"@value": "2012-08-01T00:00:00Z"
}
]
}
]
Test 0029: Relative IRIs

@base is used to compact @id; test with different relative IRIs

{
"@context": {
"links": { "@id": "http://www.example.com/link", "@type": "@id", "@container": "@list" }
},
"@id": "relativeIris",
"@type": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../../parent-parent-eq-root",
"../../../../../still-root",
"../.././.././../../too-many-dots",
"/absolute",
"//example.org/scheme-relative"
],
"links": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../../parent-parent-eq-root",
"./../../../useless/../../../still-root",
"../.././.././../../too-many-dots",
"/absolute",
"//example.org/scheme-relative"
]
}
[
{
"@id": "http://json-ld.org/test-suite/tests/relativeIris",
"@type": [
"http://json-ld.org/test-suite/tests/link",
"http://json-ld.org/test-suite/tests/flatten-0029-in.jsonld#fragment-works",
"http://json-ld.org/test-suite/tests/flatten-0029-in.jsonld?query=works",
"http://json-ld.org/test-suite/tests/",
"http://json-ld.org/test-suite/",
"http://json-ld.org/test-suite/parent",
"http://json-ld.org/parent-parent-eq-root",
"http://json-ld.org/still-root",
"http://json-ld.org/too-many-dots",
"http://json-ld.org/absolute",
"http://example.org/scheme-relative"
],
"http://www.example.com/link": [
{
"@list": [
{
"@id": "http://json-ld.org/test-suite/tests/link"
},
{
"@id": "http://json-ld.org/test-suite/tests/flatten-0029-in.jsonld#fragment-works"
},
{
"@id": "http://json-ld.org/test-suite/tests/flatten-0029-in.jsonld?query=works"
},
{
"@id": "http://json-ld.org/test-suite/tests/"
},
{
"@id": "http://json-ld.org/test-suite/"
},
{
"@id": "http://json-ld.org/test-suite/parent"
},
{
"@id": "http://json-ld.org/parent-parent-eq-root"
},
{
"@id": "http://json-ld.org/still-root"
},
{
"@id": "http://json-ld.org/too-many-dots"
},
{
"@id": "http://json-ld.org/absolute"
},
{
"@id": "http://example.org/scheme-relative"
}
]
}
]
}
]
Test 0030: Language maps

Language Maps expand values to include @language

{
"@context": {
"vocab": "http://example.com/vocab/",
"label": {
"@id": "vocab:label",
"@container": "@language"
}
},
"@id": "http://example.com/queen",
"label": {
"en": "The Queen",
"de": [ "Die Königin", "Ihre Majestät" ]
}
}
[
{
"@id": "http://example.com/queen",
"http://example.com/vocab/label": [
{
"@value": "Die Königin",
"@language": "de"
},
{
"@value": "Ihre Majestät",
"@language": "de"
},
{
"@value": "The Queen",
"@language": "en"
}
]
}
]
Test 0031: type-coercion of native types

Flattening native types with type coercion adds the coerced type to an expanded value representation and retains the native value representation

{
"@context": {
"ex": "http://example.org/vocab#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"ex:integer": { "@type": "xsd:integer" },
"ex:double": { "@type": "xsd:double" },
"ex:boolean": { "@type": "xsd:boolean" }
},
"@id": "http://example.org/test#example1",
"ex:integer": 1,
"ex:double": 123.45,
"ex:boolean": true
}
[
{
"@id": "http://example.org/test#example1",
"http://example.org/vocab#boolean": [
{
"@value": true,
"@type": "http://www.w3.org/2001/XMLSchema#boolean"
}
],
"http://example.org/vocab#double": [
{
"@value": 123.45,
"@type": "http://www.w3.org/2001/XMLSchema#double"
}
],
"http://example.org/vocab#integer": [
{
"@value": 1,
"@type": "http://www.w3.org/2001/XMLSchema#integer"
}
]
}
]
Test 0032: Null term and @vocab

Mapping a term to null decouples it from @vocab

{
"@context": {
"@vocab": "http://xmlns.com/foaf/0.1/",
"from": null,
"university": { "@id": null }
},
"@id": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"from": "Italy",
"university": "TU Graz"
}
[
{
"@id": "http://me.markus-lanthaler.com/",
"http://xmlns.com/foaf/0.1/name": [
{
"@value": "Markus Lanthaler"
}
]
}
]
Test 0033: Using @vocab with with type-coercion

Verifies that terms can be defined using @vocab

{
"@context": {
"@vocab": "http://example.com/vocab#",
"homepage": {
"@type": "@id"
},
"created_at": {
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
},
"name": "Markus Lanthaler",
"homepage": "http://www.markus-lanthaler.com/",
"created_at": "2012-10-28"
}
[
{
"@id": "_:b0",
"http://example.com/vocab#created_at": [
{
"@value": "2012-10-28",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
],
"http://example.com/vocab#homepage": [
{
"@id": "http://www.markus-lanthaler.com/"
}
],
"http://example.com/vocab#name": [
{
"@value": "Markus Lanthaler"
}
]
}
]
Test 0034: Multiple properties expanding to the same IRI

Verifies multiple values from separate terms are deterministically made multiple values of the IRI associated with the terms

{
"@context": {
"@vocab": "http://example.com/vocab/",
"colliding": "http://example.com/vocab/collidingTerm"
},
"@id": "http://example.com/IriCollissions",
"colliding": [
"value 1",
2
],
"collidingTerm": [
3,
"four"
],
"http://example.com/vocab/collidingTerm": 5
}
[
{
"@id": "http://example.com/IriCollissions",
"http://example.com/vocab/collidingTerm": [
{
"@value": "value 1"
},
{
"@value": 2
},
{
"@value": 3
},
{
"@value": "four"
},
{
"@value": 5
}
]
}
]
Test 0035: Language maps with @vocab, default language, and colliding property

Pathological tests of language maps

{
"@context": {
"@vocab": "http://example.com/vocab/",
"@language": "it",
"label": {
"@container": "@language"
}
},
"@id": "http://example.com/queen",
"label": {
"en": "The Queen",
"de": [ "Die Königin", "Ihre Majestät" ]
},
"http://example.com/vocab/label": [
"Il re",
{ "@value": "The king", "@language": "en" }
]
}
[
{
"@id": "http://example.com/queen",
"http://example.com/vocab/label": [
{
"@value": "Il re",
"@language": "it"
},
{
"@language": "en",
"@value": "The king"
},
{
"@value": "Die Königin",
"@language": "de"
},
{
"@value": "Ihre Majestät",
"@language": "de"
},
{
"@value": "The Queen",
"@language": "en"
}
]
}
]
Test 0036: Flattening @index

Flattening index maps for terms defined with @container: @index

{
"@context": {
"property": "http://example.com/property",
"indexContainer": { "@id": "http://example.com/container", "@container": "@index" }
},
"@id": "http://example.org/indexTest",
"indexContainer": {
"A": [
{
"@id": "http://example.org/nodeWithoutIndexA"
},
{
"@id": "http://example.org/nodeWithIndexA",
"@index": "this overrides the 'A' index from the container"
},
1,
true,
false,
null,
"simple string A",
{
"@value": "typed literal A",
"@type": "http://example.org/type"
},
{
"@value": "language-tagged string A",
"@language": "en"
}
],
"B": "simple string B",
"C": [
{
"@id": "http://example.org/nodeWithoutIndexC"
},
{
"@id": "http://example.org/nodeWithIndexC",
"@index": "this overrides the 'C' index from the container"
},
3,
true,
false,
null,
"simple string C",
{
"@value": "typed literal C",
"@type": "http://example.org/type"
},
{
"@value": "language-tagged string C",
"@language": "en"
}
]
},
"property": [
{
"@id": "http://example.org/nodeWithoutIndexProp"
},
{
"@id": "http://example.org/nodeWithIndexProp",
"@index": "prop"
},
{
"@value": 3,
"@index": "prop"
},
{
"@value": true,
"@index": "prop"
},
{
"@value": false,
"@index": "prop"
},
{
"@value": null,
"@index": "prop"
},
"simple string no index",
{
"@value": "typed literal Prop",
"@type": "http://example.org/type",
"@index": "prop"
},
{
"@value": "language-tagged string Prop",
"@language": "en",
"@index": "prop"
}
]
}
[
{
"@id": "http://example.org/indexTest",
"http://example.com/container": [
{
"@id": "http://example.org/nodeWithoutIndexA"
},
{
"@id": "http://example.org/nodeWithIndexA"
},
{
"@value": 1,
"@index": "A"
},
{
"@value": true,
"@index": "A"
},
{
"@value": false,
"@index": "A"
},
{
"@value": "simple string A",
"@index": "A"
},
{
"@type": "http://example.org/type",
"@value": "typed literal A",
"@index": "A"
},
{
"@language": "en",
"@value": "language-tagged string A",
"@index": "A"
},
{
"@value": "simple string B",
"@index": "B"
},
{
"@id": "http://example.org/nodeWithoutIndexC"
},
{
"@id": "http://example.org/nodeWithIndexC"
},
{
"@value": 3,
"@index": "C"
},
{
"@value": true,
"@index": "C"
},
{
"@value": false,
"@index": "C"
},
{
"@value": "simple string C",
"@index": "C"
},
{
"@type": "http://example.org/type",
"@value": "typed literal C",
"@index": "C"
},
{
"@language": "en",
"@value": "language-tagged string C",
"@index": "C"
}
],
"http://example.com/property": [
{
"@id": "http://example.org/nodeWithoutIndexProp"
},
{
"@id": "http://example.org/nodeWithIndexProp"
},
{
"@index": "prop",
"@value": 3
},
{
"@index": "prop",
"@value": true
},
{
"@index": "prop",
"@value": false
},
{
"@value": "simple string no index"
},
{
"@index": "prop",
"@type": "http://example.org/type",
"@value": "typed literal Prop"
},
{
"@index": "prop",
"@language": "en",
"@value": "language-tagged string Prop"
}
]
},
{
"@id": "http://example.org/nodeWithIndexA",
"@index": "this overrides the 'A' index from the container"
},
{
"@id": "http://example.org/nodeWithIndexC",
"@index": "this overrides the 'C' index from the container"
},
{
"@id": "http://example.org/nodeWithIndexProp",
"@index": "prop"
},
{
"@id": "http://example.org/nodeWithoutIndexA",
"@index": "A"
},
{
"@id": "http://example.org/nodeWithoutIndexC",
"@index": "C"
}
]
Test 0037: Flattening reverse properties

Flattening @reverse keeps @reverse

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"@id": "http://example.com/people/dave"
},
{
"@id": "http://example.com/people/gregg"
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
[
{
"@id": "http://example.com/people/dave",
"http://xmlns.com/foaf/0.1/knows": [ { "@id": "http://example.com/people/markus" } ]
},
{
"@id": "http://example.com/people/gregg",
"http://xmlns.com/foaf/0.1/knows": [ { "@id": "http://example.com/people/markus" } ]
},
{
"@id": "http://example.com/people/markus",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0038: Flattening blank node labels

Blank nodes are not relabeled during expansion

{
"@context": {
"term": "_:term",
"termId": { "@id": "term", "@type": "@id" }
},
"@id": "_:term",
"@type": "_:term",
"term": [
{
"@id": "_:term",
"@type": "term"
},
{
"@id": "_:Bx",
"term": "term"
},
"plain value",
{
"@id": "_:term"
}
],
"termId": [
{
"@id": "_:term",
"@type": "term"
},
{
"@id": "_:Cx",
"term": "termId"
},
"term:AppendedToBlankNode",
"_:termAppendedToBlankNode",
"relativeIri",
{
"@id": "_:term"
}
]
}
[
{
"@id": "_:b0",
"@type": [
"_:b0"
],
"_:b0": [
{
"@id": "_:b0"
},
{
"@id": "_:b1"
},
{
"@value": "plain value"
},
{
"@id": "_:b2"
},
{
"@id": "_:b3"
},
{
"@id": "http://json-ld.org/test-suite/tests/relativeIri"
}
]
},
{
"@id": "_:b1",
"_:b0": [
{
"@value": "term"
}
]
},
{
"@id": "_:b2",
"_:b0": [
{
"@value": "termId"
}
]
}
]
Test 0039: Using terms in a reverse-maps

Terms within @reverse are expanded

[
{
"@id": "http://example.com/people/markus",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": [
{
"http://xmlns.com/foaf/0.1/name": "Dave Longley"
},
{
"http://xmlns.com/foaf/0.1/name": "Gregg Kellogg"
}
]
},
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
[
{
"@id": "_:b0",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ],
"http://xmlns.com/foaf/0.1/knows": [ { "@id": "http://example.com/people/markus" } ]
},
{
"@id": "_:b1",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Gregg Kellogg" } ],
"http://xmlns.com/foaf/0.1/knows": [ { "@id": "http://example.com/people/markus" } ]
},
{
"@id": "http://example.com/people/markus",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
}
]
Test 0040: language and index expansion on non-objects

Only invoke language and index map expansion if the value is a JSON object

{
"@context": {
"vocab": "http://example.com/vocab/",
"label": {
"@id": "vocab:label",
"@container": "@language"
},
"indexes": {
"@id": "vocab:index",
"@container": "@index"
}
},
"@id": "http://example.com/queen",
"label": [
"The Queen"
],
"indexes":
[
"No",
"indexes",
{ "@id": "asTheValueIsntAnObject" }
]
}
[
{
"@id": "http://example.com/queen",
"http://example.com/vocab/index": [
{
"@value": "No"
},
{
"@value": "indexes"
},
{
"@id": "http://json-ld.org/test-suite/tests/asTheValueIsntAnObject"
}
],
"http://example.com/vocab/label": [
{
"@value": "The Queen"
}
]
}
]
Test 0041: Free-floating sets and lists

Free-floating values in sets are removed, free-floating lists are removed completely

{
"@context": {
"property": "http://example.com/property"
},
"@graph": [
{
"@set": [
"free-floating strings in set objects are removed",
{
"@id": "http://example.com/free-floating-node"
},
{
"@id": "http://example.com/node",
"property": "nodes with properties are not removed"
}
]
},
{
"@list": [
"lists are removed even though they represent an invisible linked structure, they have no real meaning"
]
}
]
}
[
{
"@id": "http://example.com/node",
"http://example.com/property": [
{
"@value": "nodes with properties are not removed"
}
]
}
]
Test 0042: List objects not equivalent

Lists objects are implicit unlabeled blank nodes and thus never equivalent

{
"@context": {
"test": "http://example.com/list"
},
"@id": "list-equivalence-test",
"test": [
{ "@list": [ "1", "2" ] },
{ "@list": [ "1", "2" ] }
]
}
[
{
"@id": "http://json-ld.org/test-suite/tests/list-equivalence-test",
"http://example.com/list": [
{
"@list": [ { "@value": "1" }, { "@value": "2" } ]
},
{
"@list": [ { "@value": "1" }, { "@value": "2" } ]
}
]
}
]
Test 0043: Sample test manifest extract

Flatten a test manifest

{
"@id": "",
"http://example/sequence": {"@list": [
{
"@id": "#t0001",
"http://example/name": "Keywords cannot be aliased to other keywords",
"http://example/input": {"@id": "error-expand-0001-in.jsonld"}
}
]}
}
[
{
"@id": "http://json-ld.org/test-suite/tests/flatten-0043-in.jsonld",
"http://example/sequence": [
{"@list": [{"@id": "http://json-ld.org/test-suite/tests/flatten-0043-in.jsonld#t0001"}]}
]
},
{
"@id": "http://json-ld.org/test-suite/tests/flatten-0043-in.jsonld#t0001",
"http://example/input": [
{"@id": "http://json-ld.org/test-suite/tests/error-expand-0001-in.jsonld"}
],
"http://example/name": [
{"@value": "Keywords cannot be aliased to other keywords"}
]
}
]
Test 0044: compactArrays option

Setting compactArrays to false causes single element arrays to be retained

[{
"@id": "http://example/foo",
"http://example/term": [{"@value": "value"}]
}]
{
"@context": {
"term": "http://example/term"
},
"@graph": [{
"@id": "http://example/foo",
"term": ["value"]
}]
}
Test 0045: Blank nodes with reverse properties

Proper (re-)labeling of blank nodes if used with reverse properties.

{
"@context": {
"foo": "http://example.org/foo",
"bar": { "@reverse": "http://example.org/bar", "@type": "@id" }
},
"foo": "Foo",
"bar": [ "http://example.org/origin", "_:b0" ]
}
[
{
"@id": "_:b0",
"http://example.org/foo": [ { "@value": "Foo" } ]
},
{
"@id": "_:b1",
"http://example.org/bar": [ { "@id": "_:b0" } ]
},
{
"@id": "http://example.org/origin",
"http://example.org/bar": [ { "@id": "_:b0" } ]
}
]
Test 0001: load JSON-LD document

Document loader loads a JSON-LD document.

{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
[{
"@id": "http://json-ld.org/test-suite/tests/remote-doc-0001-in.jsonld",
"http://example/vocab#term": [{"@value": "object"}]
}]
Test 0002: load JSON document

Document loader loads a JSON document.

{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
[{
"@id": "http://json-ld.org/test-suite/tests/remote-doc-0002-in.json",
"http://example/vocab#term": [{"@value": "object"}]
}]
Test 0003: load JSON document with extension-type

Document loader loads a JSON document having an extension mime-subtype.

{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
[{
"@id": "http://json-ld.org/test-suite/tests/remote-doc-0003-in.jldt",
"http://example/vocab#term": [{"@value": "object"}]
}]
Test 0004: loading an unknown type raises loading document failed

Loading a document with a non-JSON mime type raises loading document failed


            
http://json-ld.org/test-suite/tests/loading document failed not loaded
Test 0005: Load JSON-LD through 301 redirect

Loading a document with a redirect should use the redirected URL as document base

{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
[{
"@id": "http://json-ld.org/test-suite/tests/remote-doc-0001-in.jsonld",
"http://example/vocab#term": [{"@value": "object"}]
}]
Test 0006: Load JSON-LD through 303 redirect

Loading a document with a redirect should use the redirected URL as document base

{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
[{
"@id": "http://json-ld.org/test-suite/tests/remote-doc-0001-in.jsonld",
"http://example/vocab#term": [{"@value": "object"}]
}]
Test 0007: Load JSON-LD through 307 redirect

Loading a document with a redirect should use the redirected URL as document base

{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
[{
"@id": "http://json-ld.org/test-suite/tests/remote-doc-0001-in.jsonld",
"http://example/vocab#term": [{"@value": "object"}]
}]
Test 0008: Non-existant file (404)

Loading a non-existant file raises loading document failed error

http://json-ld.org/test-suite/tests/remote-doc-0008-in.jsonld not loaded
http://json-ld.org/test-suite/tests/loading document failed not loaded
Test 0009: load JSON-LD document with link

If a context is specified in a link header, it is not used for JSON-LD.

[{
"@id": "",
"http://example/0009/term": "value1",
"term": "value2"
}]
[{
"@id": "http://json-ld.org/test-suite/tests/remote-doc-0009-in.jsonld",
"http://example/0009/term": [{"@value": "value1"}]
}]
Test 0010: load JSON document with link

If a context is specified in a link header, it is used for JSON.

[{
"@id": "",
"term": "value"
}]
[{
"@id": "http://json-ld.org/test-suite/tests/remote-doc-0010-in.json",
"http://example/vocab#term": [{"@value": "value"}]
}]
Test 0011: load JSON document with extension-type with link

If a context is specified in a link header, it is used for a JSON extension type.

[{
"@id": "",
"term": "value"
}]
[{
"@id": "http://json-ld.org/test-suite/tests/remote-doc-0011-in.jldt",
"http://example/vocab#term": [{"@value": "value"}]
}]
Test 0012: Multiple context link headers

Loading a file when multiple link headers are returned is an error

[{
"@id": "",
"term": "value"
}]
http://json-ld.org/test-suite/tests/multiple context link headers not loaded
Test 0001: Plain literal with URIs

Tests generation of a triple using full URIs and a plain literal.

{
"@id": "http://greggkellogg.net/foaf#me",
"http://xmlns.com/foaf/0.1/name": "Gregg Kellogg"
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
Test 0002: Plain literal with CURIE from default context

Tests generation of a triple using a CURIE defined in the default context.

{
"@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:name": "Gregg Kellogg"
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
Test 0003: Default subject is BNode

Tests that a BNode is created if no explicit subject is set.

{
"@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
"@type": "foaf:Person"
}
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
Test 0004: Literal with language tag

Tests that a plain literal is created with a language tag.

{
"http://www.w3.org/2000/01/rdf-schema#label": {
"@value": "A plain literal with a lang tag.",
"@language": "en-us"
}
}
_:b0 <http://www.w3.org/2000/01/rdf-schema#label> "A plain literal with a lang tag."@en-us .
Test 0005: Extended character set literal

Tests that a literal may be created using extended characters.

{
"@id": "http://greggkellogg.net/foaf#me",
"http://xmlns.com/foaf/0.1/knows": {
"http://xmlns.com/foaf/0.1/name": {"@value": "Herman Iván", "@language": "hu"}
}
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> _:b0 .
_:b0 <http://xmlns.com/foaf/0.1/name> "Herman Iván"@hu .
Test 0006: Typed literal

Tests creation of a literal with a datatype.

{
"@id": "http://greggkellogg.net/foaf#me",
"http://purl.org/dc/terms/created": {
"@value": "1957-02-27",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
}
<http://greggkellogg.net/foaf#me> <http://purl.org/dc/terms/created> "1957-02-27"^^<http://www.w3.org/2001/XMLSchema#date> .
Test 0007: Tests 'a' generates rdf:type and object is implicit IRI

Verify that 'a' is an alias for rdf:type, and the object is created as an IRI.

{
"@id": "http://greggkellogg.net/foaf#me",
"@type": "http://xmlns.com/foaf/0.1/Person"
}
<http://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
Test 0008: Test prefix defined in @context

Generate an IRI using a prefix defined within an @context.

{
"@context": {"d": "http://example.com/default#"},
"d:foo": "bar"
}
_:b0 <http://example.com/default#foo> "bar" .
Test 0009: Test using an empty suffix

An empty suffix may be used.

{
"@context": {"foo": "http://example.com/default#"},
"foo:": "bar"
}
_:b0 <http://example.com/default#> "bar" .
Test 0010: Test object processing defines object

A property referencing an associative array gets object from subject of array.

{
"@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": {
"@id": "http://manu.sporny.org/#me",
"foaf:name": "Manu Sporny"
}
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> <http://manu.sporny.org/#me> .
<http://manu.sporny.org/#me> <http://xmlns.com/foaf/0.1/name> "Manu Sporny" .
Test 0011: Test object processing defines object with implicit BNode

If no @ is specified, a BNode is created, and will be used as the object of an enclosing property.

{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": {
"foaf:name": "Dave Longley"
}
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> _:b0 .
_:b0 <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
Test 0012: Multiple Objects for a Single Property

Tests that Multiple Objects are for a Single Property using array syntax.

{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": ["Manu Sporny", "Dave Longley"]
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> "Dave Longley" .
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> "Manu Sporny" .
Test 0013: Creation of an empty list

Tests that @list: [] generates an empty list.

{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": {"@list": []}
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
Test 0014: Creation of a list with single element

Tests that @list generates a list.

{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": {"@list": ["Manu Sporny"]}
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> _:b0 .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Manu Sporny" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
Test 0015: Creation of a list with multiple elements

Tests that list with multiple elements.

{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": {"@list": ["Manu Sporny", "Dave Longley"]}
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> _:b0 .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Manu Sporny" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Dave Longley" .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
Test 0016: Empty IRI expands to resource location

Expanding an empty IRI uses the test file location.

{
"@id": "",
"@type": "http://www.w3.org/2000/01/rdf-schema#Resource"
}
<http://json-ld.org/test-suite/tests/toRdf-0016-in.jsonld> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
Test 0017: Relative IRI expands relative resource location

Expanding a relative IRI uses the test file location.

{
"@id": "a/b",
"@type": "http://www.w3.org/2000/01/rdf-schema#Resource"
}
<http://json-ld.org/test-suite/tests/a/b> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
Test 0018: Frag ID expands relative resource location

Expanding a fragment uses the test file location.

{
"@id": "#frag",
"@type": "http://www.w3.org/2000/01/rdf-schema#Resource"
}
<http://json-ld.org/test-suite/tests/toRdf-0018-in.jsonld#frag> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
Test 0019: Test type coercion to anyURI

Tests coercion of object to anyURI when specified.

{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/",
"knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@type": "@id"}
},
"@id": "http://greggkellogg.net/foaf#me",
"knows": "http://manu.sporny.org/#me"
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> <http://manu.sporny.org/#me> .
Test 0020: Test type coercion to typed literal

Tests coercion of object to a typed literal when specified.

{
"@context": {
"xsd": "http://www.w3.org/2001/XMLSchema#",
"created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:date"}
},
"@id": "http://greggkellogg.net/foaf#me",
"created": "1957-02-27"
}
<http://greggkellogg.net/foaf#me> <http://purl.org/dc/terms/created> "1957-02-27"^^<http://www.w3.org/2001/XMLSchema#date> .
Test 0022: Test coercion of double value

Tests that a decimal value generates a xsd:double typed literal;.

{
"@context": { "measure": "http://example/measure#"},
"measure:cups": 5.3
}
_:b0 <http://example/measure#cups> "5.3E0"^^<http://www.w3.org/2001/XMLSchema#double> .
Test 0023: Test coercion of integer value

Tests that a decimal value generates a xsd:integer typed literal.

{
"@context": { "chem": "http://example/chem#"},
"chem:protons": 12
}
_:b0 <http://example/chem#protons> "12"^^<http://www.w3.org/2001/XMLSchema#integer> .
Test 0024: Test coercion of boolean value

Tests that a decimal value generates a xsd:boolean typed literal.

{
"@context": { "sensor": "http://example/sensor#"},
"sensor:active": true
}
_:b0 <http://example/sensor#active> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
Test 0025: Test list coercion with single element

Tests that an array with a single element on a property with @list coercion creates an RDF Collection.

{
"@context": {
"knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@container": "@list"}
},
"@id": "http://greggkellogg.net/foaf#me",
"knows": ["Manu Sporny"]
}
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> _:b0 .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Manu Sporny" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
Test 0026: Test creation of multiple types

Tests that @type with an array of types creates multiple types.

{
"@context": {"rdfs": "http://www.w3.org/2000/01/rdf-schema#"},
"@type": ["rdfs:Resource", "rdfs:Class"]
}
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
Test 0027: Simple named graph (Wikidata)

Using @graph with other keys places triples in a named graph.

{
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"ex": "http://example.org/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"ex:locatedIn": {"@type": "@id"},
"ex:hasPopulaton": {"@type": "xsd:integer"},
"ex:hasReference": {"@type": "@id"}
},
"@graph": [
{
"@id": "http://example.org/ParisFact1",
"@type": "rdf:Graph",
"@graph": {
"@id": "http://example.org/location/Paris#this",
"ex:locatedIn": "http://example.org/location/France#this"
},
"ex:hasReference": ["http://www.britannica.com/", "http://www.wikipedia.org/", "http://www.brockhaus.de/"]
},
{
"@id": "http://example.org/ParisFact2",
"@type": "rdf:Graph",
"@graph": {
"@id": "http://example.org/location/Paris#this",
"ex:hasPopulation": 7000000
},
"ex:hasReference": "http://www.wikipedia.org/"
}
]
}
<http://example.org/ParisFact1> <http://example.org/hasReference> <http://www.britannica.com/> .
<http://example.org/ParisFact1> <http://example.org/hasReference> <http://www.brockhaus.de/> .
<http://example.org/ParisFact1> <http://example.org/hasReference> <http://www.wikipedia.org/> .
<http://example.org/ParisFact1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Graph> .
<http://example.org/ParisFact2> <http://example.org/hasReference> <http://www.wikipedia.org/> .
<http://example.org/ParisFact2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Graph> .
<http://example.org/location/Paris#this> <http://example.org/hasPopulation> "7000000"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/ParisFact2> .
<http://example.org/location/Paris#this> <http://example.org/locatedIn> <http://example.org/location/France#this> <http://example.org/ParisFact1> .
Test 0028: Simple named graph

Signing a graph.

{
"@context": {
"sec": "http://purl.org/security#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"dc": "http://purl.org/dc/terms/",
"sec:signer": {"@type": "@id"},
"dc:created": {"@type": "xsd:dateTime"}
},
"@id": "http://example.org/sig1",
"@type": ["rdf:Graph", "sec:SignedGraph"],
"dc:created": "2011-09-23T20:21:34Z",
"sec:signer": "http://payswarm.example.com/i/john/keys/5",
"sec:signatureValue": "OGQzNGVkMzVm4NTIyZTkZDYMmMzQzNmExMgoYzI43Q3ODIyOWM32NjI=",
"@graph": {
"@id": "http://example.org/fact1",
"dc:title": "Hello World!"
}
}
<http://example.org/fact1> <http://purl.org/dc/terms/title> "Hello World!" <http://example.org/sig1> .
<http://example.org/sig1> <http://purl.org/dc/terms/created> "2011-09-23T20:21:34Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://example.org/sig1> <http://purl.org/security#signatureValue> "OGQzNGVkMzVm4NTIyZTkZDYMmMzQzNmExMgoYzI43Q3ODIyOWM32NjI=" .
<http://example.org/sig1> <http://purl.org/security#signer> <http://payswarm.example.com/i/john/keys/5> .
<http://example.org/sig1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/security#SignedGraph> .
<http://example.org/sig1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Graph> .
Test 0029: named graph with embedded named graph

Tests that named graphs containing named graphs flatten to single level of graph naming.

{
"@context": {
"wd": "http://data.wikipedia.org/vocab#",
"ws": "http://data.wikipedia.org/snaks/",
"wp": "http://en.wikipedia.org/wiki/"
},
"@id": "ws:Assertions",
"@type": "wd:SnakSet",
"@graph": {
"@id": "ws:BerlinFact",
"@type": "wd:Snak",
"@graph": {
"@id": "wp:Berlin",
"wd:population": 3499879
},
"wd:assertedBy": "http://www.statistik-berlin-brandenburg.de/"
}
}
<http://data.wikipedia.org/snaks/Assertions> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.wikipedia.org/vocab#SnakSet> .
<http://data.wikipedia.org/snaks/BerlinFact> <http://data.wikipedia.org/vocab#assertedBy> "http://www.statistik-berlin-brandenburg.de/" <http://data.wikipedia.org/snaks/Assertions> .
<http://data.wikipedia.org/snaks/BerlinFact> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.wikipedia.org/vocab#Snak> <http://data.wikipedia.org/snaks/Assertions> .
<http://en.wikipedia.org/wiki/Berlin> <http://data.wikipedia.org/vocab#population> "3499879"^^<http://www.w3.org/2001/XMLSchema#integer> <http://data.wikipedia.org/snaks/BerlinFact> .
Test 0030: top-level graph with string subject reference

Tests graphs containing subject references as strings.

{
"@context": {
"xsd": "http://www.w3.org/2001/XMLSchema#",
"knows": "http://xmlns.com/foaf/0.1/knows",
"name": "http://xmlns.com/foaf/0.1/name",
"asOf": "http://example.org/asOf"
},
"@id": "http://example.org/linked-data-graph",
"asOf": {"@value": "2012-04-09", "@type": "xsd:date"},
"@graph":
[
{
"@id": "http://manu.sporny.org/i/public",
"@type": "foaf:Person",
"name": "Manu Sporny",
"knows": "http://greggkellogg.net/foaf#me"
},
{
"@id": "http://greggkellogg.net/foaf#me",
"@type": "foaf:Person",
"name": "Gregg Kellogg",
"knows": "http://manu.sporny.org/i/public"
},
{
"@id": "http://www.markus-lanthaler.com/"
}
]
}
<http://example.org/linked-data-graph> <http://example.org/asOf> "2012-04-09"^^<http://www.w3.org/2001/XMLSchema#date> .
<http://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <foaf:Person> <http://example.org/linked-data-graph> .
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> "http://manu.sporny.org/i/public" <http://example.org/linked-data-graph> .
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" <http://example.org/linked-data-graph> .
<http://manu.sporny.org/i/public> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <foaf:Person> <http://example.org/linked-data-graph> .
<http://manu.sporny.org/i/public> <http://xmlns.com/foaf/0.1/knows> "http://greggkellogg.net/foaf#me" <http://example.org/linked-data-graph> .
<http://manu.sporny.org/i/public> <http://xmlns.com/foaf/0.1/name> "Manu Sporny" <http://example.org/linked-data-graph> .
Test 0031: Reverse property

Tests conversion of reverse properties.

{
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"defines": { "@reverse": "rdfs:definedBy" },
"label": "rdfs:label"
},
"@id": "http://example.com/vocab",
"label": "My vocabulary",
"defines": [
{
"@id": "http://example.com/vocab#property",
"label": "A property"
}
]
}
<http://example.com/vocab#property> <http://www.w3.org/2000/01/rdf-schema#definedBy> <http://example.com/vocab> .
<http://example.com/vocab#property> <http://www.w3.org/2000/01/rdf-schema#label> "A property" .
<http://example.com/vocab> <http://www.w3.org/2000/01/rdf-schema#label> "My vocabulary" .
Test 0032: @context reordering

Tests that generated triples do not depend on order of @context.

{
"@id": "ex:node1",
"owl:sameAs": {
"@id": "ex:node2",
"rdfs:label": "Node 2",
"link": "ex:node3",
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
}
},
"@context": {
"ex": "http://example.org/",
"owl": "http://www.w3.org/2002/07/owl#",
"link": { "@id": "ex:link", "@type": "@id" }
}
}
<http://example.org/node1> <http://www.w3.org/2002/07/owl#sameAs> <http://example.org/node2> .
<http://example.org/node2> <http://example.org/link> <http://example.org/node3> .
<http://example.org/node2> <http://www.w3.org/2000/01/rdf-schema#label> "Node 2" .
Test 0033: @id reordering

Tests that generated triples do not depend on order of @id.

{
"@context": {
"ex": "http://example.org/",
"owl": "http://www.w3.org/2002/07/owl#",
"link": {
"@id": "ex:link",
"@type": "@id"
}
},
"owl:sameAs": {
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
},
"rdfs:label": "Node 2",
"link": "ex:node3",
"@id": "ex:node2"
},
"@id": "ex:node1"
}
<http://example.org/node1> <http://www.w3.org/2002/07/owl#sameAs> <http://example.org/node2> .
<http://example.org/node2> <http://example.org/link> <http://example.org/node3> .
<http://example.org/node2> <http://www.w3.org/2000/01/rdf-schema#label> "Node 2" .
Test 0034: context properties reordering

Tests that generated triples do not depend on order of properties inside @context.

{
"@context": {
"link": { "@id": "ex:link", "@type": "@id" },
"ex": "http://example.org/",
"owl": "http://www.w3.org/2002/07/owl#"
},
"@id": "ex:node1",
"owl:sameAs": {
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
},
"@id": "ex:node2",
"rdfs:label": "Node 2",
"link": "ex:node3"
}
}
<http://example.org/node1> <http://www.w3.org/2002/07/owl#sameAs> <http://example.org/node2> .
<http://example.org/node2> <http://example.org/link> <http://example.org/node3> .
<http://example.org/node2> <http://www.w3.org/2000/01/rdf-schema#label> "Node 2" .
Test 0035: non-fractional numbers converted to xsd:double

xsd:double's canonical lexical is used when converting numbers without fraction that are coerced to xsd:double

{
"@context": {
"double": {
"@id": "http://example.com/double",
"@type": "http://www.w3.org/2001/XMLSchema#double"
},
"integer": {
"@id": "http://example.com/integer",
"@type": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"double": [1, 2.2 ],
"integer": [8, 9.9 ]
}
_:b0 <http://example.com/double> "1.0E0"^^<http://www.w3.org/2001/XMLSchema#double> .
_:b0 <http://example.com/double> "2.2E0"^^<http://www.w3.org/2001/XMLSchema#double> .
_:b0 <http://example.com/integer> "8"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b0 <http://example.com/integer> "9.9E0"^^<http://www.w3.org/2001/XMLSchema#integer> .
Test 0036: Use nodeMapGeneration bnode labels

The toRDF algorithm does not relabel blank nodes; it reuses the counter from the nodeMapGeneration to generate new ones

{
"@id": "http://example.com/",
"ex:prop1": {
"@list": [ { "@id": "_:x1" }, { "@id": "_:x2" } ]
},
"ex:prop2": { "@id": "_:x3" }
}
<http://example.com/> <ex:prop1> _:b3 .
<http://example.com/> <ex:prop2> _:b2 .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:b0 .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b4 .
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:b1 .
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
Test 0041: drop free-floating nodes

Free-floating nodes do not generate RDF triples

{"@id": "http://example.org/test#example"}

          
Test 0042: basic

Basic RDF conversion

{
"@context": {
"t1": "http://example.com/t1",
"t2": "http://example.com/t2",
"term1": "http://example.com/term1",
"term2": "http://example.com/term2",
"term3": "http://example.com/term3",
"term4": "http://example.com/term4",
"term5": "http://example.com/term5"
},
"@id": "http://example.com/id1",
"@type": "t1",
"term1": "v1",
"term2": {"@value": "v2", "@type": "t2"},
"term3": {"@value": "v3", "@language": "en"},
"term4": 4,
"term5": [50, 51]
}
<http://example.com/id1> <http://example.com/term1> "v1" .
<http://example.com/id1> <http://example.com/term2> "v2"^^<http://example.com/t2> .
<http://example.com/id1> <http://example.com/term3> "v3"@en .
<http://example.com/id1> <http://example.com/term4> "4"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://example.com/term5> "50"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://example.com/term5> "51"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/t1> .
Test 0043: drop null and unmapped properties

Properties mapped to null or which are never mapped are dropped

{
"@id": "http://example.org/id",
"http://example.org/property": null,
"regularJson": {
"nonJsonLd": "property",
"deep": [{
"foo": "bar"
}, {
"bar": "foo"
}]
}
}

          
Test 0044: optimize @set, keep empty arrays

RDF version of expand-0004

{
"@context": {
"mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
"mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
"myset2": {"@id": "http://example.com/myset2", "@container": "@set"},
"myset3": {"@id": "http://example.com/myset3", "@container": "@set"}
},
"@id": "http://example.org/id",
"mylist1": { "@list": [ ] },
"mylist2": "one item",
"myset2": { "@set": [ ] },
"myset3": [ "v1" ],
"http://example.org/list1": { "@list": [ null ] },
"http://example.org/list2": { "@list": [ {"@value": null} ] },
"http://example.org/set1": { "@set": [ ] },
"http://example.org/set1": { "@set": [ null ] },
"http://example.org/set3": [ ],
"http://example.org/set4": [ null ],
"http://example.org/set5": "one item",
"http://example.org/property": { "@list": "one item" }
}
<http://example.org/id> <http://example.com/mylist1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
<http://example.org/id> <http://example.com/mylist2> _:b0 .
<http://example.org/id> <http://example.com/myset3> "v1" .
<http://example.org/id> <http://example.org/list1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
<http://example.org/id> <http://example.org/list2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
<http://example.org/id> <http://example.org/property> _:b1 .
<http://example.org/id> <http://example.org/set5> "one item" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "one item" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "one item" .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
Test 0045: do not expand aliased @id/@type

RDF version of expand-0005

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
},
"know": "http://xmlns.com/foaf/0.1/knows",
"@iri": "@id"
},
"@id": "#me",
"know": [
{
"@id": "http://example.com/bob#me",
"name": "Bob",
"homepage": "http://example.com/bob"
}, {
"@id": "http://example.com/alice#me",
"name": "Alice",
"homepage": "http://example.com/alice"
}
]
}
<http://example.com/alice#me> <http://xmlns.com/foaf/0.1/homepage> <http://example.com/alice> .
<http://example.com/alice#me> <http://xmlns.com/foaf/0.1/name> "Alice" .
<http://example.com/bob#me> <http://xmlns.com/foaf/0.1/homepage> <http://example.com/bob> .
<http://example.com/bob#me> <http://xmlns.com/foaf/0.1/name> "Bob" .
<http://json-ld.org/test-suite/tests/toRdf-0045-in.jsonld#me> <http://xmlns.com/foaf/0.1/knows> <http://example.com/alice#me> .
<http://json-ld.org/test-suite/tests/toRdf-0045-in.jsonld#me> <http://xmlns.com/foaf/0.1/knows> <http://example.com/bob#me> .
Test 0046: alias keywords

RDF version of expand-0006

{
"@context": {
"http://example.org/test#property1": {
"@type": "@id"
},
"http://example.org/test#property2": {
"@type": "@id"
},
"uri": "@id"
},
"http://example.org/test#property1": {
"http://example.org/test#property4": "foo",
"uri": "http://example.org/test#example2"
},
"http://example.org/test#property2": "http://example.org/test#example3",
"http://example.org/test#property3": {
"uri": "http://example.org/test#example4"
},
"uri": "http://example.org/test#example1"
}
<http://example.org/test#example1> <http://example.org/test#property1> <http://example.org/test#example2> .
<http://example.org/test#example1> <http://example.org/test#property2> <http://example.org/test#example3> .
<http://example.org/test#example1> <http://example.org/test#property3> <http://example.org/test#example4> .
<http://example.org/test#example2> <http://example.org/test#property4> "foo" .
Test 0047: date type-coercion

Type-coerced dates generate typed literals

{
"@context": {
"ex": "http://example.org/vocab#",
"ex:date": {
"@type": "xsd:dateTime"
},
"ex:parent": {
"@type": "@id"
},
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "http://example.org/test#example1",
"ex:date": "2011-01-25T00:00:00Z",
"ex:embed": {
"@id": "http://example.org/test#example2",
"ex:parent": "http://example.org/test#example1"
}
}
<http://example.org/test#example1> <http://example.org/vocab#date> "2011-01-25T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://example.org/test#example1> <http://example.org/vocab#embed> <http://example.org/test#example2> .
<http://example.org/test#example2> <http://example.org/vocab#parent> <http://example.org/test#example1> .
Test 0048: @value with @language

RDF version of expand-0008

{
"@context": {
"ex": "http://example.org/vocab#"
},
"@id": "http://example.org/test",
"ex:test": { "@value": "test", "@language": "en" },
"ex:drop-lang-only": { "@language": "en" },
"ex:keep-full-value": { "@value": "only value" }
}
<http://example.org/test> <http://example.org/vocab#keep-full-value> "only value" .
<http://example.org/test> <http://example.org/vocab#test> "test"@en .
Test 0049: @graph with terms

RDF version of expand-0009

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
}
},
"@graph": [
{
"@id": "http://example.org/test#chapter",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#jane",
"authored": "http://example.org/test#chapter",
"name": "Jane"
},
{
"@id": "http://example.org/test#john",
"name": "John"
},
{
"@id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/contributor> "Writer" .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "My Book" .
<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/description> "Fun" .
<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/title> "Chapter One" .
<http://example.org/test#jane> <http://example.org/vocab#authored> <http://example.org/test#chapter> .
<http://example.org/test#jane> <http://xmlns.com/foaf/0.1/name> "Jane" .
<http://example.org/test#john> <http://xmlns.com/foaf/0.1/name> "John" .
<http://example.org/test#library> <http://example.org/vocab#contains> <http://example.org/test#book> .
Test 0050: native types

Native types generate typed literals

{
"@context": {
"d": "http://purl.org/dc/elements/1.1/",
"e": "http://example.org/vocab#",
"f": "http://xmlns.com/foaf/0.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "http://example.org/test",
"e:bool": true,
"e:int": 123
}
<http://example.org/test> <http://example.org/vocab#bool> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.org/test> <http://example.org/vocab#int> "123"^^<http://www.w3.org/2001/XMLSchema#integer> .
Test 0051: coerced @id

RDF version of expand-0011

{
"@context": {
"dc": "http://purl.org/dc/elements/1.1/",
"ex": "http://example.org/vocab#",
"ex:contains": {
"@type": "@id"
},
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@id": "http://example.org/test#book",
"dc:title": "Title",
"ex:contains": "http://example.org/test#chapter"
}
<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "Title" .
Test 0052: @graph with embed

RDF version of expand-0012

{
"@context": {
"dc": "http://purl.org/dc/elements/1.1/",
"ex": "http://example.org/vocab#",
"ex:authored": {
"@type": "@id"
},
"ex:contains": {
"@type": "@id"
},
"foaf": "http://xmlns.com/foaf/0.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@graph": [
{
"@id": "http://example.org/test#chapter",
"dc:description": "Fun",
"dc:title": "Chapter One"
},
{
"@id": "http://example.org/test#jane",
"ex:authored": "http://example.org/test#chapter",
"foaf:name": "Jane"
},
{
"@id": "http://example.org/test#john",
"foaf:name": "John"
},
{
"@id": "http://example.org/test#library",
"ex:contains": {
"@id": "http://example.org/test#book",
"dc:contributor": "Writer",
"dc:title": "My Book",
"ex:contains": "http://example.org/test#chapter"
}
}
]
}
<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/contributor> "Writer" .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "My Book" .
<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/description> "Fun" .
<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/title> "Chapter One" .
<http://example.org/test#jane> <http://example.org/vocab#authored> <http://example.org/test#chapter> .
<http://example.org/test#jane> <http://xmlns.com/foaf/0.1/name> "Jane" .
<http://example.org/test#john> <http://xmlns.com/foaf/0.1/name> "John" .
<http://example.org/test#library> <http://example.org/vocab#contains> <http://example.org/test#book> .
Test 0053: expand already expanded

RDF version of expand-0013

[{
"@id": "http://example.com/id1",
"@type": ["http://example.com/t1"],
"http://example.com/term1": ["v1"],
"http://example.com/term2": [{"@value": "v2", "@type": "http://example.com/t2"}],
"http://example.com/term3": [{"@value": "v3", "@language": "en"}],
"http://example.com/term4": [4],
"http://example.com/term5": [50, 51]
}]
<http://example.com/id1> <http://example.com/term1> "v1" .
<http://example.com/id1> <http://example.com/term2> "v2"^^<http://example.com/t2> .
<http://example.com/id1> <http://example.com/term3> "v3"@en .
<http://example.com/id1> <http://example.com/term4> "4"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://example.com/term5> "50"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://example.com/term5> "51"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/t1> .
Test 0054: @set of @value objects with keyword aliases

RDF version of expand-0014

{
"@context": {
"ex": "http://example.org/test#",
"property1": {
"@id": "http://example.org/test#property1",
"@type": "@id"
},
"property2": {
"@id": "ex:property2",
"@type": "@id"
},
"uri": "@id",
"set": "@set",
"value": "@value",
"type": "@type",
"xsd": { "@id": "http://www.w3.org/2001/XMLSchema#" }
},
"property1": {
"uri": "ex:example2",
"http://example.org/test#property4": "foo"
},
"property2": "http://example.org/test#example3",
"http://example.org/test#property3": {
"uri": "http://example.org/test#example4"
},
"ex:property4": {
"uri": "ex:example4",
"ex:property5": [
{
"set": [
{
"value": "2012-03-31",
"type": "xsd:date"
}
]
}
]
},
"ex:property6": [
{
"set": [
{
"value": null,
"type": "xsd:date"
}
]
}
],
"uri": "http://example.org/test#example1"
}
<http://example.org/test#example1> <http://example.org/test#property1> <http://example.org/test#example2> .
<http://example.org/test#example1> <http://example.org/test#property2> <http://example.org/test#example3> .
<http://example.org/test#example1> <http://example.org/test#property3> <http://example.org/test#example4> .
<http://example.org/test#example1> <http://example.org/test#property4> <http://example.org/test#example4> .
<http://example.org/test#example2> <http://example.org/test#property4> "foo" .
<http://example.org/test#example4> <http://example.org/test#property5> "2012-03-31"^^<http://www.w3.org/2001/XMLSchema#date> .
Test 0055: collapse set of sets, keep empty lists

RDF version of expand-0015

{
"@context": {
"mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
"mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
"myset1": {"@id": "http://example.com/myset1", "@container": "@set" },
"myset2": {"@id": "http://example.com/myset2", "@container": "@set" },
"myset3": {"@id": "http://example.com/myset3", "@container": "@set" }
},
"@id": "http://example.org/id",
"mylist1": [],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
"myset3": [ { "@set": [ "hello", "this" ] }, "will", { "@set": [ "be", "collapsed" ] } ]
}
<http://example.org/id> <http://example.com/mylist1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
<http://example.org/id> <http://example.com/myset3> "be" .
<http://example.org/id> <http://example.com/myset3> "collapsed" .
<http://example.org/id> <http://example.com/myset3> "hello" .
<http://example.org/id> <http://example.com/myset3> "this" .
<http://example.org/id> <http://example.com/myset3> "will" .
Test 0056: context reset

RDF version of expand-0016

{
"@context": {
"myproperty": { "@id": "http://example.com/myproperty" },
"mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
"mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
"myset1": {"@id": "http://example.com/myset1", "@container": "@set" },
"myset2": {"@id": "http://example.com/myset2", "@container": "@set" }
},
"@id": "http://example.org/id1",
"mylist1": [],
"mylist2": [ 2, "hi" ],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
"myproperty": {
"@context": null,
"@id": "http://example.org/id2",
"mylist1": [],
"mylist2": [ 2, "hi" ],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
"http://example.org/myproperty2": "ok"
},
"http://example.com/emptyobj": {
"@context": null,
"mylist1": [],
"mylist2": [ 2, "hi" ],
"myset1": { "@set": [] },
"myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ]
}
}
<http://example.org/id1> <http://example.com/emptyobj> _:b0 .
<http://example.org/id1> <http://example.com/mylist1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
<http://example.org/id1> <http://example.com/mylist2> _:b1 .
<http://example.org/id1> <http://example.com/myproperty> <http://example.org/id2> .
<http://example.org/id2> <http://example.org/myproperty2> "ok" .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "hi" .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
Test 0057: @graph and @id aliased

RDF version of expand-0017

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
},
"id": "@id",
"data": "@graph"
},
"data": [
{
"id": "http://example.org/test#chapter",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#jane",
"authored": "http://example.org/test#chapter",
"name": "Jane"
},
{
"id": "http://example.org/test#john",
"name": "John"
},
{
"id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/contributor> "Writer" .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "My Book" .
<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/description> "Fun" .
<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/title> "Chapter One" .
<http://example.org/test#jane> <http://example.org/vocab#authored> <http://example.org/test#chapter> .
<http://example.org/test#jane> <http://xmlns.com/foaf/0.1/name> "Jane" .
<http://example.org/test#john> <http://xmlns.com/foaf/0.1/name> "John" .
<http://example.org/test#library> <http://example.org/vocab#contains> <http://example.org/test#book> .
Test 0058: override default @language

RDF version of expand-0018

{
"@context": {
"ex": "http://example.org/vocab#",
"@language": "en",
"de": { "@id": "ex:german", "@language": "de" },
"nolang": { "@id": "ex:nolang", "@language": null }
},
"@id": "http://example.org/test",
"ex:test-default": [
"hello",
1,
true
],
"de": [
"hallo",
2,
true
],
"nolang": [
"no language",
3,
false
]
}
<http://example.org/test> <http://example.org/vocab#german> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.org/test> <http://example.org/vocab#german> "hallo"@de .
<http://example.org/test> <http://example.org/vocab#german> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.org/test> <http://example.org/vocab#nolang> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.org/test> <http://example.org/vocab#nolang> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.org/test> <http://example.org/vocab#nolang> "no language" .
<http://example.org/test> <http://example.org/vocab#test-default> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.org/test> <http://example.org/vocab#test-default> "hello"@en .
<http://example.org/test> <http://example.org/vocab#test-default> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
Test 0059: remove @value = null

RDF version of expand-0019

{
"@context": {
"myproperty": "http://example.com/myproperty"
},
"myproperty": { "@value" : null }
}

          
Test 0060: do not remove @graph if not at top-level

Embedded @graph without @id creates BNode-labeled named graph

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
}
},
"@graph": [
{
"@id": "http://example.org/test#jane",
"name": "Jane",
"authored": {
"@graph": [
{
"@id": "http://example.org/test#chapter1",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#chapter2",
"description": "More fun",
"title": "Chapter Two"
}
]
}
},
{
"@id": "http://example.org/test#john",
"name": "John"
},
{
"@id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/contributor> "Writer" .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "My Book" .
<http://example.org/test#chapter1> <http://purl.org/dc/elements/1.1/description> "Fun" _:b0 .
<http://example.org/test#chapter1> <http://purl.org/dc/elements/1.1/title> "Chapter One" _:b0 .
<http://example.org/test#chapter2> <http://purl.org/dc/elements/1.1/description> "More fun" _:b0 .
<http://example.org/test#chapter2> <http://purl.org/dc/elements/1.1/title> "Chapter Two" _:b0 .
<http://example.org/test#jane> <http://example.org/vocab#authored> _:b0 .
<http://example.org/test#jane> <http://xmlns.com/foaf/0.1/name> "Jane" .
<http://example.org/test#john> <http://xmlns.com/foaf/0.1/name> "John" .
<http://example.org/test#library> <http://example.org/vocab#contains> <http://example.org/test#book> .
Test 0061: do not remove @graph at top-level if not only property

RDF version of expand-0021

{
"@context": {
"authored": {
"@id": "http://example.org/vocab#authored",
"@type": "@id"
},
"contains": {
"@id": "http://example.org/vocab#contains",
"@type": "@id"
},
"contributor": "http://purl.org/dc/elements/1.1/contributor",
"description": "http://purl.org/dc/elements/1.1/description",
"name": "http://xmlns.com/foaf/0.1/name",
"title": {
"@id": "http://purl.org/dc/elements/1.1/title"
}
},
"title": "My first graph",
"@graph": [
{
"@id": "http://example.org/test#jane",
"name": "Jane",
"authored": {
"@graph": [
{
"@id": "http://example.org/test#chapter1",
"description": "Fun",
"title": "Chapter One"
},
{
"@id": "http://example.org/test#chapter2",
"description": "More fun",
"title": "Chapter Two"
},
{
"@id": "http://example.org/test#chapter3",
"title": "Chapter Three"
}
]
}
},
{
"@id": "http://example.org/test#john",
"name": "John"
},
{
"@id": "http://example.org/test#library",
"contains": {
"@id": "http://example.org/test#book",
"contains": "http://example.org/test#chapter",
"contributor": "Writer",
"title": "My Book"
}
}
]
}
<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> _:b0 .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/contributor> "Writer" _:b0 .
<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "My Book" _:b0 .
<http://example.org/test#chapter1> <http://purl.org/dc/elements/1.1/description> "Fun" _:b1 .
<http://example.org/test#chapter1> <http://purl.org/dc/elements/1.1/title> "Chapter One" _:b1 .
<http://example.org/test#chapter2> <http://purl.org/dc/elements/1.1/description> "More fun" _:b1 .
<http://example.org/test#chapter2> <http://purl.org/dc/elements/1.1/title> "Chapter Two" _:b1 .
<http://example.org/test#chapter3> <http://purl.org/dc/elements/1.1/title> "Chapter Three" _:b1 .
<http://example.org/test#jane> <http://example.org/vocab#authored> _:b1 _:b0 .
<http://example.org/test#jane> <http://xmlns.com/foaf/0.1/name> "Jane" _:b0 .
<http://example.org/test#john> <http://xmlns.com/foaf/0.1/name> "John" _:b0 .
<http://example.org/test#library> <http://example.org/vocab#contains> <http://example.org/test#book> _:b0 .
_:b0 <http://purl.org/dc/elements/1.1/title> "My first graph" .
Test 0062: expand value with default language

RDF version of expand-0022

{
"@context": {
"term": "http://example.com/term",
"@language": "en"
},
"term": "v"
}
_:b0 <http://example.com/term> "v"@en .
Test 0063: Lists and sets of properties with list/set coercion

RDF version of expand-0023

{
"@context": {
"xsd": "http://www.w3.org/2001/XMLSchema#",
"idlist": {"@id": "http://example.com/idlist", "@container": "@list", "@type": "@id"},
"datelist": {"@id": "http://example.com/datelist", "@container": "@list", "@type": "xsd:date"},
"idset": {"@id": "http://example.com/idset", "@container": "@set", "@type": "@id"},
"dateset": {"@id": "http://example.com/dateset", "@container": "@set", "@type": "xsd:date"},
"idprop": {"@id": "http://example.com/idprop", "@type": "@id" },
"dateprop": {"@id": "http://example.com/dateprop", "@type": "xsd:date" },
"idprop2": {"@id": "http://example.com/idprop2", "@type": "@id" },
"dateprop2": {"@id": "http://example.com/dateprop2", "@type": "xsd:date" }
},
"idlist": ["http://example.org/id"],
"datelist": ["2012-04-12"],
"idprop": {"@list": ["http://example.org/id"]},
"dateprop": {"@list": ["2012-04-12"]},
"idset": ["http://example.org/id"],
"dateset": ["2012-04-12"],
"idprop2": {"@set": ["http://example.org/id"]},
"dateprop2": {"@set": ["2012-04-12"]}
}
_:b0 <http://example.com/datelist> _:b1 .
_:b0 <http://example.com/dateprop2> "2012-04-12"^^<http://www.w3.org/2001/XMLSchema#date> .
_:b0 <http://example.com/dateprop> _:b2 .
_:b0 <http://example.com/dateset> "2012-04-12"^^<http://www.w3.org/2001/XMLSchema#date> .
_:b0 <http://example.com/idlist> _:b3 .
_:b0 <http://example.com/idprop2> <http://example.org/id> .
_:b0 <http://example.com/idprop> _:b4 .
_:b0 <http://example.com/idset> <http://example.org/id> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2012-04-12"^^<http://www.w3.org/2001/XMLSchema#date> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2012-04-12"^^<http://www.w3.org/2001/XMLSchema#date> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/id> .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/id> .
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
Test 0064: Multiple contexts

RDF version of expand-0024

{
"@context": [
{
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {"@id": "http://xmlns.com/foaf/0.1/homepage","@type": "@id"}
},
{"ical": "http://www.w3.org/2002/12/cal/ical#"}
],
"@id": "http://example.com/speakers#Alice",
"name": "Alice",
"homepage": "http://xkcd.com/177/",
"ical:summary": "Alice Talk",
"ical:location": "Lyon Convention Centre, Lyon, France"
}
<http://example.com/speakers#Alice> <http://www.w3.org/2002/12/cal/ical#location> "Lyon Convention Centre, Lyon, France" .
<http://example.com/speakers#Alice> <http://www.w3.org/2002/12/cal/ical#summary> "Alice Talk" .
<http://example.com/speakers#Alice> <http://xmlns.com/foaf/0.1/homepage> <http://xkcd.com/177/> .
<http://example.com/speakers#Alice> <http://xmlns.com/foaf/0.1/name> "Alice" .
Test 0065: Problematic IRI expansion tests

RDF version of expand-0025

{
"@context": {
"foo": "http://example.com/foo/",
"foo:bar": "http://example.com/bar",
"bar": {"@id": "foo:bar", "@type": "@id"},
"_": "http://example.com/underscore/"
},
"@type": [ "foo", "foo:bar", "_" ]
}
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/bar> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/foo/> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/underscore/> .
Test 0066: Expanding term mapping to @type uses @type syntax

RDF version of expand-0026

{
"@context": {
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {"@id": "@type", "@type": "@id"}
},
"@graph": [
{
"@id": "http://example.com/a",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/b"
}, {
"@id": "http://example.com/c",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
"http://example.com/d",
"http://example.com/e"
]
}, {
"@id": "http://example.com/f",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/g"
}
]
}
<http://example.com/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/b> .
<http://example.com/c> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/d> .
<http://example.com/c> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/e> .
<http://example.com/f> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/g> .
Test 0067: Keep duplicate values in @list and @set

RDF version of expand-0027

{
"@context": {
"mylist": {"@id": "http://example.com/mylist", "@container": "@list"},
"myset": {"@id": "http://example.com/myset", "@container": "@set"}
},
"@id": "http://example.org/id",
"mylist": [1, 2, 2, 3],
"myset": [1, 2, 2, 3]
}
<http://example.org/id> <http://example.com/mylist> _:b0 .
<http://example.org/id> <http://example.com/myset> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.org/id> <http://example.com/myset> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.org/id> <http://example.com/myset> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
Test 0068: Use @vocab in properties and @type but not in @id

RDF version of expand-0028

{
"@context": {
"@vocab": "http://example.org/vocab#",
"date": { "@type": "dateTime" }
},
"@id": "example1",
"@type": "test",
"date": "2011-01-25T00:00:00Z",
"embed": {
"@id": "example2",
"expandedDate": { "@value": "2012-08-01T00:00:00Z", "@type": "dateTime" }
}
}
<http://json-ld.org/test-suite/tests/example1> <http://example.org/vocab#date> "2011-01-25T00:00:00Z"^^<http://example.org/vocab#dateTime> .
<http://json-ld.org/test-suite/tests/example1> <http://example.org/vocab#embed> <http://json-ld.org/test-suite/tests/example2> .
<http://json-ld.org/test-suite/tests/example1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#test> .
<http://json-ld.org/test-suite/tests/example2> <http://example.org/vocab#expandedDate> "2012-08-01T00:00:00Z"^^<http://example.org/vocab#dateTime> .
Test 0069: Relative IRIs

RDF version of expand-0029

{
"@context": {
"links": { "@id": "http://www.example.com/link", "@type": "@id", "@container": "@list" }
},
"@id": "relativeIris",
"@type": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../../parent-parent-eq-root",
"../../../../../still-root",
"../.././.././../../too-many-dots",
"/absolute",
"//example.org/scheme-relative"
],
"links": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../../parent-parent-eq-root",
"./../../../useless/../../../still-root",
"../.././.././../../too-many-dots",
"/absolute",
"//example.org/scheme-relative"
]
}
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.example.com/link> _:b0 .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/scheme-relative> .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/absolute> .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/parent-parent-eq-root> .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/still-root> .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/> .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/parent> .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/> .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/link> .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/toRdf-0069-in.jsonld#fragment-works> .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/toRdf-0069-in.jsonld?query=works> .
<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/too-many-dots> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/tests/link> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/tests/toRdf-0069-in.jsonld#fragment-works> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
_:b10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/scheme-relative> .
_:b10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/tests/toRdf-0069-in.jsonld?query=works> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/tests/> .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b4 .
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/> .
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b5 .
_:b5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/parent> .
_:b5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b6 .
_:b6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/parent-parent-eq-root> .
_:b6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b7 .
_:b7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/still-root> .
_:b7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b8 .
_:b8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/too-many-dots> .
_:b8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b9 .
_:b9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/absolute> .
_:b9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b10 .
Test 0070: Language maps

RDF version of expand-0030

{
"@context": {
"vocab": "http://example.com/vocab/",
"label": {
"@id": "vocab:label",
"@container": "@language"
}
},
"@id": "http://example.com/queen",
"label": {
"en": "The Queen",
"de": [ "Die Königin", "Ihre Majestät" ]
}
}
<http://example.com/queen> <http://example.com/vocab/label> "Die Königin"@de .
<http://example.com/queen> <http://example.com/vocab/label> "Ihre Majestät"@de .
<http://example.com/queen> <http://example.com/vocab/label> "The Queen"@en .
Test 0071: type-coercion of native types

RDF version of expand-0031

{
"@context": {
"ex": "http://example.org/vocab#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"ex:integer": { "@type": "xsd:integer" },
"ex:double": { "@type": "xsd:double" },
"ex:boolean": { "@type": "xsd:boolean" }
},
"@id": "http://example.org/test#example1",
"ex:integer": 1,
"ex:double": 123.45,
"ex:boolean": true
}
<http://example.org/test#example1> <http://example.org/vocab#boolean> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.org/test#example1> <http://example.org/vocab#double> "1.2345E2"^^<http://www.w3.org/2001/XMLSchema#double> .
<http://example.org/test#example1> <http://example.org/vocab#integer> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
Test 0072: Mapping a term to null decouples it from @vocab

RDF version of expand-0032

{
"@context": {
"@vocab": "http://xmlns.com/foaf/0.1/",
"from": null,
"university": { "@id": null }
},
"@id": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"from": "Italy",
"university": "TU Graz"
}
<http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
Test 0073: Using @vocab with with type-coercion

RDF version of expand-0033

{
"@context": {
"@vocab": "http://example.com/vocab#",
"homepage": {
"@type": "@id"
},
"created_at": {
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
},
"name": "Markus Lanthaler",
"homepage": "http://www.markus-lanthaler.com/",
"created_at": "2012-10-28"
}
_:b0 <http://example.com/vocab#created_at> "2012-10-28"^^<http://www.w3.org/2001/XMLSchema#date> .
_:b0 <http://example.com/vocab#homepage> <http://www.markus-lanthaler.com/> .
_:b0 <http://example.com/vocab#name> "Markus Lanthaler" .
Test 0074: Multiple properties expanding to the same IRI

RDF version of expand-0034

{
"@context": {
"@vocab": "http://example.com/vocab/",
"colliding": "http://example.com/vocab/collidingTerm"
},
"@id": "http://example.com/IriCollissions",
"colliding": [
"value 1",
2
],
"collidingTerm": [
3,
"four"
],
"http://example.com/vocab/collidingTerm": 5
}
<http://example.com/IriCollissions> <http://example.com/vocab/collidingTerm> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/IriCollissions> <http://example.com/vocab/collidingTerm> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/IriCollissions> <http://example.com/vocab/collidingTerm> "5"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/IriCollissions> <http://example.com/vocab/collidingTerm> "four" .
<http://example.com/IriCollissions> <http://example.com/vocab/collidingTerm> "value 1" .
Test 0075: Language maps with @vocab, default language, and colliding property

RDF version of expand-0035

{
"@context": {
"@vocab": "http://example.com/vocab/",
"@language": "it",
"label": {
"@container": "@language"
}
},
"@id": "http://example.com/queen",
"label": {
"en": "The Queen",
"de": [ "Die Königin", "Ihre Majestät" ]
},
"http://example.com/vocab/label": [
"Il re",
{ "@value": "The king", "@language": "en" }
]
}
<http://example.com/queen> <http://example.com/vocab/label> "Die Königin"@de .
<http://example.com/queen> <http://example.com/vocab/label> "Ihre Majestät"@de .
<http://example.com/queen> <http://example.com/vocab/label> "Il re"@it .
<http://example.com/queen> <http://example.com/vocab/label> "The Queen"@en .
<http://example.com/queen> <http://example.com/vocab/label> "The king"@en .
Test 0076: Expanding @index

RDF version of expand-0036

{
"@context": {
"property": "http://example.com/property",
"indexContainer": { "@id": "http://example.com/container", "@container": "@index" }
},
"@id": "http://example.org/indexTest",
"indexContainer": {
"A": [
{
"@id": "http://example.org/nodeWithoutIndexA"
},
{
"@id": "http://example.org/nodeWithIndexA",
"@index": "this overrides the 'A' index from the container"
},
1,
true,
false,
null,
"simple string A",
{
"@value": "typed literal A",
"@type": "http://example.org/type"
},
{
"@value": "language-tagged string A",
"@language": "en"
}
],
"B": "simple string B",
"C": [
{
"@id": "http://example.org/nodeWithoutIndexC"
},
{
"@id": "http://example.org/nodeWithIndexC",
"@index": "this overrides the 'C' index from the container"
},
3,
true,
false,
null,
"simple string C",
{
"@value": "typed literal C",
"@type": "http://example.org/type"
},
{
"@value": "language-tagged string C",
"@language": "en"
}
]
},
"property": [
{
"@id": "http://example.org/nodeWithoutIndexProp"
},
{
"@id": "http://example.org/nodeWithIndexProp",
"@index": "prop"
},
{
"@value": 3,
"@index": "prop"
},
{
"@value": true,
"@index": "prop"
},
{
"@value": false,
"@index": "prop"
},
{
"@value": null,
"@index": "prop"
},
"simple string no index",
{
"@value": "typed literal Prop",
"@type": "http://example.org/type",
"@index": "prop"
},
{
"@value": "language-tagged string Prop",
"@language": "en",
"@index": "prop"
}
]
}
<http://example.org/indexTest> <http://example.com/container> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.org/indexTest> <http://example.com/container> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.org/indexTest> <http://example.com/container> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.org/indexTest> <http://example.com/container> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.org/indexTest> <http://example.com/container> "language-tagged string A"@en .
<http://example.org/indexTest> <http://example.com/container> "language-tagged string C"@en .
<http://example.org/indexTest> <http://example.com/container> "simple string A" .
<http://example.org/indexTest> <http://example.com/container> "simple string B" .
<http://example.org/indexTest> <http://example.com/container> "simple string C" .
<http://example.org/indexTest> <http://example.com/container> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.org/indexTest> <http://example.com/container> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.org/indexTest> <http://example.com/container> "typed literal A"^^<http://example.org/type> .
<http://example.org/indexTest> <http://example.com/container> "typed literal C"^^<http://example.org/type> .
<http://example.org/indexTest> <http://example.com/container> <http://example.org/nodeWithIndexA> .
<http://example.org/indexTest> <http://example.com/container> <http://example.org/nodeWithIndexC> .
<http://example.org/indexTest> <http://example.com/container> <http://example.org/nodeWithoutIndexA> .
<http://example.org/indexTest> <http://example.com/container> <http://example.org/nodeWithoutIndexC> .
<http://example.org/indexTest> <http://example.com/property> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.org/indexTest> <http://example.com/property> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.org/indexTest> <http://example.com/property> "language-tagged string Prop"@en .
<http://example.org/indexTest> <http://example.com/property> "simple string no index" .
<http://example.org/indexTest> <http://example.com/property> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.org/indexTest> <http://example.com/property> "typed literal Prop"^^<http://example.org/type> .
<http://example.org/indexTest> <http://example.com/property> <http://example.org/nodeWithIndexProp> .
<http://example.org/indexTest> <http://example.com/property> <http://example.org/nodeWithoutIndexProp> .
Test 0077: Expanding @reverse

RDF version of expand-0037

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"http://xmlns.com/foaf/0.1/knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
}
}
}
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
Test 0078: Drop blank node predicates by default

Triples with blank node predicates are dropped by default.

{
"@context": {
"term": "_:term",
"termId": { "@id": "term", "@type": "@id" }
},
"@id": "_:term",
"@type": "_:term",
"term": [
{
"@id": "_:term",
"@type": "term"
},
{
"@id": "_:Bx",
"term": "term"
},
"plain value",
{
"@id": "_:term"
}
],
"termId": [
{
"@id": "_:term",
"@type": "term"
},
{
"@id": "_:Cx",
"term": "termId"
},
"term:AppendedToBlankNode",
"_:termAppendedToBlankNode",
"relativeIri",
{
"@id": "_:term"
}
]
}
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:b0 .
Test 0079: Using terms in a reverse-maps

RDF version of expand-0039

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
}
}
}
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
Test 0080: language and index expansion on non-objects

RDF version of expand-0040

{
"@context": {
"vocab": "http://example.com/vocab/",
"label": {
"@id": "vocab:label",
"@container": "@language"
},
"indexes": {
"@id": "vocab:index",
"@container": "@index"
}
},
"@id": "http://example.com/queen",
"label": [
"The Queen"
],
"indexes":
[
"No",
"indexes",
{ "@id": "asTheValueIsntAnObject" }
]
}
<http://example.com/queen> <http://example.com/vocab/index> "No" .
<http://example.com/queen> <http://example.com/vocab/index> "indexes" .
<http://example.com/queen> <http://example.com/vocab/index> <http://json-ld.org/test-suite/tests/asTheValueIsntAnObject> .
<http://example.com/queen> <http://example.com/vocab/label> "The Queen" .
Test 0081: Reset the default language

RDF version of expand-0041

{
"@context": {
"property": "http://example.com/property",
"nested": "http://example.com/nested",
"@language": "en"
},
"property": "this is English",
"nested": {
"@context": {
"@language": null
},
"property": "and this is a plain string"
}
}
_:b0 <http://example.com/nested> _:b1 .
_:b0 <http://example.com/property> "this is English"@en .
_:b1 <http://example.com/property> "and this is a plain string" .
Test 0082: Expanding reverse properties

RDF version of expand-0042

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
}
}
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
Test 0083: Using reverse properties inside a @reverse-container

RDF version of expand-0043

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"isKnownBy": [
{
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
{
"@id": "http://example.com/people/gregg",
"name": "Gregg Kellogg"
}
]
}
}
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
<http://example.com/people/gregg> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/dave> .
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/gregg> .
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
Test 0084: Ensure index maps use language mapping

RDF version of expand-0044

{
"@context": {
"property": { "@id": "http://example.com/vocab/property", "@language": "de" },
"indexMap": { "@id": "http://example.com/vocab/indexMap", "@language": "en", "@container": "@index" }
},
"@id": "http://example.com/node",
"property": [
{
"@id": "http://example.com/propertyValueNode",
"indexMap": {
"expands to english string": "simple string"
}
},
"einfacher String"
]
}
<http://example.com/node> <http://example.com/vocab/property> "einfacher String"@de .
<http://example.com/node> <http://example.com/vocab/property> <http://example.com/propertyValueNode> .
<http://example.com/propertyValueNode> <http://example.com/vocab/indexMap> "simple string"@en .
Test 0085: Top-level value objects are removed

RDF version of expand-0045

{
"@value": "free-floating value"
}

          
Test 0086: Free-floating nodes are removed

RDF version of expand-0046

{
"@graph": [
{ "@id": "http://example.com/free-floating-node" },
{ "@value": "free-floating value object" },
{ "@value": "free-floating value language-tagged string", "@language": "en" },
{ "@value": "free-floating value typed value", "@type": "http://example.com/type" },
"free-floating plain string",
true,
false,
null,
1,
1.5
]
}

          
Test 0087: Remove free-floating set values and lists

RDF version of expand-0047

{
"@context": {
"property": "http://example.com/property"
},
"@graph": [
{
"@set": [
"free-floating strings in set objects are removed",
{
"@id": "http://example.com/free-floating-node"
},
{
"@id": "http://example.com/node",
"property": "nodes with properties are not removed"
}
]
},
{
"@list": [
"lists are removed even though they represent an invisible linked structure, they have no real meaning",
{
"@id": "http://example.com/node-in-free-floating-list",
"property": "everything inside a free-floating list is removed with the list; also nodes with properties"
}
]
}
]
}
<http://example.com/node> <http://example.com/property> "nodes with properties are not removed" .
Test 0088: Terms are ignored in @id

RDF version of expand-0048

{
"@context": {
"term": "http://example.com/terms-are-not-considered-in-id",
"compact-iris": "http://example.com/compact-iris-",
"property": "http://example.com/property",
"@vocab": "http://example.org/vocab-is-not-considered-for-id"
},
"@id": "term",
"property": [
{
"@id": "compact-iris:are-considered",
"property": "@id supports the following values: relative, absolute, and compact IRIs"
},
{
"@id": "../parent-node",
"property": "relative IRIs get resolved against the document's base IRI"
}
]
}
<http://example.com/compact-iris-are-considered> <http://example.com/property> "@id supports the following values: relative, absolute, and compact IRIs" .
<http://json-ld.org/test-suite/parent-node> <http://example.com/property> "relative IRIs get resolved against the document's base IRI" .
<http://json-ld.org/test-suite/tests/term> <http://example.com/property> <http://example.com/compact-iris-are-considered> .
<http://json-ld.org/test-suite/tests/term> <http://example.com/property> <http://json-ld.org/test-suite/parent-node> .
Test 0089: Using strings as value of a reverse property

RDF version of expand-0049

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@type": "@id" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": [
"http://example.com/people/dave",
"http://example.com/people/gregg"
]
}
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
<http://example.com/people/gregg> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
Test 0090: Term definitions with prefix separate from prefix definitions

RDF version of expand-0050

{
"@context": {
"issue": { "@id": "http://example.com/issue/", "@type": "@id" },
"issue:raisedBy": { "@container": "@set" }
},
"issue": "/issue/1",
"issue:raisedBy": "Markus"
}
_:b0 <http://example.com/issue/> <http://json-ld.org/issue/1> .
_:b0 <http://example.com/issue/raisedBy> "Markus" .
Test 0091: Expansion of keyword aliases in term definitions

RDF version of expand-0051

{
"@context": [
{ "id": "@id" },
{ "url": "id" }
],
"url": "/issue/1",
"http://example.com/property": "ok"
}
<http://json-ld.org/issue/1> <http://example.com/property> "ok" .
Test 0092: @vocab-relative IRIs in term definitions

RDF version of expand-0052

{
"@context": {
"@vocab": "http://example.org/",
"property": "vocabRelativeProperty"
},
"property": "must expand to http://example.org/vocabRelativeProperty",
"http://example.org/property": "ok"
}
_:b0 <http://example.org/property> "ok" .
_:b0 <http://example.org/vocabRelativeProperty> "must expand to http://example.org/vocabRelativeProperty" .
Test 0093: Expand absolute IRI with @type: @vocab

RDF version of expand-0053

{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"}
},
"term": "http://example.org/enum"
}
_:b0 <http://example.org/term> <http://example.org/enum> .
Test 0094: Expand term with @type: @vocab

RDF version of expand-0054

{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"},
"enum": {"@id": "http://example.org/enum"}
},
"term": "enum"
}
_:b0 <http://example.org/term> <http://example.org/enum> .
Test 0095: Expand @vocab-relative term with @type: @vocab

RDF version of expand-0055

{
"@context": {
"@vocab": "http://example.org/",
"term": {"@id": "http://example.org/term", "@type": "@vocab"}
},
"term": "enum"
}
_:b0 <http://example.org/term> <http://example.org/enum> .
Test 0096: Use terms with @type: @vocab but not with @type: @id

RDF version of expand-0056

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": { "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@vocab" },
"link": { "@id": "http://example.com/link", "@type": "@id" },
"MarkusHomepage": "http://www.markus-lanthaler.com/",
"relative-iri": "http://example.com/error-if-this-is-used-for-link"
},
"@id": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"homepage": "MarkusHomepage",
"link": "relative-iri"
}
<http://me.markus-lanthaler.com/> <http://example.com/link> <http://json-ld.org/test-suite/tests/relative-iri> .
<http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/homepage> <http://www.markus-lanthaler.com/> .
<http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
Test 0097: Expand relative IRI with @type: @vocab

RDF version of expand-0057

{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" }
},
"term": "not-a-term-thus-a-relative-IRI"
}
_:b0 <http://example.org/term> <http://json-ld.org/test-suite/tests/not-a-term-thus-a-relative-IRI> .
Test 0098: Expand compact IRI with @type: @vocab

RDF version of expand-0058

{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" },
"prefix": "http://example.com/vocab#"
},
"term": "prefix:suffix"
}
_:b0 <http://example.org/term> <http://example.com/vocab#suffix> .
Test 0099: Reset @vocab by setting it to null

RDF version of expand-0059

{
"@context": {
"@vocab": "http://example.org/vocab#"
},
"@id": "example-with-vocab",
"@type": "vocab-prefixed",
"property": "property expanded using @vocab",
"embed": {
"@context": {
"@vocab": null
},
"@id": "example-vocab-reset",
"@type": "document-relative",
"property": "@vocab reset, property will be dropped"
}
}
<http://json-ld.org/test-suite/tests/example-vocab-reset> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/document-relative> .
<http://json-ld.org/test-suite/tests/example-with-vocab> <http://example.org/vocab#embed> <http://json-ld.org/test-suite/tests/example-vocab-reset> .
<http://json-ld.org/test-suite/tests/example-with-vocab> <http://example.org/vocab#property> "property expanded using @vocab" .
<http://json-ld.org/test-suite/tests/example-with-vocab> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#vocab-prefixed> .
Test 0100: Overwrite document base with @base and reset it again

RDF version of expand-0060

{
"@context": {
"property": "http://example.com/vocab#property"
},
"@id": "../document-relative",
"@type": "#document-relative",
"property": {
"@context": {
"@base": "http://example.org/test/"
},
"@id": "../document-base-overwritten",
"@type": "#document-base-overwritten",
"property": [
{
"@context": null,
"@id": "../document-relative",
"@type": "#document-relative",
"property": "context completely reset, drops property"
},
{
"@context": {
"@base": null
},
"@id": "../document-relative",
"@type": "#document-relative",
"property": "@base is set to none"
}
]
}
}
<http://example.org/document-base-overwritten> <http://example.com/vocab#property> <http://json-ld.org/test-suite/document-relative> .
<http://example.org/document-base-overwritten> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/test/#document-base-overwritten> .
<http://json-ld.org/test-suite/document-relative> <http://example.com/vocab#property> <http://example.org/document-base-overwritten> .
<http://json-ld.org/test-suite/document-relative> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/toRdf-0100-in.jsonld#document-relative> .
Test 0101: Coercing native types to arbitrary datatypes

RDF version of expand-0061

{
"@context": {
"property": {
"@id": "http://example.com/property",
"@type": "http://example.com/datatype"
}
},
"property": [ 1, true, false, 5.1 ]
}
_:b0 <http://example.com/property> "1"^^<http://example.com/datatype> .
_:b0 <http://example.com/property> "5.1E0"^^<http://example.com/datatype> .
_:b0 <http://example.com/property> "false"^^<http://example.com/datatype> .
_:b0 <http://example.com/property> "true"^^<http://example.com/datatype> .
Test 0102: Various relative IRIs with with @base

RDF version of expand-0062

{
"@context": {
"@base": "http://example.com/some/deep/directory/and/file#with-a-fragment",
"links": { "@id": "http://www.example.com/link", "@type": "@id", "@container": "@list" }
},
"@id": "relativeIris",
"@type": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../../parent-parent-eq-root",
"../../../../../still-root",
"../.././.././../../too-many-dots",
"/absolute",
"//example.org/scheme-relative"
],
"links": [
"link",
"#fragment-works",
"?query=works",
"./",
"../",
"../parent",
"../../parent-parent-eq-root",
"./../../../../../still-root",
"../.././.././../../too-many-dots",
"/absolute",
"//example.org/scheme-relative",
"//example.org/../scheme-relative",
"//example.org/.././useless/../../scheme-relative"
]
}
<http://example.com/some/deep/directory/and/relativeIris> <http://www.example.com/link> _:b0 .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/absolute> .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/> .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/and/> .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/and/file#fragment-works> .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/and/file?query=works> .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/and/link> .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/parent> .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/parent-parent-eq-root> .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/still-root> .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/too-many-dots> .
<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/scheme-relative> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/and/link> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/and/file#fragment-works> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
_:b10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/scheme-relative> .
_:b10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b11 .
_:b11 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/scheme-relative> .
_:b11 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b12 .
_:b12 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/scheme-relative> .
_:b12 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/and/file?query=works> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/and/> .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b4 .
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/> .
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b5 .
_:b5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/parent> .
_:b5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b6 .
_:b6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/parent-parent-eq-root> .
_:b6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b7 .
_:b7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/still-root> .
_:b7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b8 .
_:b8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/too-many-dots> .
_:b8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b9 .
_:b9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/absolute> .
_:b9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b10 .
Test 0103: Expand a reverse property with an index-container

RDF version of expand-0063

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@container": "@index" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": {
"Dave": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
"Gregg": {
"@id": "http://example.com/people/gregg",
"name": "Gregg Kellogg"
}
}
}
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
<http://example.com/people/gregg> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
<http://example.com/people/gregg> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
Test 0104: Expand reverse property whose values are unlabeled blank nodes

RDF version of expand-0064

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"isKnownBy": [
{
"name": "Dave Longley"
},
{
"name": "Gregg Kellogg"
}
]
}
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
_:b0 <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
_:b0 <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
_:b1 <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
_:b1 <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
Test 0105: Keys that are not mapped to an IRI in a reverse-map are dropped

RDF version of expand-0065

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
"relative-iri": {
"@id": "relative-node",
"name": "Keys that are not mapped to an IRI in a reverse-map are dropped"
}
}
}
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
Test 0106: Use @vocab to expand keys in reverse-maps

RDF version of expand-0066

{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows",
"@vocab": "http://example.com/vocab/"
},
"@id": "http://example.com/people/markus",
"name": "Markus Lanthaler",
"@reverse": {
"knows": {
"@id": "http://example.com/people/dave",
"name": "Dave Longley"
},
"noTerm": {
"@id": "relative-node",
"name": "Compact keys using @vocab"
}
}
}
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
<http://json-ld.org/test-suite/tests/relative-node> <http://example.com/vocab/noTerm> <http://example.com/people/markus> .
<http://json-ld.org/test-suite/tests/relative-node> <http://xmlns.com/foaf/0.1/name> "Compact keys using @vocab" .
Test 0107: prefix:://sufffix not a compact IRI

RDF version of expand-0067

{
"@context": {
"http": "http://example.com/this-prefix-would-overwrite-all-http-iris"
},
"@id": "http://example.org/node1",
"@type": "http://example.org/type",
"http://example.org/property": "all these IRIs remain unchanged because they are interpreted as absolute IRIs"
}
<http://example.org/node1> <http://example.org/property> "all these IRIs remain unchanged because they are interpreted as absolute IRIs" .
<http://example.org/node1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/type> .
Test 0108: _::sufffix not a compact IRI

RDF version of expand-0068

{
"@context": {
"_": "http://example.com/this-prefix-would-overwrite-all-blank-node-identifiers"
},
"@id": "_:node1",
"@type": "_:type",
"_:property": "all these IRIs remain unchanged because they are interpreted as blank node identifiers"
}
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:b0 .
Test 0109: Compact IRI as term with type mapping

RDF version of expand-0069

{
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"rdfs:subClassOf": { "@id": "rdfs:subClassOf", "@type": "@id" }
},
"@id": "http://example.com/vocab#class",
"@type": "rdfs:Class",
"rdfs:subClassOf": "http://example.com/vocab#someOtherClass"
}
<http://example.com/vocab#class> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
<http://example.com/vocab#class> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.com/vocab#someOtherClass> .
Test 0110: Redefine compact IRI with itself

RDF version of expand-0070

{
"@context": {
"prefix": "http://www.example.org/vocab#",
"prefix:foo": "prefix:foo"
},
"@id": "http://example.com/vocab#id",
"@type": "prefix:Class",
"prefix:foo": "bar"
}
<http://example.com/vocab#id> <http://www.example.org/vocab#foo> "bar" .
<http://example.com/vocab#id> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/vocab#Class> .
Test 0111: Redefine terms looking like compact IRIs

RDF version of expand-0071

{
"@context": [
{
"v": "http://example.com/vocab#",
"v:term": "v:somethingElse",
"v:termId": { "@id": "v:somethingElseId" }
},
{
"v:term": "v:term",
"v:termId": { "@id": "v:termId" }
}
],
"v:term": "value of v:term",
"v:termId": "value of v:termId"
}
_:b0 <http://example.com/vocab#term> "value of v:term" .
_:b0 <http://example.com/vocab#termId> "value of v:termId" .
Test 0112: Redefine term using @vocab, not itself

RDF version of expand-0072

{
"@context": [
{
"v": "http://example.com/vocab#",
"term": "v:somethingElse"
},
{
"@vocab": "http://example.com/anotherVocab#",
"term": "term"
}
],
"term": "value of term"
}
_:b0 <http://example.com/anotherVocab#term> "value of term" .
Test 0113: Dataset with a IRI named graph

Basic use of creating a named graph using an IRI name

{
"@id": "http://example/g",
"@graph": {
"@id": "http://example/s",
"http://example/p": {"@id": "http://example/o"}
}
}
<http://example/s> <http://example/p> <http://example/o> <http://example/g> .
Test 0114: Dataset with a IRI named graph

Basic use of creating a named graph using a BNode name

{
"@id": "_:g",
"@graph": {
"@id": "http://example/s",
"http://example/p": {"@id": "http://example/o"}
}
}
<http://example/s> <http://example/p> <http://example/o> _:b0 .
Test 0115: Dataset with a default and two named graphs

Dataset with a default and two named graphs (IRI and BNode)

{
"@graph": [{
"@id": "http://example/s0",
"http://example/p0": {"@id": "http://example/o0"}
},
{
"@id": "http://example/g",
"@graph": {
"@id": "http://example/s1",
"http://example/p1": {"@id": "http://example/o1"}
}
},
{
"@id": "_:g",
"@graph": {
"@id": "http://example/s2",
"http://example/p2": {"@id": "http://example/o2"}
}
}]
}
<http://example/s0> <http://example/p0> <http://example/o0> .
<http://example/s1> <http://example/p1> <http://example/o1> <http://example/g> .
<http://example/s2> <http://example/p2> <http://example/o2> _:b0 .
Test 0116: Dataset from node with embedded named graph

Embedding @graph in a node creates a named graph

{
"@id": "http://example/s0",
"http://example/p0": {"@id": "http://example/o0"},
"@graph": {
"@id": "http://example/s1",
"http://example/p1": {"@id": "http://example/o1"}
}
}
<http://example/s0> <http://example/p0> <http://example/o0> .
<http://example/s1> <http://example/p1> <http://example/o1> <http://example/s0> .
Test 0117: Dataset from node with embedded named graph (bnode)

Embedding @graph in a node creates a named graph. Graph name is created if there is no subject

{
"http://example/p0": {"@id": "http://example/o0"},
"@graph": {
"@id": "http://example/s1",
"http://example/p1": {"@id": "http://example/o1"}
}
}
<http://example/s1> <http://example/p1> <http://example/o1> _:b0 .
_:b0 <http://example/p0> <http://example/o0> .
Test 0118: produce generalized RDF flag

Triples with blank node predicates are not dropped if the produce generalized RDF flag is true.

{
"@context": {
"term": "_:term",
"termId": { "@id": "term", "@type": "@id" }
},
"@id": "_:term",
"@type": "_:term",
"term": [
{
"@id": "_:term",
"@type": "term"
},
{
"@id": "_:Bx",
"term": "term"
},
"plain value",
{
"@id": "_:term"
}
],
"termId": [
{
"@id": "_:term",
"@type": "term"
},
{
"@id": "_:Cx",
"term": "termId"
},
"term:AppendedToBlankNode",
"_:termAppendedToBlankNode",
"relativeIri",
{
"@id": "_:term"
}
]
}
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:b0 .
_:b0 _:b0 "plain value" .
_:b0 _:b0 <http://json-ld.org/test-suite/tests/relativeIri> .
_:b0 _:b0 _:b0 .
_:b0 _:b0 _:b1 .
_:b0 _:b0 _:b2 .
_:b0 _:b0 _:b3 .
_:b1 _:b0 "term" .
_:b2 _:b0 "termId" .
Test 0119: Blank nodes with reverse properties

Proper (re-)labeling of blank nodes if used with reverse properties.

{
"@context": {
"foo": "http://example.org/foo",
"bar": { "@reverse": "http://example.org/bar", "@type": "@id" }
},
"foo": "Foo",
"bar": [ "http://example.org/origin", "_:b0" ]
}
<http://example.org/origin> <http://example.org/bar> _:b0 .
_:b0 <http://example.org/foo> "Foo" .
_:b1 <http://example.org/bar> _:b0 .
Test 0001: Object Lists

Tests generation using different types of objects.

<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
<http://example.com/Subj1> <http://example.com/prop1> <http://example.com/Obj1> .
<http://example.com/Subj1> <http://example.com/prop2> "Plain" .
<http://example.com/Subj1> <http://example.com/prop2> "2012-05-12"^^<http://www.w3.org/2001/XMLSchema#date> .
<http://example.com/Subj1> <http://example.com/prop2> "English"@en .
[
{
"@id": "http://example.com/Subj1",
"@type": ["http://example.com/Type"],
"http://example.com/prop1": [{"@id": "http://example.com/Obj1"}],
"http://example.com/prop2": [
{"@value": "Plain"},
{"@value": "2012-05-12", "@type": "http://www.w3.org/2001/XMLSchema#date"},
{"@value": "English", "@language": "en"}
]
}
]
Test 0002: Native Types

Do not use native datatypes for xsd:boolean, xsd:integer, and xsd:double by default.

<http://example.com/Subj1> <http://example.com/prop> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.com/Subj1> <http://example.com/prop> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.com/Subj1> <http://example.com/prop> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Subj1> <http://example.com/prop> "1.1"^^<http://www.w3.org/2001/XMLSchema#decimal> .
<http://example.com/Subj1> <http://example.com/prop> "1.1E-1"^^<http://www.w3.org/2001/XMLSchema#double> .
[
{
"@id": "http://example.com/Subj1",
"http://example.com/prop": [
{
"@value": "true",
"@type": "http://www.w3.org/2001/XMLSchema#boolean"
},
{
"@value": "false",
"@type": "http://www.w3.org/2001/XMLSchema#boolean"
},
{
"@value": "1",
"@type": "http://www.w3.org/2001/XMLSchema#integer"
},
{
"@value": "1.1",
"@type": "http://www.w3.org/2001/XMLSchema#decimal"
},
{
"@value": "1.1E-1",
"@type": "http://www.w3.org/2001/XMLSchema#double"
}
]
}
]
Test 0003: BNodes and references

BNode name generation and references between resources.

<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/SubType> .
<http://example.com/Subj1> <http://example.com/ref> _:a .
<http://example.com/Subj1> <http://example.com/ref> <http://example.com/Subj2> .
<http://example.com/Subj2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
<http://example.com/Subj2> <http://example.com/ref> <http://example.com/Subj1> .
[
{
"@id": "_:a",
"@type": ["http://example.com/SubType"]
},
{
"@id": "http://example.com/Subj1",
"@type": ["http://example.com/Type"],
"http://example.com/ref": [
{"@id": "_:a"},
{"@id": "http://example.com/Subj2"}
]
},
{
"@id": "http://example.com/Subj2",
"@type": ["http://example.com/Type"],
"http://example.com/ref": [{"@id": "http://example.com/Subj1"}]
}
]
Test 0004: Lists

Multiple lists with different types of element.

<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "apple" .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "bananna" .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
<http://example.com/Subj1> <http://example.com/literalList> _:a .
<http://example.com/Subj1> <http://example.com/emptyList> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/iri> .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
<http://example.com/Subj1> <http://example.com/iriList> _:c .
[
{
"@id": "http://example.com/Subj1",
"@type": ["http://example.com/Type"],
"http://example.com/literalList": [{
"@list": [
{"@value": "apple"},
{"@value": "bananna"}
]
}],
"http://example.com/emptyList": [{
"@list": []
}],
"http://example.com/iriList": [{
"@list": [{"@id": "http://example.com/iri"}]
}]
}
]
Test 0005: Document with list

Uses a named graph containing a list.

<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> <http://example.com/U> .
<http://example.com/Subj1> <http://example.com/ref> <http://example.com/U> <http://example.com/U> .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" <http://example.com/U> .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b <http://example.com/U> .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" <http://example.com/U> .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.com/U> .
<http://example.com/Subj1> <http://example.com/list> _:a <http://example.com/U> .
<http://example.com/U> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Graph> .
<http://example.com/U> <http://example.com/name> "Graph" .
[
{
"@id": "http://example.com/U",
"@graph": [
{
"@id": "http://example.com/Subj1",
"@type": ["http://example.com/Type"],
"http://example.com/ref": [{"@id": "http://example.com/U"}],
"http://example.com/list": [{
"@list": [
{"@value": "a"},
{"@value": "b"}
]
}]
}
],
"@type": ["http://example.com/Graph"],
"http://example.com/name": [{"@value": "Graph"}]
}
]
Test 0006: Two graphs having same subject but different values

Ensure that properties and list elements aren't confused between graphs.

<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> <http://example.com/U> .
<http://example.com/Subj1> <http://example.com/ref> <http://example.com/U> <http://example.com/U> .
<http://example.com/Subj1> <http://example.com/list> _:a <http://example.com/U> .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" <http://example.com/U> .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b <http://example.com/U> .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" <http://example.com/U> .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.com/U> .
<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type2> <http://example.com/V> .
<http://example.com/Subj1> <http://example.com/ref> <http://example.com/V> <http://example.com/V> .
<http://example.com/Subj1> <http://example.com/list> _:c <http://example.com/V> .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" <http://example.com/V> .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:d <http://example.com/V> .
_:d <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "d" <http://example.com/V> .
_:d <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.com/V> .
[
{
"@id": "http://example.com/U",
"@graph": [
{
"@id": "http://example.com/Subj1",
"@type": ["http://example.com/Type"],
"http://example.com/ref": [{"@id": "http://example.com/U"}],
"http://example.com/list": [{
"@list": [
{"@value": "a"},
{"@value": "b"}
]
}]
}
]
},
{
"@id": "http://example.com/V",
"@graph": [
{
"@id": "http://example.com/Subj1",
"@type": ["http://example.com/Type2"],
"http://example.com/ref": [{"@id": "http://example.com/V"}],
"http://example.com/list": [{
"@list": [
{"@value": "c"},
{"@value": "d"}
]
}]
}
]
}
]
Test 0007: Graph with multiple named graphs

Testing @graph recursion.

<http://data.wikipedia.org/snaks/Assertions> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.wikipedia.org/vocab#SnakSet> .
<http://data.wikipedia.org/snaks/Assertions> <http://data.wikipedia.org/vocab#assertedBy> "http://gregkellogg.net/foaf#me" .
<http://data.wikipedia.org/snaks/BerlinFact> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.wikipedia.org/vocab#Snak> <http://data.wikipedia.org/snaks/Assertions> .
<http://data.wikipedia.org/snaks/BerlinFact> <http://data.wikipedia.org/vocab#assertedBy> "http://www.statistik-berlin-brandenburg.de/" <http://data.wikipedia.org/snaks/Assertions> .
<http://en.wikipedia.org/wiki/Berlin> <http://data.wikipedia.org/vocab#population> "3499879"^^<http://www.w3.org/2001/XMLSchema#integer> <http://data.wikipedia.org/snaks/BerlinFact> .
[
{
"@id": "http://data.wikipedia.org/snaks/Assertions",
"@type": ["http://data.wikipedia.org/vocab#SnakSet"],
"http://data.wikipedia.org/vocab#assertedBy": [{"@value": "http://gregkellogg.net/foaf#me"}
],
"@graph": [
{
"@id": "http://data.wikipedia.org/snaks/BerlinFact",
"@type": ["http://data.wikipedia.org/vocab#Snak"],
"http://data.wikipedia.org/vocab#assertedBy": [{"@value": "http://www.statistik-berlin-brandenburg.de/"}]
}
]
},
{
"@id": "http://data.wikipedia.org/snaks/BerlinFact",
"@graph": [
{
"@id": "http://en.wikipedia.org/wiki/Berlin",
"http://data.wikipedia.org/vocab#population": [{
"@value": "3499879",
"@type": "http://www.w3.org/2001/XMLSchema#integer"
}]
}
]
}
]
Test 0008: List conversion

Conversion of lists of lists (the triples in the input are only partially ordered on purpose

<http://example.com> <http://example.com/property> _:outerlist .
_:outerlist <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:lista .
_:outerlist <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b0 .

_:lista <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a1" .
_:lista <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:a2 .
_:a2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a2" .
_:a2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:a3 .
_:a3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a3" .
_:a3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .

_:c0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:c1 .
_:c0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c1" .
_:c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c2 .
_:c2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c2" .
_:c2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c3 .
_:c3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c3" .
_:c3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .

_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:b1 .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c0 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b1" .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b2" .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b3" .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
[
{
"@id": "_:b1",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b1" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
{
"@list": [
{ "@value": "b2" },
{ "@value": "b3" }
]
}
]
},
{
"@id": "_:c1",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "c1" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
{
"@list": [
{ "@value": "c2" },
{ "@value": "c3" }
]
}
]
},
{
"@id": "_:lista",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a1" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
{
"@list": [
{ "@value": "a2" },
{ "@value": "a3" }
]
}
]
},
{
"@id": "http://example.com",
"http://example.com/property": [
{
"@list": [
{ "@id": "_:lista" },
{ "@id": "_:b1" },
{ "@id": "_:c1" }
]
}
]
}
]
Test 0009: List conversion with IRI nodes

Preserve IRI list nodes (i.e., not blank nodes) when converting to @list

<http://example.com> <http://example.com/property> <http://example.com/list> .
<http://example.com/list> <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
<http://example.com/list> <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
[
{
"@id": "http://example.com",
"http://example.com/property": [ { "@id": "http://example.com/list" } ]
},
{
"@id": "http://example.com/list",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
{
"@list": [
{ "@value": "b" },
{ "@value": "c" }
]
}
]
}
]
Test 0010: List pattern without rdf:nil

Do not convert lists that are not terminated by rdf:nil to @list.

<http://example.com> <http://example.com/property> _:a .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
[
{
"@id": "_:a",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:b" } ]
},
{
"@id": "_:b",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:c" } ]
},
{
"@id": "_:c",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "c" } ]
},
{
"@id": "http://example.com",
"http://example.com/property": [ { "@id": "_:a" } ]
}
]
Test 0011: List pattern with extra properties

If additional properties are associated to a list node, the list is only partially converted to @list.

<http://example.com> <http://example.com/property> _:a .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
_:b <http://example.com/other-property> "This list node has also properties other than rdf:first and rdf:rest" .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
[
{
"@id": "_:a",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:b" } ]
},
{
"@id": "_:b",
"http://example.com/other-property": [
{ "@value": "This list node has also properties other than rdf:first and rdf:rest" }
],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
{
"@list": [
{ "@value": "c" }
]
}
]
},
{
"@id": "http://example.com",
"http://example.com/property": [ { "@id": "_:a" } ]
}
]
Test 0012: List pattern with cycles

Detect lists containing cycles and do not convert them to @list.

<http://example.com> <http://example.com/property> _:a .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
[
{
"@id": "_:a",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:b" } ]
},
{
"@id": "_:b",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:c" } ]
},
{
"@id": "_:c",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "c" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:b" } ]
},
{
"@id": "http://example.com",
"http://example.com/property": [ { "@id": "_:a" } ]
}
]
Test 0013: List pattern with multiple values of rdf:first

Do not convert list nodes to @list if nodes contain more than one value for rdf:first.

<http://example.com> <http://example.com/property> _:a .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b1" .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b2" .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
[
{
"@id": "_:a",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:b" } ]
},
{
"@id": "_:b",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [
{ "@value": "b1" },
{ "@value": "b2" }
],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
{
"@list": [
{
"@value": "c"
}
]
}
]
},
{
"@id": "http://example.com",
"http://example.com/property": [ { "@id": "_:a" } ]
}
]
Test 0014: List pattern with multiple values of rdf:rest

Do not convert list nodes to @list if nodes contain more than one value for rdf:rest.

<http://example.com> <http://example.com/property> _:a .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:d .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:d <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "d" .
_:d <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
[
{
"@id": "_:a",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:b" } ]
},
{
"@id": "_:b",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
{ "@list": [ { "@value": "c" } ] },
{ "@list": [ { "@value": "d" } ] }
]
},
{
"@id": "http://example.com",
"http://example.com/property": [ { "@id": "_:a" } ]
}
]
Test 0015: List pattern with IRI rdf:rest

Do not convert lists to @list if a list node's rdf:rest is an IRI.

<http://example.com> <http://example.com/property> _:a .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> "b" .
[
{
"@id": "_:a",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@value": "b" } ]
},
{
"@id": "http://example.com",
"http://example.com/property": [ { "@id": "_:a" } ]
}
]
Test 0016: List pattern with type rdf:List

List nodes may have a rdf:type rdf:List.

<http://example.com/> <http://example.com/list> _:b0 .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "A" .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "B" .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "C" .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
[
{
"@id": "http://example.com/",
"http://example.com/list": [
{
"@list": [
{
"@value": "A"
},
{
"@value": "B"
},
{
"@value": "C"
}
]
}
]
}
]
Test 0017: Remove duplicate triples

Equivalent triples are used only once

<http://example.com/nodeA> <http://example.com/property> "1" .
<http://example.com/nodeA> <http://example.com/property> "1" .
<http://example.com/nodeA> <http://example.com/property> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/nodeA> <http://example.com/property> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/nodeA> <http://example.com/property> <http://example.com/nodeB> .
<http://example.com/nodeA> <http://example.com/property> <http://example.com/nodeB> .
<http://example.com/nodeA> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/TypeA> .
<http://example.com/nodeA> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/TypeA> .
<http://example.com/nodeA> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/TypeA> .
[
{
"@id": "http://example.com/nodeA",
"http://example.com/property": [
{ "@value": "1" },
{
"@value": "2",
"@type": "http://www.w3.org/2001/XMLSchema#integer"
},
{ "@id": "http://example.com/nodeB" }
],
"@type": [ "http://example.com/TypeA" ]
}
]
Test 0018: use native types flag set to true

Literals with datatype xsd:boolean, xsd:integer, and xsd:double are serialized using native scalar values

<http://example.com/Subj1> <http://example.com/prop> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.com/Subj1> <http://example.com/prop> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.com/Subj1> <http://example.com/prop> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Subj1> <http://example.com/prop> "1.1"^^<http://www.w3.org/2001/XMLSchema#decimal> .
<http://example.com/Subj1> <http://example.com/prop> "1.1E-1"^^<http://www.w3.org/2001/XMLSchema#double> .
[
{
"@id": "http://example.com/Subj1",
"http://example.com/prop": [
{ "@value": true },
{ "@value": false },
{ "@value": 1 },
{ "@value": "1.1", "@type": "http://www.w3.org/2001/XMLSchema#decimal"},
{ "@value": 0.11 }
]
}
]
Test 0019: use rdf:type flag set to false

Setting useRdfType to true causes an rdf:type predicate to be treated like a normal property, not @type

<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
<http://example.com/Subj1> <http://example.com/prop1> <http://example.com/Obj1> .
<http://example.com/Subj1> <http://example.com/prop2> "Plain" .
<http://example.com/Subj1> <http://example.com/prop2> "2012-05-12"^^<http://www.w3.org/2001/XMLSchema#date> .
<http://example.com/Subj1> <http://example.com/prop2> "English"@en .
[
{
"@id": "http://example.com/Subj1",
"http://example.com/prop1": [{"@id": "http://example.com/Obj1"}],
"http://example.com/prop2": [
{"@value": "Plain"},
{"@value": "2012-05-12", "@type": "http://www.w3.org/2001/XMLSchema#date"},
{"@value": "English", "@language": "en"}
],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
{"@id": "http://example.com/Type"}
]
}
]

Report Generation Software

This report generated by earl-report version 0.3.1 an Unlicensed Ruby application. More information is available at https://github.com/gkellogg/earl-report .

This software is provided by Gregg Kellogg in hopes that it might make the lives of conformance testers easier.