compactionContext property

Object? compactionContext
final

Optional compaction context for JsonLdOutputMode.compact and JsonLdOutputMode.flattened.

When provided, the encoder first produces expanded JSON-LD via the W3C "Serialize RDF as JSON-LD" (fromRdf) algorithm, then compacts it using the W3C JSON-LD 1.1 Compaction Algorithm with this context.

The value should be a JSON-LD context document (a Map with @context key, or just the context value itself).

When null (default), the encoder uses the built-in prefix-based compaction which auto-generates a context from namespace mappings.

Has no effect in JsonLdOutputMode.expanded.

Implementation

final Object? compactionContext;