Abstract

This document reports on implementations of the JSON-LD 1.0 specifications. The main purpose of this document is to show that each feature of the specifications has been implemented by demonstrating interoperable implementations of each feature. To evaluate the coverage of an implementation's features, the JSON-LD Test Suite is used as a point of reference.

Status of This Document

This document is merely a W3C-internal document. It has no official standing of any kind and does not represent consensus of the W3C Membership.

Table of Contents

1. Introduction

The goal of this report is to verify whether the JSON-LD 1.0 [JSON-LD] and JSON-LD 1.0 Processing Algorithms and API [JSON-LD-API] specifications are implementable.

To evaluate the coverage of an implementation's features, the JSON-LD 1.0 Test Suite [JSON-LD-TESTS] is used as a point of reference.

See JSON-LD Test Description for more information.

2. Test Manifests

2.1 Compaction

JSON-LD compaction tests use object comparison.

Test JSONLD-Java JSON::LD jsonld.js browser jsonld.js node.js php-json-ld PyLD 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 UNTESTED PASS PASS PASS PASS PASS PASS
Percentage passed out of 71 Tests 98.6% 100.0% 100.0% 100.0% 100.0% 100.0% 100.0%

2.2 Error handling

JSON-LD to Expansion tests use object compare

Test JSONLD-Java JSON::LD jsonld.js browser jsonld.js node.js php-json-ld PyLD 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%

2.3 Expansion

JSON-LD to Expansion tests use object compare

Test Argo.Core.JsonLd JSONLD-Java JSON::LD jsonld.js browser jsonld.js node.js php-json-ld PyLD 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%

2.4 Flattening

JSON-LD flattening tests use object comparison.

Test JSONLD-Java JSON::LD jsonld.js browser jsonld.js node.js php-json-ld PyLD 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 UNTESTED PASS PASS PASS PASS PASS PASS
Percentage passed out of 45 Tests 97.8% 100.0% 100.0% 100.0% 100.0% 100.0% 100.0%

2.5 Remote document

Tests appropriate document loading behavior as defined in the API

Test JSONLD-Java 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 PASS
Test 0002: load JSON document FAIL PASS PASS PASS PASS PASS PASS
Test 0003: load JSON document with extension-type FAIL PASS PASS PASS PASS PASS PASS
Test 0004: loading an unknown type raises loading document failed FAIL PASS PASS PASS PASS PASS PASS
Test 0005: Load JSON-LD through 301 redirect UNTESTED PASS PASS PASS PASS PASS PASS
Test 0006: Load JSON-LD through 303 redirect UNTESTED PASS PASS PASS PASS PASS PASS
Test 0007: Load JSON-LD through 307 redirect UNTESTED PASS PASS PASS PASS PASS PASS
Test 0008: Non-existant file (404) UNTESTED PASS PASS PASS PASS PASS PASS
Test 0009: load JSON-LD document with link PASS PASS PASS PASS PASS PASS PASS
Test 0010: load JSON document with link FAIL PASS PASS PASS PASS PASS PASS
Test 0011: load JSON document with extension-type with link FAIL PASS PASS PASS PASS PASS PASS
Test 0012: Multiple context link headers FAIL PASS PASS PASS PASS PASS PASS
Percentage passed out of 12 Tests 16.7% 100.0% 100.0% 100.0% 100.0% 100.0% 100.0%

2.6 Transform JSON-LD to RDF

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

Test Argo.Core.JsonLd JSONLD-Java JSON::LD RDFLib-JSONLD jsonld.js browser jsonld.js node.js php-json-ld PyLD 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 PASS FAIL 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 PASS FAIL 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 UNTESTED PASS PASS PASS PASS PASS PASS PASS
Percentage passed out of 114 Tests 99.1% 99.1% 100.0% 98.2% 100.0% 100.0% 100.0% 100.0% 100.0%

2.7 Transform RDF to JSON-LD

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

Test Argo.Core.JsonLd JSONLD-Java JSON::LD RDFLib-JSONLD jsonld.js browser jsonld.js node.js php-json-ld PyLD JsonLD
Test 0001: Object Lists PASS PASS PASS PASS PASS PASS PASS PASS PASS
Test 0002: Native Types PASS PASS PASS FAIL 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 PASS FAIL 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 UNTESTED PASS PASS PASS PASS PASS PASS PASS
Percentage passed out of 19 Tests 100.0% 94.7% 100.0% 89.5% 100.0% 100.0% 100.0% 100.0% 100.0%

A. 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
Expansion 77/77 (100.0%)
Transform JSON-LD to RDF 113/114 (99.1%)
Transform RDF to JSON-LD 19/19 (100.0%)
JSONLD-Java
Programming Language
Java
Home Page
http://github.com/jsonld-java/jsonld-java
Developer
Test Suite Compliance
Compaction 70/71 (98.6%)
Error handling 43/43 (100.0%)
Expansion 77/77 (100.0%)
Flattening 44/45 (97.8%)
Remote document 2/12 (16.7%)
Transform JSON-LD to RDF 113/114 (99.1%)
Transform RDF to JSON-LD 18/19 (94.7%)
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
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
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%)

B. Individual Test Results

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

C. Test Definitions

Test 0001: drop free-floating nodes

Unreferenced nodes not containing properties are dropped

Example 1: drop free-floating nodes Input
{"@id": "http://example.org/test#example"}
Example 2: drop free-floating nodes Result
{}
Test 0002: basic

Basic term and value compaction

Example 3: basic Input
[{
"@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]
}]
Example 4: basic Result
{
"@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

Example 5: drop null and unmapped properties Input
{
"@id": "http://example.org/id",
"http://example.org/property": null,
"regularJson": {
"nonJsonLd": "property",
"deep": [{
"foo": "bar"
}, {
"bar": "foo"
}]
}
}
Example 6: drop null and unmapped properties Result
{}
Test 0004: optimize @set, keep empty arrays

Containers mapped to @set keep empty arrays

Example 7: optimize @set, keep empty arrays Input
{
"@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]
}
Example 8: optimize @set, keep empty arrays Result
{
"@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

Example 9: @type and prefix compaction Input
{
"@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"}
}
Example 10: @type and prefix compaction Result
{
"@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

Example 11: keep expanded object format if @type doesn't match Input
{
"@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"}
}
Example 12: keep expanded object format if @type doesn't match Result
{
"@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

Example 13: add context Input
{
"@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"]
}]
}
]
}
Example 14: add context Result
{
"@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

Example 15: alias keywords Input
[{
"@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"
}]
}]
Example 16: alias keywords Result
{
"@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

Example 17: compact @id Input
{
"@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"
}
Example 18: compact @id Result
{
"@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

Example 19: array to @graph Input
[
{
"@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"
}
]
Example 20: array to @graph Result
{
"@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

Example 21: compact date Input
{
"@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"
}
}
}
Example 22: compact date Result
{
"@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

Example 23: native types Input
{
"@id": "http://example.org/test",
"http://example.org/vocab#bool": true,
"http://example.org/vocab#int": 123
}
Example 24: native types Result
{
"@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

Example 25: @value with @language Input
{
"@id": "http://example.org/test",
"http://example.org/vocab#test": {"@value": "test", "@language": "en"}
}
Example 26: @value with @language Result
{
"@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

Example 27: array to aliased @graph Input
[
{
"@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"
}
]
Example 28: array to aliased @graph Result
{
"@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

Example 29: best match compaction Input
[{
"@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"}
]
}]
Example 30: best match compaction Result
{
"@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

Example 31: recursive named graphs Input
[
{
"@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 ]
}
]
}
]
}
]
Example 32: recursive named graphs Result
{
"@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

Example 33: A term mapping to null removes the mapping Input
{
"http://www.w3.org/2000/01/rdf-schema#comment": [
{ "@value": "Kommentar auf Deutsch.", "@language": "de" },
{ "@value": "Comment in English.", "@language": "en" }
]
}
Example 34: A term mapping to null removes the mapping Result
{
"@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

Example 35: best matching term for lists Input
{
"@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" }
]
}
]
}
Example 36: best matching term for lists Result
{
"@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

Example 37: Keep duplicate values in @list and @set Input
[{
"@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}
]
}]
Example 38: Keep duplicate values in @list and @set Result
{
"@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

Example 39: Compact @id that is a property IRI when @container is @list Input
{
"@context": {
"ex": "http://example.org/ns#"
},
"@id": "ex:property",
"ex:property": {
"@list": [1, 2]
}
}
Example 40: Compact @id that is a property IRI when @container is @list Result
{
"@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

Example 41: Compact properties and types using @vocab Input
[
{
"@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"
}
]
}
]
}
]
Example 42: Compact properties and types using @vocab Result
{
"@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

Example 43: @list compaction of nested properties Input
[
{
"@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"
]
}
]
Example 44: @list compaction of nested properties Result
{
"@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

Example 45: prefer @vocab over compacted IRIs Input
[
{
"@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"
}
]
}
]
}
]
Example 46: prefer @vocab over compacted IRIs Result
{
"@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.

Example 47: most specific term matching in @list. Input
{

"@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" }
]
}
]
}
Example 48: most specific term matching in @list. Result
{
"@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

Example 49: Language maps Input
[
{
"@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"
}
]
}
]
Example 50: Language maps Result
{
"@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

Example 51: Language map term selection with complications Input
[{
"@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"
}
]
}]
Example 52: Language map term selection with complications Result
{
"@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

Example 53: @container: @set with multiple values Input
[{
"@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"
}
]
}]
Example 54: @container: @set with multiple values Result
{
"@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

Example 55: Alias keywords and use @vocab Input
{
"@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/"
}
Example 56: Alias keywords and use @vocab Result
{
"@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

Example 57: Simple @index map Input
[{
"@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"
}]
}]
Example 58: Simple @index map Result
{
"@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

Example 59: non-matching @container: @index Input
[
{
"@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"
}
]
}
]
Example 60: non-matching @container: @index Result
{
"@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

Example 61: Compact @reverse Input
[
{
"@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" } ]
}
]
Example 62: Compact @reverse Result
{
"@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

Example 63: Compact keys in reverse-maps Input
[
{
"@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" } ]
}
]
Example 64: Compact keys in reverse-maps Result
{
"@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

Example 65: Compact reverse-map to reverse property Input
[
{
"@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" } ]
}
]
Example 66: Compact reverse-map to reverse property Result
{
"@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

Example 67: Skip property with @reverse if no match Input
[
{
"@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" } ]
}
]
Example 68: Skip property with @reverse if no match Result
{
"@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

Example 69: Compact @reverse node references using strings Input
[
{
"@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" } ]
}
]
Example 70: Compact @reverse node references using strings Result
{
"@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

Example 71: Compact reverse properties using index containers Input
[
{
"@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" } ]
}
]
Example 72: Compact reverse properties using index containers Result
{
"@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

Example 73: Compact keys in @reverse using @vocab Input
[
{
"@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" } ]
}
]
Example 74: Compact keys in @reverse using @vocab Result
{
"@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

Example 75: Index map round-tripping Input
{
"@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"
}
]
}
}
Example 76: Index map round-tripping Result
{
"@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

Example 77: @graph is array Input
[
{
"@id": "http://example.com/graph/1",
"@graph": [
{
"@id": "http://example.com/node/1",
"http://example.com/property": [ { "@value": "property" } ]
}
]
}
]
Example 78: @graph is array Result
{
"@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

Example 79: @list is array Input
[
{
"@id": "http://me.markus-lanthaler.com/",
"http://example.com/list": {
"@list": [
"one item"
]
}
}
]
Example 80: @list is array Result
{
"@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

Example 81: index rejects term having @list Input
[
{
"@id": "http://example.com/node",
"http://example.com/property": [
{
"@index": "an index",
"@list": [
{
"@value": "one item"
}
]
}
]
}
]
Example 82: index rejects term having @list Result
{
"@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

Example 83: @list keyword aliasing Input
[
{
"@id": "http://example.com/node",
"http://example.com/property": [
{
"@list": [
{
"@value": "one item"
}
],
"@index": "an index"
}
]
}
]
Example 84: @list keyword aliasing Result
{
"@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

Example 85: select term over @vocab Input
[
{
"@id": "http://example.com/node",
"http://example.com/name": [
{ "@value": "Markus Lanthaler" }
]
}
]
Example 86: select term over @vocab Result
{
"@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

Example 87: @type: @vocab in reverse-map Input
[
{
"@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" } ]
}
]
Example 88: @type: @vocab in reverse-map Result
{
"@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

Example 89: @id value uses relative IRI, not term Input
[
{
"@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" }
]
}
]
}
]
Example 90: @id value uses relative IRI, not term Result
{
"@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

Example 91: multiple objects without @context use @graph Input
[
{
"@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"
}
]
Example 92: multiple objects without @context use @graph Result
{
"@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

Example 93: Round-trip relative URLs Input
{
"@context": {
"@base": "http://example.com/",
"link": { "@id": "http://example.com/link", "@type": "@id" }
},
"link": "relative-url"
}
Example 94: Round-trip relative URLs Result
{
"@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

Example 95: term with @language: null Input
{
"http://example.com/propertyA": 5,
"http://example.com/propertyB": 5
}
Example 96: term with @language: null Result
{
"@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

Example 97: Round tripping of lists that contain just IRIs Input
{
"@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" ] }
}
Example 98: Round tripping of lists that contain just IRIs Result
{
"@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

Example 99: Reverse properties require @type: @id to use string values Input
[
{
"@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" } ]
}
]
Example 100: Reverse properties require @type: @id to use string values Result
{
"@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

Example 101: Round tripping @list with scalar Input
{
"http://example.org/term": {
"@list": [1]
}
}
Example 102: Round tripping @list with scalar Result
{
"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

Example 103: Round tripping @list with scalar and @graph alias Input
{
"@context": {
"graph": "@graph",
"term": "http://example.org/term"
},
"graph": [
{
"term": {
"@list": [1]
}
},
{
"term": {
"@list": [2]
}
}
]
}
Example 104: Round tripping @list with scalar and @graph alias Result
{
"@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

Example 105: Use @type: @vocab if no @type: @id Input
[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
Example 106: Use @type: @vocab if no @type: @id Result
{
"@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

Example 107: Compact to @type: @vocab and compact @id to term Input
[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
Example 108: Compact to @type: @vocab and compact @id to term Result
{
"@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

Example 109: Round tripping @type: @vocab Input
{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"},
"enum": {"@id": "http://example.org/enum"}
},
"term": "enum"
}
Example 110: Round tripping @type: @vocab Result
{
"@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

Example 111: Prefer @type: @vocab over @type: @id for terms Input
[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
Example 112: Prefer @type: @vocab over @type: @id for terms Result
{
"@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

Example 113: Complex round tripping @type: @vocab and @type: @id Input
{
"@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"
}
Example 114: Complex round tripping @type: @vocab and @type: @id Result
{
"@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

Example 115: Prefer @type: @id over @type: @vocab for non-terms Input
[{
"http://example.org/term": [{"@id": "http://example.org/enum"}]
}]
Example 116: Prefer @type: @id over @type: @vocab for non-terms Result
{
"@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

Example 117: Term with @type: @vocab if no @type: @id Input
[
{
"http://example.com/vocab#foo": [
{ "@id": "http://example.com/vocab#Bar" },
{ "@id": "http://example.com/vocab#Baz" }
]
}
]
Example 118: Term with @type: @vocab if no @type: @id Result
{
"@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

Example 119: Term with @type: @id if no @type: @vocab and term value Input
[
{
"http://example.com/vocab#foo": [
{ "@id": "http://example.com/vocab#Bar" },
{ "@id": "http://example.com/vocab#Baz" }
]
}
]
Example 120: Term with @type: @id if no @type: @vocab and term value Result
{
"@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)

Example 121: @type: @vocab/@id with values matching either Input
[
{
"http://example.com/vocab#foo": [
{ "@id": "http://example.com/vocab#Bar" },
{ "@id": "http://example.com/vocab#Baz" }
]
}
]
Example 122: @type: @vocab/@id with values matching either Result
{
"@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

Example 123: @type: @vocab and relative IRIs Input
{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" }
},
"term": "not-a-term-thus-a-relative-IRI"
}
Example 124: @type: @vocab and relative IRIs Result
{
"@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

Example 125: Compact IRI round-tripping with @type: @vocab Input
{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" },
"prefix": "http://example.com/vocab#"
},
"term": "prefix:suffix"
}
Example 126: Compact IRI round-tripping with @type: @vocab Result
{
"@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

Example 127: Compact language-tagged and indexed strings to index-map Input
[
{
"@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"
}
]
}
]
Example 128: Compact language-tagged and indexed strings to index-map Result
{
"@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

Example 129: Language-tagged and indexed strings with language-map Input
[
{
"@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"
}
]
}
]
Example 130: Language-tagged and indexed strings with language-map Result
{
"@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

Example 131: Relative IRIs Input
[
{
"@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" }
]
} ]
}
]
Example 132: Relative IRIs Result
{
"@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

Example 133: Reverse properties with blank nodes Input
[
{
"@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" } ]
}
]
Example 134: Reverse properties with blank nodes Result
{
"@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

Example 135: Single value reverse properties Input
[
{
"@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" } ]
}
]
Example 136: Single value reverse properties Result
{
"@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

Example 137: Single value reverse properties with @set Input
[
{
"@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" } ]
}
]
Example 138: Single value reverse properties with @set Result
{
"@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

Example 139: compactArrays option Input
[{
"@id": "http://example/foo",
"http://example/term": [{"@value": "value"}]
}]
Example 140: compactArrays option Result
{
"@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

Example 141: input has multiple @contexts, output has one Input
{
"@context": [{
"foo": "http://example.com/foo"
}, {
"bar": "http://example.com/bar"
}],
"foo": "foo-value",
"bar": "bar-value"
}
Example 142: input has multiple @contexts, output has one Result
{
"@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

Example 143: Keywords cannot be aliased to other keywords Input
{
"@context": {
"@type": "@id"
},
"@type": "http://example.org/type"
}
Example 144: Keywords cannot be aliased to other keywords Result
n/a
Test 0002: A context may not include itself recursively (direct)

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

Example 145: A context may not include itself recursively (direct) Input
{
"@context": "error-0002-in.jsonld",
"@id": "http://example/test#example"
}
Example 146: A context may not include itself recursively (direct) Result
n/a
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

Example 147: A context may not include itself recursively (indirect) Input
{
"@context": "error-0003-ctx.jsonld",
"@id": "http://example/test#example"
}
Example 148: A context may not include itself recursively (indirect) Result
n/a
Test 0004: Error dereferencing a remote context

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

Example 149: Error dereferencing a remote context Input
{
"@context": "tag:non-dereferencable-iri",
"@id": "http://example/test#example"
}
Example 150: Error dereferencing a remote context Result
n/a
Test 0005: Invalid remote context

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

Example 151: Invalid remote context Input
[{
"@context": "error-0005-in.jsonld",
"@id": "http://example/test#example"
}]
Example 152: Invalid remote context Result
n/a
Test 0006: Invalid local context

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

Example 153: Invalid local context Input
{
"@context": true,
"@id": "http://example/test#example"
}
Example 154: Invalid local context Result
n/a
Test 0007: Invalid base IRI

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

Example 155: Invalid base IRI Input
{
"@context": {"@base": true},
"@id": "http://example/test#example"
}
Example 156: Invalid base IRI Result
n/a
Test 0008: Invalid vocab mapping

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

Example 157: Invalid vocab mapping Input
{
"@context": {"@vocab": true},
"@id": "http://example/test#example"
}
Example 158: Invalid vocab mapping Result
n/a
Test 0009: Invalid default language

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

Example 159: Invalid default language Input
{
"@context": {"@language": true},
"@id": "http://example/test#example"
}
Example 160: Invalid default language Result
n/a
Test 0010: Cyclic IRI mapping

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

Example 161: Cyclic IRI mapping Input
{
"@context": {
"term": {"@id": "term:term"}
},
"@id": "http://example/test#example"
}
Example 162: Cyclic IRI mapping Result
n/a
Test 0011: Invalid term definition

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

Example 163: Invalid term definition Input
{
"@context": {
"term": true
},
"@id": "http://example/test#example"
}
Example 164: Invalid term definition Result
n/a
Test 0012: Invalid type mapping (not a string)

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

Example 165: Invalid type mapping (not a string) Input
{
"@context": {
"term": {"@id": "http://example/term", "@type": true}
},
"@id": "http://example/test#example"
}
Example 166: Invalid type mapping (not a string) Result
n/a
Test 0013: Invalid type mapping (not absolute IRI)

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

Example 167: Invalid type mapping (not absolute IRI) Input
{
"@context": {
"term": {"@id": "http://example/term", "@type": "_:not-an-iri"}
},
"@id": "http://example/test#example"
}
Example 168: Invalid type mapping (not absolute IRI) Result
n/a
Test 0014: Invalid reverse property (contains @id)

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

Example 169: Invalid reverse property (contains @id) Input
{
"@context": {
"term": {"@id": "http://example/term", "@reverse": "http://example/reverse"}
},
"@id": "http://example/test#example"
}
Example 170: Invalid reverse property (contains @id) Result
n/a
Test 0015: Invalid IRI mapping (@reverse not a string)

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

Example 171: Invalid IRI mapping (@reverse not a string) Input
{
"@context": {
"term": {"@reverse": true}
},
"@id": "http://example/test#example"
}
Example 172: Invalid IRI mapping (@reverse not a string) Result
n/a
Test 0016: Invalid IRI mapping (not an absolute IRI)

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

Example 173: Invalid IRI mapping (not an absolute IRI) Input
{
"@context": {
"term": {"@reverse": "@reverse"}
},
"@id": "http://example/test#example"
}
Example 174: Invalid IRI mapping (not an absolute IRI) Result
n/a
Test 0017: Invalid reverse property (invalid @container)

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

Example 175: Invalid reverse property (invalid @container) Input
{
"@context": {
"term": {"@reverse": "http://example/reverse", "@container": "@list"}
},
"@id": "http://example/test#example"
}
Example 176: Invalid reverse property (invalid @container) Result
n/a
Test 0018: Invalid IRI mapping (@id not a string)

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

Example 177: Invalid IRI mapping (@id not a string) Input
{
"@context": {
"term": {"@id": true}
},
"@id": "http://example/test#example"
}
Example 178: Invalid IRI mapping (@id not a string) Result
n/a
Test 0019: Invalid keyword alias

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

Example 179: Invalid keyword alias Input
{
"@context": {
"term": {"@id": "@context"}
},
"@id": "http://example/test#example"
}
Example 180: Invalid keyword alias Result
n/a
Test 0020: Invalid IRI mapping (no vocab mapping)

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

Example 181: Invalid IRI mapping (no vocab mapping) Input
{
"@context": {
"term": {"@container": "@set"}
},
"@id": "http://example/test#example"
}
Example 182: Invalid IRI mapping (no vocab mapping) Result
n/a
Test 0021: Invalid container mapping

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

Example 183: Invalid container mapping Input
{
"@context": {
"term": {"@id": "http://example/term", "@container": "@id"}
},
"@id": "http://example/test#example"
}
Example 184: Invalid container mapping Result
n/a
Test 0022: Invalid language mapping

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

Example 185: Invalid language mapping Input
{
"@context": {
"term": {"@id": "http://example/term", "@language": true}
},
"@id": "http://example/test#example"
}
Example 186: Invalid language mapping Result
n/a
Test 0023: Invalid IRI mapping (relative IRI in @type)

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

Example 187: Invalid IRI mapping (relative IRI in @type) Input
{
"@context": {
"term": {"@id": "http://example/term", "@type": "relative/iri"}
},
"@id": "http://example/test#example"
}
Example 188: Invalid IRI mapping (relative IRI in @type) Result
n/a
Test 0024: List of lists (from array)

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

Example 189: List of lists (from array) Input
{
"@context": {"foo": {"@id": "http://example.com/foo", "@container": "@list"}},
"foo": [{"@list": ["baz"]}]
}
Example 190: List of lists (from array) Result
n/a
Test 0025: Invalid reverse property map

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

Example 191: Invalid reverse property map Input
{
"@id": "http://example/foo",
"@reverse": {
"@id": "http://example/bar"
}
}
Example 192: Invalid reverse property map Result
n/a
Test 0026: Colliding keywords

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

Example 193: Colliding keywords Input
{
"@context": {
"id": "@id",
"ID": "@id"
},
"id": "http://example/foo",
"ID": "http://example/bar"
}
Example 194: Colliding keywords Result
n/a
Test 0027: Invalid @id value

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

Example 195: Invalid @id value Input
{
"@id": true
}
Example 196: Invalid @id value Result
n/a
Test 0028: Invalid type value

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

Example 197: Invalid type value Input
{
"@type": true
}
Example 198: Invalid type value Result
n/a
Test 0029: Invalid value object value

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

Example 199: Invalid value object value Input
{
"http://example/prop": {"@value": ["foo"]}
}
Example 200: Invalid value object value Result
n/a
Test 0030: Invalid language-tagged string

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

Example 201: Invalid language-tagged string Input
{
"http://example/prop": {"@value": "foo", "@language": true}
}
Example 202: Invalid language-tagged string Result
n/a
Test 0031: Invalid @index value

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

Example 203: Invalid @index value Input
{
"http://example.com/vocab/indexMap": {
"@value": "simple string",
"@language": "en",
"@index": true
}
}
Example 204: Invalid @index value Result
n/a
Test 0032: List of lists (from array)

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

Example 205: List of lists (from array) Input
{
"http://example.com/foo": {"@list": [{"@list": ["baz"]}]}
}
Example 206: List of lists (from array) Result
n/a
Test 0033: Invalid @reverse value

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

Example 207: Invalid @reverse value Input
{
"http://example/prop": {
"@reverse": true
}
}
Example 208: Invalid @reverse value Result
n/a
Test 0034: Invalid reverse property value (in @reverse)

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

Example 209: Invalid reverse property value (in @reverse) Input
{
"@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"
}
}
Example 210: Invalid reverse property value (in @reverse) Result
n/a
Test 0035: Invalid language map value

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

Example 211: Invalid language map value Input
{
"@context": {
"vocab": "http://example.com/vocab/",
"label": {
"@id": "vocab:label",
"@container": "@language"
}
},
"@id": "http://example.com/queen",
"label": {
"en": true
}
}
Example 212: Invalid language map value Result
n/a
Test 0036: Invalid reverse property value (through coercion)

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

Example 213: Invalid reverse property value (through coercion) Input
{
"@context": {
"term": {"@reverse": "http://example/reverse"}
},
"@id": "http://example/foo",
"term": {"@list": ["http://example/bar"]}
}
Example 214: Invalid reverse property value (through coercion) Result
n/a
Test 0037: Invalid value object (unexpected keyword)

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

Example 215: Invalid value object (unexpected keyword) Input
{
"http://example/foo": {"@value": "bar", "@id": "http://example/baz"}
}
Example 216: Invalid value object (unexpected keyword) Result
n/a
Test 0038: Invalid value object (@type and @language)

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

Example 217: Invalid value object (@type and @language) Input
{
"http://example/foo": {"@value": "bar", "@language": "en", "@type": "http://example/type"}
}
Example 218: Invalid value object (@type and @language) Result
n/a
Test 0039: Invalid language-tagged value

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

Example 219: Invalid language-tagged value Input
{
"http://example/foo": {"@value": true, "@language": "en"}
}
Example 220: Invalid language-tagged value Result
n/a
Test 0040: Invalid typed value

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

Example 221: Invalid typed value Input
{
"http://example/foo": {"@value": "bar", "@type": "_:dt"}
}
Example 222: Invalid typed value Result
n/a
Test 0041: Invalid set or list object

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

Example 223: Invalid set or list object Input
{
"http://example/prop": {"@list": ["foo"], "@id": "http://example/bar"}
}
Example 224: Invalid set or list object Result
n/a
Test 0042: Compaction to list of lists

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

Example 225: Compaction to list of lists Input
{
"http://example/list": [{"@list": ["foo"]}, {"@list": ["bar"]}]
}
Example 226: Compaction to list of lists Result
n/a
Test 0043: Conflicting indexes

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

Example 227: Conflicting indexes Input
[
{
"@id": "http://example/foo",
"@index": "bar"
},
{
"@id": "http://example/foo",
"@index": "baz"
}
]
Example 228: Conflicting indexes Result
n/a
Test 0001: drop free-floating nodes

Expand drops unreferenced nodes having only @id

Example 229: drop free-floating nodes Input
{"@id": "http://example.org/test#example"}
Example 230: drop free-floating nodes Result
[ ]
Test 0002: basic

Expanding terms with different types of values

Example 231: basic Input
{
"@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]
}
Example 232: basic Result
[{
"@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

Example 233: drop null and unmapped properties Input
{
"@id": "http://example.org/id",
"http://example.org/property": null,
"regularJson": {
"nonJsonLd": "property",
"deep": [{
"foo": "bar"
}, {
"bar": "foo"
}]
}
}
Example 234: drop null and unmapped properties Result
[ ]
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

Example 235: optimize @set, keep empty arrays Input
{
"@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" }
}
Example 236: optimize @set, keep empty arrays Result
[{
"@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

Example 237: do not expand aliased @id/@type Input
{
"@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"
}
]
}
Example 238: do not expand aliased @id/@type Result
[{
"@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

Example 239: alias keywords Input
{
"@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"
}
Example 240: alias keywords Result
[{
"@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

Example 241: date type-coercion Input
{
"@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"
}
}
Example 242: date type-coercion Result
[{
"@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

Example 243: @value with @language Input
{
"@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" }
}
Example 244: @value with @language Result
[
{
"@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

Example 245: @graph with terms Input
{
"@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"
}
}
]
}
Example 246: @graph with terms Result
[
{
"@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

Example 247: native types Input
{
"@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
}
Example 248: native types Result
[{
"@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

Example 249: coerced @id Input
{
"@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"
}
Example 250: coerced @id Result
[{
"@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

Example 251: @graph with embed Input
{
"@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"
}
}
]
}
Example 252: @graph with embed Result
[
{
"@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

Example 253: expand already expanded Input
[{
"@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]
}]
Example 254: expand already expanded Result
[{
"@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

Example 255: @set of @value objects with keyword aliases Input
{
"@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"
}
Example 256: @set of @value objects with keyword aliases Result
[
{
"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

Example 257: collapse set of sets, keep empty lists Input
{
"@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" ] } ]
}
Example 258: collapse set of sets, keep empty lists Result
[
{
"@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

Example 259: context reset Input
{
"@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 ] ]
}
}
Example 260: context reset Result
[
{
"@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

Example 261: @graph and @id aliased Input
{
"@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"
}
}
]
}
Example 262: @graph and @id aliased Result
[
{
"@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

Example 263: override default @language Input
{
"@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
]
}
Example 264: override default @language Result
[
{
"@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

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

@graph used under a node is retained

Example 267: do not remove @graph if not at top-level Input
{
"@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"
}
}
]
}
Example 268: do not remove @graph if not at top-level Result
[
{
"@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

Example 269: do not remove @graph at top-level if not only property Input
{
"@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"
}
}
]
}
Example 270: do not remove @graph at top-level if not only property Result
[
{
"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

Example 271: expand value with default language Input
{
"@context": {
"term": "http://example.com/term",
"@language": "en"
},
"term": "v"
}
Example 272: expand value with default language Result
[{
"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

Example 273: Expanding list/set with coercion Input
{
"@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"]}
}
Example 274: Expanding list/set with coercion Result
[
{
"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

Example 275: Multiple contexts Input
{
"@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"
}
Example 276: Multiple contexts Result
[{
"@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

Example 277: Problematic IRI expansion tests Input
{
"@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", "_" ]
}
Example 278: Problematic IRI expansion tests Result
[{
"@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

Example 279: Term definition with @id: @type Input
{
"@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"
}
]
}
Example 280: Term definition with @id: @type Result
[
{
"@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

Example 281: Duplicate values in @list and @set Input
{
"@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]
}
Example 282: Duplicate values in @list and @set Result
[{
"@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

Example 283: Use @vocab in properties and @type but not in @id Input
{
"@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" }
}
}
Example 284: Use @vocab in properties and @type but not in @id Result
[
{
"@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

Example 285: Relative IRIs Input
{
"@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"
]
}
Example 286: Relative IRIs Result
[
{
"@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

Example 287: Language maps Input
{
"@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" ]
}
}
Example 288: Language maps Result
[
{
"@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

Example 289: type-coercion of native types Input
{
"@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
}
Example 290: type-coercion of native types Result
[
{
"@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

Example 291: Null term and @vocab Input
{
"@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"
}
Example 292: Null term and @vocab Result
[
{
"@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

Example 293: Using @vocab with with type-coercion Input
{
"@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"
}
Example 294: Using @vocab with with type-coercion Result
[{
"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

Example 295: Multiple properties expanding to the same IRI Input
{
"@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
}
Example 296: Multiple properties expanding to the same IRI Result
[{
"@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

Example 297: Language maps with @vocab, default language, and colliding property Input
{
"@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" }
]
}
Example 298: Language maps with @vocab, default language, and colliding property Result
[{
"@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

Example 299: Expanding @index Input
{
"@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"
}
]
}
Example 300: Expanding @index Result
[
{
"@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

Example 301: Expanding @reverse Input
{
"@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"
}
}
}
Example 302: Expanding @reverse Result
[
{
"@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

Example 303: Expanding blank node labels Input
{
"@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"
}
]
}
Example 304: Expanding blank node labels Result
[
{
"@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

Example 305: Using terms in a reverse-maps Input
{
"@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"
}
}
}
Example 306: Using terms in a reverse-maps Result
[
{
"@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

Example 307: language and index expansion on non-objects Input
{
"@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" }
]
}
Example 308: language and index expansion on non-objects Result
[
{
"@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
Example 309: @language: null resets the default language Input
{
"@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"
}
}
Example 310: @language: null resets the default language Result
[
{
"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

Example 311: Reverse properties Input
{
"@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"
}
}
Example 312: Reverse properties Result
[
{
"@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

Example 313: Using reverse properties inside a @reverse-container Input
{
"@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"
}
]
}
}
Example 314: Using reverse properties inside a @reverse-container Result
[
{
"@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

Example 315: Index maps with language mappings Input
{
"@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"
]
}
Example 316: Index maps with language mappings Result
[
{
"@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

Example 317: Top-level value objects Input
{
"@value": "free-floating value"
}
Example 318: Top-level value objects Result
[ ]
Test 0046: Free-floating nodes

Expanding free-floating nodes causes them to be removed

Example 319: Free-floating nodes Input
{
"@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
]
}
Example 320: Free-floating nodes Result
[ ]
Test 0047: Free-floating values in sets and free-floating lists

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

Example 321: Free-floating values in sets and free-floating lists Input
{
"@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"
}
]
}
]
}
Example 322: Free-floating values in sets and free-floating lists Result
[
{
"@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

Example 323: Terms are ignored in @id Input
{
"@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"
}
]
}
Example 324: Terms are ignored in @id Result
[
{
"@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

Example 325: String values of reverse properties Input
{
"@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"
]
}
Example 326: String values of reverse properties Result
[
{
"@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

Example 327: Term definitions with prefix separate from prefix definitions Input
{
"@context": {
"issue": { "@id": "http://example.com/issue/", "@type": "@id" },
"issue:raisedBy": { "@container": "@set" }
},
"issue": "/issue/1",
"issue:raisedBy": "Markus"
}
Example 328: Term definitions with prefix separate from prefix definitions Result
[
{
"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

Example 329: Expansion of keyword aliases in term definitions Input
{
"@context": [
{ "id": "@id" },
{ "url": "id" }
],
"url": "/issue/1",
"http://example.com/property": "ok"
}
Example 330: Expansion of keyword aliases in term definitions Result
[{
"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

Example 331: @vocab-relative IRIs in term definitions Input
{
"@context": {
"@vocab": "http://example.org/",
"property": "vocabRelativeProperty"
},
"property": "must expand to http://example.org/vocabRelativeProperty",
"http://example.org/property": "ok"
}
Example 332: @vocab-relative IRIs in term definitions Result
[
{
"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

Example 333: Expand absolute IRI with @type: @vocab Input
{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"}
},
"term": "http://example.org/enum"
}
Example 334: Expand absolute IRI with @type: @vocab Result
[{
"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

Example 335: Expand term with @type: @vocab Input
{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"},
"enum": {"@id": "http://example.org/enum"}
},
"term": "enum"
}
Example 336: Expand term with @type: @vocab Result
[{
"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

Example 337: Expand @vocab-relative term with @type: @vocab Input
{
"@context": {
"@vocab": "http://example.org/",
"term": {"@id": "http://example.org/term", "@type": "@vocab"}
},
"term": "enum"
}
Example 338: Expand @vocab-relative term with @type: @vocab Result
[{
"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

Example 339: Use terms with @type: @vocab but not with @type: @id Input
{
"@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"
}
Example 340: Use terms with @type: @vocab but not with @type: @id Result
[
{
"@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

Example 341: Expand relative IRI with @type: @vocab Input
{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" }
},
"term": "not-a-term-thus-a-relative-IRI"
}
Example 342: Expand relative IRI with @type: @vocab Result
[
{
"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

Example 343: Expand compact IRI with @type: @vocab Input
{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" },
"prefix": "http://example.com/vocab#"
},
"term": "prefix:suffix"
}
Example 344: Expand compact IRI with @type: @vocab Result
[
{
"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

Example 345: Reset @vocab by setting it to null Input
{
"@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"
}
}
Example 346: Reset @vocab by setting it to null Result
[
{
"@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

Example 347: Overwrite document base with @base and reset it again Input
{
"@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"
}
]
}
}
Example 348: Overwrite document base with @base and reset it again Result
[
{
"@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

Example 349: Coercing native types to arbitrary datatypes Input
{
"@context": {
"property": {
"@id": "http://example.com/property",
"@type": "http://example.com/datatype"
}
},
"property": [ 1, true, false, 5.1 ]
}
Example 350: Coercing native types to arbitrary datatypes Result
[
{
"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

Example 351: Various relative IRIs with with @base Input
{
"@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"
]
}
Example 352: Various relative IRIs with with @base Result
[
{
"@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

Example 353: Reverse property and index container Input
{
"@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"
}
}
}
Example 354: Reverse property and index container Result
[
{
"@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

Example 355: bnode values of reverse properties Input
{
"@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"
}
]
}
Example 356: bnode values of reverse properties Result
[
{
"@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

Example 357: Drop unmapped keys in reverse map Input
{
"@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"
}
}
}
Example 358: Drop unmapped keys in reverse map Result
[
{
"@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

Example 359: Reverse-map keys with @vocab Input
{
"@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"
}
}
}
Example 360: Reverse-map keys with @vocab Result
[
{
"@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

Example 361: prefix://suffix not a compact IRI Input
{
"@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"
}
Example 362: prefix://suffix not a compact IRI Result
[
{
"@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

Example 363: _:suffix values are not a compact IRI Input
{
"@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"
}
Example 364: _:suffix values are not a compact IRI Result
[
{
"@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

Example 365: Compact IRI as term with type mapping Input
{
"@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"
}
Example 366: Compact IRI as term with type mapping Result
[
{
"@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

Example 367: Compact IRI as term defined using equivalent compact IRI Input
{
"@context": {
"prefix": "http://www.example.org/vocab#",
"prefix:foo": "prefix:foo"
},
"@id": "http://example.com/vocab#id",
"@type": "prefix:Class",
"prefix:foo": "bar"
}
Example 368: Compact IRI as term defined using equivalent compact IRI Result
[
{
"@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

Example 369: Redefine terms looking like compact IRIs Input
{
"@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"
}
Example 370: Redefine terms looking like compact IRIs Result
[
{
"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

Example 371: Redefine term using @vocab, not itself Input
{
"@context": [
{
"v": "http://example.com/vocab#",
"term": "v:somethingElse"
},
{
"@vocab": "http://example.com/anotherVocab#",
"term": "term"
}
],
"term": "value of term"
}
Example 372: Redefine term using @vocab, not itself Result
[
{
"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

Example 373: @context not first property Input
{
"@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" }
}
}
Example 374: @context not first property Result
[
{
"@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

Example 375: @id not first property Input
{
"@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"
}
Example 376: @id not first property Result
[
{
"@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

Example 377: @vocab as blank node identifier Input
{
"@context": {
"@vocab": "_:"
},
"@id": "ex:node1",
"b1": "blank node property 1",
"b2": "blank node property 1"
}
Example 378: @vocab as blank node identifier Result
[
{
"@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

Example 379: base option overrides document location Input
{
"@id": "relative-iri",
"http://prop": "value"
}
Example 380: base option overrides document location Result
[{
"@id": "http://example/base/relative-iri",
"http://prop": [{"@value": "value"}]
}]
Test 0077: expandContext option

Use of the expandContext option to expand the input document

Example 381: expandContext option Input
{
"@id": "http://example.com/id1",
"@type": "t1",
"term1": "v1",
"term2": {"@value": "v2", "@type": "t2"},
"term3": {"@value": "v3", "@language": "en"},
"term4": 4,
"term5": [50, 51]
}
Example 382: expandContext option Result
[{
"@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

Example 383: drop free-floating nodes Input
{"@id": "http://example.org/test#example"}
Example 384: drop free-floating nodes Result
[ ]
Test 0002: basic

Flattening terms with different types of values

Example 385: basic Input
{
"@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]
}
Example 386: basic Result
[
{
"@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

Example 387: drop null and unmapped properties Input
{
"@id": "http://example.org/id",
"http://example.org/property": null,
"regularJson": {
"nonJsonLd": "property",
"deep": [{
"foo": "bar"
}, {
"bar": "foo"
}]
}
}
Example 388: drop null and unmapped properties Result
[ ]
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

Example 389: optimize @set, keep empty arrays Input
{
"@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" }
}
Example 390: optimize @set, keep empty arrays Result
[
{
"@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

Example 391: do not expand aliased @id/@type Input
{
"@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"
}
]
}
Example 392: do not expand aliased @id/@type Result
[
{
"@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

Example 393: alias keywords Input
{
"@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"
}
Example 394: alias keywords Result
[
{
"@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

Example 395: date type-coercion Input
{
"@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"
}
}
Example 396: date type-coercion Result
[
{
"@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

Example 397: @value with @language Input
{
"@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" }
}
Example 398: @value with @language Result
[
{
"@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

Example 399: @graph with terms Input
{
"@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"
}
}
]
}
Example 400: @graph with terms Result
[
{
"@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

Example 401: native types Input
{
"@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
}
Example 402: native types Result
[
{
"@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

Example 403: coerced @id Input
{
"@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"
}
Example 404: coerced @id Result
[
{
"@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

Example 405: @graph with embed Input
{
"@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"
}
}
]
}
Example 406: @graph with embed Result
[
{
"@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

Example 407: flatten already expanded Input
[{
"@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]
}]
Example 408: flatten already expanded Result
[
{
"@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

Example 409: @set of @value objects with keyword aliases Input
{
"@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"
}
Example 410: @set of @value objects with keyword aliases Result
[
{
"@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

Example 411: collapse set of sets, keep empty lists Input
{
"@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" ] } ]
}
Example 412: collapse set of sets, keep empty lists Result
[
{
"@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

Example 413: context reset Input
{
"@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 ] ]
}
}
Example 414: context reset Result
[
{
"@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

Example 415: @graph and @id aliased Input
{
"@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"
}
}
]
}
Example 416: @graph and @id aliased Result
[
{
"@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

Example 417: override default @language Input
{
"@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
]
}
Example 418: override default @language Result
[
{
"@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

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

@graph used under a node is retained

Example 421: do not remove @graph if not at top-level Input
{
"@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"
}
}
]
}
Example 422: do not remove @graph if not at top-level Result
[
{
"@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

Example 423: do not remove @graph at top-level if not only property Input
{
"@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"
}
}
]
}
Example 424: do not remove @graph at top-level if not only property Result
[
{
"@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

Example 425: flatten value with default language Input
{
"@context": {
"term": "http://example.com/term",
"@language": "en"
},
"term": "v"
}
Example 426: flatten value with default language Result
[
{
"@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

Example 427: Flattening list/set with coercion Input
{
"@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"]}
}
Example 428: Flattening list/set with coercion Result
[
{
"@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

Example 429: Multiple contexts Input
{
"@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"
}
Example 430: Multiple contexts Result
[
{
"@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

Example 431: Problematic IRI flattening tests Input
{
"@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", "_"]
}
Example 432: Problematic IRI flattening tests Result
[
{
"@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

Example 433: Term definition with @id: @type Input
{
"@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"
}
]
}
Example 434: Term definition with @id: @type Result
[
{
"@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

Example 435: Duplicate values in @list and @set Input
{
"@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]
}
Example 436: Duplicate values in @list and @set Result
[
{
"@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

Example 437: Use @vocab in properties and @type but not in @id Input
{
"@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" }
}
}
Example 438: Use @vocab in properties and @type but not in @id Result
[
{
"@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

Example 439: Relative IRIs Input
{
"@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"
]
}
Example 440: Relative IRIs Result
[
{
"@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

Example 441: Language maps Input
{
"@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" ]
}
}
Example 442: Language maps Result
[
{
"@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

Example 443: type-coercion of native types Input
{
"@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
}
Example 444: type-coercion of native types Result
[
{
"@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

Example 445: Null term and @vocab Input
{
"@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"
}
Example 446: Null term and @vocab Result
[
{
"@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

Example 447: Using @vocab with with type-coercion Input
{
"@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"
}
Example 448: Using @vocab with with type-coercion Result
[
{
"@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

Example 449: Multiple properties expanding to the same IRI Input
{
"@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
}
Example 450: Multiple properties expanding to the same IRI Result
[
{
"@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

Example 451: Language maps with @vocab, default language, and colliding property Input
{
"@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" }
]
}
Example 452: Language maps with @vocab, default language, and colliding property Result
[
{
"@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

Example 453: Flattening @index Input
{
"@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"
}
]
}
Example 454: Flattening @index Result
[
{
"@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

Example 455: Flattening reverse properties Input
[
{
"@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" } ]
}
]
Example 456: Flattening reverse properties Result
[
{
"@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

Example 457: Flattening blank node labels Input
{
"@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"
}
]
}
Example 458: Flattening blank node labels Result
[
{
"@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

Example 459: Using terms in a reverse-maps Input
[
{
"@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" } ]
}
]
Example 460: Using terms in a reverse-maps Result
[
{
"@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

Example 461: language and index expansion on non-objects Input
{
"@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" }
]
}
Example 462: language and index expansion on non-objects Result
[
{
"@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

Example 463: Free-floating sets and lists Input
{
"@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"
]
}
]
}
Example 464: Free-floating sets and lists Result
[
{
"@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

Example 465: List objects not equivalent Input
{
"@context": {
"test": "http://example.com/list"
},
"@id": "list-equivalence-test",
"test": [
{ "@list": [ "1", "2" ] },
{ "@list": [ "1", "2" ] }
]
}
Example 466: List objects not equivalent Result
[
{
"@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

Example 467: Sample test manifest extract Input
{
"@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"}
}
]}
}
Example 468: Sample test manifest extract Result
[
{
"@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

Example 469: compactArrays option Input
[{
"@id": "http://example/foo",
"http://example/term": [{"@value": "value"}]
}]
Example 470: compactArrays option Result
{
"@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.

Example 471: Blank nodes with reverse properties Input
{
"@context": {
"foo": "http://example.org/foo",
"bar": { "@reverse": "http://example.org/bar", "@type": "@id" }
},
"foo": "Foo",
"bar": [ "http://example.org/origin", "_:b0" ]
}
Example 472: Blank nodes with reverse properties Result
[
{
"@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.

Example 473: load JSON-LD document Input
{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
Example 474: load JSON-LD document Result
[{
"@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.

Example 475: load JSON document Input
{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
Example 476: load JSON document Result
[{
"@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.

Example 477: load JSON document with extension-type Input
{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
Example 478: load JSON document with extension-type Result
[{
"@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

Example 479: loading an unknown type raises loading document failed Input
Example 480: loading an unknown type raises loading document failed Result
n/a
Test 0005: Load JSON-LD through 301 redirect

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

Example 481: Load JSON-LD through 301 redirect Input
{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
Example 482: Load JSON-LD through 301 redirect Result
[{
"@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

Example 483: Load JSON-LD through 303 redirect Input
{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
Example 484: Load JSON-LD through 303 redirect Result
[{
"@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

Example 485: Load JSON-LD through 307 redirect Input
{
"@context": {
"@vocab": "http://example/vocab#"
},
"@id": "",
"term": "object"
}
Example 486: Load JSON-LD through 307 redirect Result
[{
"@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

Example 487: Non-existant file (404) Input
http://json-ld.org/test-suite/tests/remote-doc-0008-in.jsonld not loaded
Example 488: Non-existant file (404) Result
n/a
Test 0009: load JSON-LD document with link

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

Example 489: load JSON-LD document with link Input
[{
"@id": "",
"http://example/0009/term": "value1",
"term": "value2"
}]
Example 490: load JSON-LD document with link Result
[{
"@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.

Example 491: load JSON document with link Input
[{
"@id": "",
"term": "value"
}]
Example 492: load JSON document with link Result
[{
"@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.

Example 493: load JSON document with extension-type with link Input
[{
"@id": "",
"term": "value"
}]
Example 494: load JSON document with extension-type with link Result
[{
"@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

Example 495: Multiple context link headers Input
[{
"@id": "",
"term": "value"
}]
Example 496: Multiple context link headers Result
n/a
Test 0001: Plain literal with URIs

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

Example 497: Plain literal with URIs Input
{
"@id": "http://greggkellogg.net/foaf#me",
"http://xmlns.com/foaf/0.1/name": "Gregg Kellogg"
}
Example 498: Plain literal with URIs Result
<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.

Example 499: Plain literal with CURIE from default context Input
{
"@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:name": "Gregg Kellogg"
}
Example 500: Plain literal with CURIE from default context Result
<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.

Example 501: Default subject is BNode Input
{
"@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
"@type": "foaf:Person"
}
Example 502: Default subject is BNode Result
_: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.

Example 503: Literal with language tag Input
{
"http://www.w3.org/2000/01/rdf-schema#label": {
"@value": "A plain literal with a lang tag.",
"@language": "en-us"
}
}
Example 504: Literal with language tag Result
_: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.

Example 505: Extended character set literal Input
{
"@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"}
}
}
Example 506: Extended character set literal Result
<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.

Example 507: Typed literal Input
{
"@id": "http://greggkellogg.net/foaf#me",
"http://purl.org/dc/terms/created": {
"@value": "1957-02-27",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
}
Example 508: Typed literal Result
<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.

Example 509: Tests 'a' generates rdf:type and object is implicit IRI Input
{
"@id": "http://greggkellogg.net/foaf#me",
"@type": "http://xmlns.com/foaf/0.1/Person"
}
Example 510: Tests 'a' generates rdf:type and object is implicit IRI Result
<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.

Example 511: Test prefix defined in @context Input
{
"@context": {"d": "http://example.com/default#"},
"d:foo": "bar"
}
Example 512: Test prefix defined in @context Result
_:b0 <http://example.com/default#foo> "bar" .
Test 0009: Test using an empty suffix

An empty suffix may be used.

Example 513: Test using an empty suffix Input
{
"@context": {"foo": "http://example.com/default#"},
"foo:": "bar"
}
Example 514: Test using an empty suffix Result
_: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.

Example 515: Test object processing defines object Input
{
"@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"
}
}
Example 516: Test object processing defines object Result
<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.

Example 517: Test object processing defines object with implicit BNode Input
{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": {
"foaf:name": "Dave Longley"
}
}
Example 518: Test object processing defines object with implicit BNode Result
<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.

Example 519: Multiple Objects for a Single Property Input
{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": ["Manu Sporny", "Dave Longley"]
}
Example 520: Multiple Objects for a Single Property Result
<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.

Example 521: Creation of an empty list Input
{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": {"@list": []}
}
Example 522: Creation of an empty list Result
<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.

Example 523: Creation of a list with single element Input
{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": {"@list": ["Manu Sporny"]}
}
Example 524: Creation of a list with single element Result
<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.

Example 525: Creation of a list with multiple elements Input
{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/"
},
"@id": "http://greggkellogg.net/foaf#me",
"foaf:knows": {"@list": ["Manu Sporny", "Dave Longley"]}
}
Example 526: Creation of a list with multiple elements Result
<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.

Example 527: Empty IRI expands to resource location Input
{
"@id": "",
"@type": "http://www.w3.org/2000/01/rdf-schema#Resource"
}
Example 528: Empty IRI expands to resource location Result
<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.

Example 529: Relative IRI expands relative resource location Input
{
"@id": "a/b",
"@type": "http://www.w3.org/2000/01/rdf-schema#Resource"
}
Example 530: Relative IRI expands relative resource location Result
<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.

Example 531: Frag ID expands relative resource location Input
{
"@id": "#frag",
"@type": "http://www.w3.org/2000/01/rdf-schema#Resource"
}
Example 532: Frag ID expands relative resource location Result
<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.

Example 533: Test type coercion to anyURI Input
{
"@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"
}
Example 534: Test type coercion to anyURI Result
<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.

Example 535: Test type coercion to typed literal Input
{
"@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"
}
Example 536: Test type coercion to typed literal Result
<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;.

Example 537: Test coercion of double value Input
{
"@context": { "measure": "http://example/measure#"},
"measure:cups": 5.3
}
Example 538: Test coercion of double value Result
_: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.

Example 539: Test coercion of integer value Input
{
"@context": { "chem": "http://example/chem#"},
"chem:protons": 12
}
Example 540: Test coercion of integer value Result
_: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.

Example 541: Test coercion of boolean value Input
{
"@context": { "sensor": "http://example/sensor#"},
"sensor:active": true
}
Example 542: Test coercion of boolean value Result
_: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.

Example 543: Test list coercion with single element Input
{
"@context": {
"knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@container": "@list"}
},
"@id": "http://greggkellogg.net/foaf#me",
"knows": ["Manu Sporny"]
}
Example 544: Test list coercion with single element Result
<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.

Example 545: Test creation of multiple types Input
{
"@context": {"rdfs": "http://www.w3.org/2000/01/rdf-schema#"},
"@type": ["rdfs:Resource", "rdfs:Class"]
}
Example 546: Test creation of multiple types Result
_: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.

Example 547: Simple named graph (Wikidata) Input
{
"@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/"
}
]
}
Example 548: Simple named graph (Wikidata) Result
<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.

Example 549: Simple named graph Input
{
"@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!"
}
}
Example 550: Simple named graph Result
<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.

Example 551: named graph with embedded named graph Input
{
"@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/"
}
}
Example 552: named graph with embedded named graph Result
<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.

Example 553: top-level graph with string subject reference Input
{
"@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/"
}
]
}
Example 554: top-level graph with string subject reference Result
<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.

Example 555: Reverse property Input
{
"@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"
}
]
}
Example 556: Reverse property Result
<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.

Example 557: @context reordering Input
{
"@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" }
}
}
Example 558: @context reordering Result
<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.

Example 559: @id reordering Input
{
"@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"
}
Example 560: @id reordering Result
<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.

Example 561: context properties reordering Input
{
"@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"
}
}
Example 562: context properties reordering Result
<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

Example 563: non-fractional numbers converted to xsd:double Input
{
"@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 ]
}
Example 564: non-fractional numbers converted to xsd:double Result
_: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

Example 565: Use nodeMapGeneration bnode labels Input
{
"@id": "http://example.com/",
"ex:prop1": {
"@list": [ { "@id": "_:x1" }, { "@id": "_:x2" } ]
},
"ex:prop2": { "@id": "_:x3" }
}
Example 566: Use nodeMapGeneration bnode labels Result
<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

Example 567: drop free-floating nodes Input
{"@id": "http://example.org/test#example"}
Example 568: drop free-floating nodes Result
Test 0042: basic

Basic RDF conversion

Example 569: basic Input
{
"@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]
}
Example 570: basic Result
<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

Example 571: drop null and unmapped properties Input
{
"@id": "http://example.org/id",
"http://example.org/property": null,
"regularJson": {
"nonJsonLd": "property",
"deep": [{
"foo": "bar"
}, {
"bar": "foo"
}]
}
}
Example 572: drop null and unmapped properties Result
Test 0044: optimize @set, keep empty arrays

RDF version of expand-0004

Example 573: optimize @set, keep empty arrays Input
{
"@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" }
}
Example 574: optimize @set, keep empty arrays Result
<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

Example 575: do not expand aliased @id/@type Input
{
"@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"
}
]
}
Example 576: do not expand aliased @id/@type Result
<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

Example 577: alias keywords Input
{
"@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"
}
Example 578: alias keywords Result
<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

Example 579: date type-coercion Input
{
"@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"
}
}
Example 580: date type-coercion Result
<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

Example 581: @value with @language Input
{
"@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" }
}
Example 582: @value with @language Result
<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

Example 583: @graph with terms Input
{
"@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"
}
}
]
}
Example 584: @graph with terms Result
<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

Example 585: native types Input
{
"@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
}
Example 586: native types Result
<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

Example 587: coerced @id Input
{
"@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"
}
Example 588: coerced @id Result
<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

Example 589: @graph with embed Input
{
"@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"
}
}
]
}
Example 590: @graph with embed Result
<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

Example 591: expand already expanded Input
[{
"@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]
}]
Example 592: expand already expanded Result
<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

Example 593: @set of @value objects with keyword aliases Input
{
"@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"
}
Example 594: @set of @value objects with keyword aliases Result
<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

Example 595: collapse set of sets, keep empty lists Input
{
"@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" ] } ]
}
Example 596: collapse set of sets, keep empty lists Result
<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

Example 597: context reset Input
{
"@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 ] ]
}
}
Example 598: context reset Result
<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

Example 599: @graph and @id aliased Input
{
"@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"
}
}
]
}
Example 600: @graph and @id aliased Result
<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

Example 601: override default @language Input
{
"@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
]
}
Example 602: override default @language Result
<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

Example 603: remove @value = null Input
{
"@context": {
"myproperty": "http://example.com/myproperty"
},
"myproperty": { "@value" : null }
}
Example 604: remove @value = null Result
Test 0060: do not remove @graph if not at top-level

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

Example 605: do not remove @graph if not at top-level Input
{
"@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"
}
}
]
}
Example 606: do not remove @graph if not at top-level Result
<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

Example 607: do not remove @graph at top-level if not only property Input
{
"@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"
}
}
]
}
Example 608: do not remove @graph at top-level if not only property Result
<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

Example 609: expand value with default language Input
{
"@context": {
"term": "http://example.com/term",
"@language": "en"
},
"term": "v"
}
Example 610: expand value with default language Result
_:b0 <http://example.com/term> "v"@en .
Test 0063: Lists and sets of properties with list/set coercion

RDF version of expand-0023

Example 611: Lists and sets of properties with list/set coercion Input
{
"@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"]}
}
Example 612: Lists and sets of properties with list/set coercion Result
_: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

Example 613: Multiple contexts Input
{
"@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"
}
Example 614: Multiple contexts Result
<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

Example 615: Problematic IRI expansion tests Input
{
"@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", "_" ]
}
Example 616: Problematic IRI expansion tests Result
_: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

Example 617: Expanding term mapping to @type uses @type syntax Input
{
"@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"
}
]
}
Example 618: Expanding term mapping to @type uses @type syntax Result
<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

Example 619: Keep duplicate values in @list and @set Input
{
"@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]
}
Example 620: Keep duplicate values in @list and @set Result
<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

Example 621: Use @vocab in properties and @type but not in @id Input
{
"@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" }
}
}
Example 622: Use @vocab in properties and @type but not in @id Result
<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

Example 623: Relative IRIs Input
{
"@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"
]
}
Example 624: Relative IRIs Result
<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

Example 625: Language maps Input
{
"@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" ]
}
}
Example 626: Language maps Result
<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

Example 627: type-coercion of native types Input
{
"@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
}
Example 628: type-coercion of native types Result
<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

Example 629: Mapping a term to null decouples it from @vocab Input
{
"@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"
}
Example 630: Mapping a term to null decouples it from @vocab Result
<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

Example 631: Using @vocab with with type-coercion Input
{
"@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"
}
Example 632: Using @vocab with with type-coercion Result
_: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

Example 633: Multiple properties expanding to the same IRI Input
{
"@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
}
Example 634: Multiple properties expanding to the same IRI Result
<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

Example 635: Language maps with @vocab, default language, and colliding property Input
{
"@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" }
]
}
Example 636: Language maps with @vocab, default language, and colliding property Result
<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

Example 637: Expanding @index Input
{
"@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"
}
]
}
Example 638: Expanding @index Result
<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

Example 639: Expanding @reverse Input
{
"@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"
}
}
}
Example 640: Expanding @reverse Result
<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.

Example 641: Drop blank node predicates by default Input
{
"@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"
}
]
}
Example 642: Drop blank node predicates by default Result
_: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

Example 643: Using terms in a reverse-maps Input
{
"@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"
}
}
}
Example 644: Using terms in a reverse-maps Result
<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

Example 645: language and index expansion on non-objects Input
{
"@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" }
]
}
Example 646: language and index expansion on non-objects Result
<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

Example 647: Reset the default language Input
{
"@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"
}
}
Example 648: Reset the default language Result
_: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

Example 649: Expanding reverse properties Input
{
"@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"
}
}
Example 650: Expanding reverse properties Result
<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

Example 651: Using reverse properties inside a @reverse-container Input
{
"@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"
}
]
}
}
Example 652: Using reverse properties inside a @reverse-container Result
<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

Example 653: Ensure index maps use language mapping Input
{
"@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"
]
}
Example 654: Ensure index maps use language mapping Result
<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

Example 655: Top-level value objects are removed Input
{
"@value": "free-floating value"
}
Example 656: Top-level value objects are removed Result
Test 0086: Free-floating nodes are removed

RDF version of expand-0046

Example 657: Free-floating nodes are removed Input
{
"@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
]
}
Example 658: Free-floating nodes are removed Result
Test 0087: Remove free-floating set values and lists

RDF version of expand-0047

Example 659: Remove free-floating set values and lists Input
{
"@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"
}
]
}
]
}
Example 660: Remove free-floating set values and lists Result
<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

Example 661: Terms are ignored in @id Input
{
"@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"
}
]
}
Example 662: Terms are ignored in @id Result
<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

Example 663: Using strings as value of a reverse property Input
{
"@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"
]
}
Example 664: Using strings as value of a reverse property Result
<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

Example 665: Term definitions with prefix separate from prefix definitions Input
{
"@context": {
"issue": { "@id": "http://example.com/issue/", "@type": "@id" },
"issue:raisedBy": { "@container": "@set" }
},
"issue": "/issue/1",
"issue:raisedBy": "Markus"
}
Example 666: Term definitions with prefix separate from prefix definitions Result
_: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

Example 667: Expansion of keyword aliases in term definitions Input
{
"@context": [
{ "id": "@id" },
{ "url": "id" }
],
"url": "/issue/1",
"http://example.com/property": "ok"
}
Example 668: Expansion of keyword aliases in term definitions Result
<http://json-ld.org/issue/1> <http://example.com/property> "ok" .
Test 0092: @vocab-relative IRIs in term definitions

RDF version of expand-0052

Example 669: @vocab-relative IRIs in term definitions Input
{
"@context": {
"@vocab": "http://example.org/",
"property": "vocabRelativeProperty"
},
"property": "must expand to http://example.org/vocabRelativeProperty",
"http://example.org/property": "ok"
}
Example 670: @vocab-relative IRIs in term definitions Result
_: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

Example 671: Expand absolute IRI with @type: @vocab Input
{
"@context": {
"term": {"@id": "http://example.org/term", "@type": "@vocab"}
},
"term": "http://example.org/enum"
}
Example 672: Expand absolute IRI with @type: @vocab Result
_:b0 <http://example.org/term> <http://example.org/enum> .
Test 0094: Expand term with @type: @vocab

RDF version of expand-0054

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

RDF version of expand-0055

Example 675: Expand @vocab-relative term with @type: @vocab Input
{
"@context": {
"@vocab": "http://example.org/",
"term": {"@id": "http://example.org/term", "@type": "@vocab"}
},
"term": "enum"
}
Example 676: Expand @vocab-relative term with @type: @vocab Result
_: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

Example 677: Use terms with @type: @vocab but not with @type: @id Input
{
"@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"
}
Example 678: Use terms with @type: @vocab but not with @type: @id Result
<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

Example 679: Expand relative IRI with @type: @vocab Input
{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" }
},
"term": "not-a-term-thus-a-relative-IRI"
}
Example 680: Expand relative IRI with @type: @vocab Result
_: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

Example 681: Expand compact IRI with @type: @vocab Input
{
"@context": {
"term": { "@id": "http://example.org/term", "@type": "@vocab" },
"prefix": "http://example.com/vocab#"
},
"term": "prefix:suffix"
}
Example 682: Expand compact IRI with @type: @vocab Result
_:b0 <http://example.org/term> <http://example.com/vocab#suffix> .
Test 0099: Reset @vocab by setting it to null

RDF version of expand-0059

Example 683: Reset @vocab by setting it to null Input
{
"@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"
}
}
Example 684: Reset @vocab by setting it to null Result
<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

Example 685: Overwrite document base with @base and reset it again Input
{
"@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"
}
]
}
}
Example 686: Overwrite document base with @base and reset it again Result
<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

Example 687: Coercing native types to arbitrary datatypes Input
{
"@context": {
"property": {
"@id": "http://example.com/property",
"@type": "http://example.com/datatype"
}
},
"property": [ 1, true, false, 5.1 ]
}
Example 688: Coercing native types to arbitrary datatypes Result
_: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

Example 689: Various relative IRIs with with @base Input
{
"@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"
]
}
Example 690: Various relative IRIs with with @base Result
<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

Example 691: Expand a reverse property with an index-container Input
{
"@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"
}
}
}
Example 692: Expand a reverse property with an index-container Result
<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

Example 693: Expand reverse property whose values are unlabeled blank nodes Input
{
"@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"
}
]
}
Example 694: Expand reverse property whose values are unlabeled blank nodes Result
<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

Example 695: Keys that are not mapped to an IRI in a reverse-map are dropped Input
{
"@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"
}
}
}
Example 696: Keys that are not mapped to an IRI in a reverse-map are dropped Result
<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

Example 697: Use @vocab to expand keys in reverse-maps Input
{
"@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"
}
}
}
Example 698: Use @vocab to expand keys in reverse-maps Result
<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

Example 699: prefix:://sufffix not a compact IRI Input
{
"@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"
}
Example 700: prefix:://sufffix not a compact IRI Result
<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

Example 701: _::sufffix not a compact IRI Input
{
"@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"
}
Example 702: _::sufffix not a compact IRI Result
_: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

Example 703: Compact IRI as term with type mapping Input
{
"@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"
}
Example 704: Compact IRI as term with type mapping Result
<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

Example 705: Redefine compact IRI with itself Input
{
"@context": {
"prefix": "http://www.example.org/vocab#",
"prefix:foo": "prefix:foo"
},
"@id": "http://example.com/vocab#id",
"@type": "prefix:Class",
"prefix:foo": "bar"
}
Example 706: Redefine compact IRI with itself Result
<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

Example 707: Redefine terms looking like compact IRIs Input
{
"@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"
}
Example 708: Redefine terms looking like compact IRIs Result
_: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

Example 709: Redefine term using @vocab, not itself Input
{
"@context": [
{
"v": "http://example.com/vocab#",
"term": "v:somethingElse"
},
{
"@vocab": "http://example.com/anotherVocab#",
"term": "term"
}
],
"term": "value of term"
}
Example 710: Redefine term using @vocab, not itself Result
_: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

Example 711: Dataset with a IRI named graph Input
{
"@id": "http://example/g",
"@graph": {
"@id": "http://example/s",
"http://example/p": {"@id": "http://example/o"}
}
}
Example 712: Dataset with a IRI named graph Result
<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

Example 713: Dataset with a IRI named graph Input
{
"@id": "_:g",
"@graph": {
"@id": "http://example/s",
"http://example/p": {"@id": "http://example/o"}
}
}
Example 714: Dataset with a IRI named graph Result
<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)

Example 715: Dataset with a default and two named graphs Input
{
"@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"}
}
}]
}
Example 716: Dataset with a default and two named graphs Result
<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

Example 717: Dataset from node with embedded named graph Input
{
"@id": "http://example/s0",
"http://example/p0": {"@id": "http://example/o0"},
"@graph": {
"@id": "http://example/s1",
"http://example/p1": {"@id": "http://example/o1"}
}
}
Example 718: Dataset from node with embedded named graph Result
<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

Example 719: Dataset from node with embedded named graph (bnode) Input
{
"http://example/p0": {"@id": "http://example/o0"},
"@graph": {
"@id": "http://example/s1",
"http://example/p1": {"@id": "http://example/o1"}
}
}
Example 720: Dataset from node with embedded named graph (bnode) Result
<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.

Example 721: produce generalized RDF flag Input
{
"@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"
}
]
}
Example 722: produce generalized RDF flag Result
_: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.

Example 723: Blank nodes with reverse properties Input
{
"@context": {
"foo": "http://example.org/foo",
"bar": { "@reverse": "http://example.org/bar", "@type": "@id" }
},
"foo": "Foo",
"bar": [ "http://example.org/origin", "_:b0" ]
}
Example 724: Blank nodes with reverse properties Result
<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.

Example 725: Object Lists Input
<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 .
Example 726: Object Lists Result
[
{
"@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.

Example 727: Native Types Input
<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> .
Example 728: Native Types Result
[
{
"@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.

Example 729: BNodes and references Input
<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> .
Example 730: BNodes and references Result
[
{
"@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.

Example 731: Lists Input
<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 .
Example 732: Lists Result
[
{
"@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.

Example 733: Document with list Input
<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" .
Example 734: Document with list Result
[
{
"@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.

Example 735: Two graphs having same subject but different values Input
<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> .
Example 736: Two graphs having same subject but different values Result
[
{
"@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.

Example 737: Graph with multiple named graphs Input
<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> .
Example 738: Graph with multiple named graphs Result
[
{
"@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

Example 739: List conversion Input
<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> .
Example 740: List conversion Result
[
{
"@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

Example 741: List conversion with IRI nodes Input
<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> .
Example 742: List conversion with IRI nodes Result
[
{
"@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.

Example 743: List pattern without rdf:nil Input
<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" .
Example 744: List pattern without rdf:nil Result
[
{
"@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.

Example 745: List pattern with extra properties Input
<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> .
Example 746: List pattern with extra properties Result
[
{
"@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.

Example 747: List pattern with cycles Input
<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 .
Example 748: List pattern with cycles Result
[
{
"@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.

Example 749: List pattern with multiple values of rdf:first Input
<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> .
Example 750: List pattern with multiple values of rdf:first Result
[
{
"@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.

Example 751: List pattern with multiple values of rdf:rest Input
<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> .
Example 752: List pattern with multiple values of rdf:rest Result
[
{
"@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.

Example 753: List pattern with IRI rdf:rest Input
<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" .
Example 754: List pattern with IRI rdf:rest Result
[
{
"@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.

Example 755: List pattern with type rdf:List Input
<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> .
Example 756: List pattern with type rdf:List Result
[
{
"@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

Example 757: Remove duplicate triples Input
<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> .
Example 758: Remove duplicate triples Result
[
{
"@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

Example 759: use native types flag set to true Input
<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> .
Example 760: use native types flag set to true Result
[
{
"@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

Example 761: use rdf:type flag set to false Input
<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 .
Example 762: use rdf:type flag set to false Result
[
{
"@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"}
]
}
]

D. Report Generation Software

This report generated by earl-report version 0.2.7.2 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.

E. References

E.1 Informative references

[JSON-LD]
Manu Sporny, Gregg Kellogg, Markus Lanthaler, Editors. JSON-LD 1.0. 16 January 2014. W3C Recommendation. URL: http://www.w3.org/TR/json-ld/
[JSON-LD-API]
Markus Lanthaler, Gregg Kellogg, Manu Sporny, Editors. JSON-LD 1.0 Processing Algorithms and API. 16 January 2014. W3C Recommendation. URL: http://www.w3.org/TR/json-ld-api/
[JSON-LD-TESTS]
JSON-LD 1.0 Test Suite. W3C Test Suite. URL: http://www.w3.org/2013/json-ld-tests/