generateMissingPrefixes property

bool generateMissingPrefixes
final

Controls automatic generation of namespace prefixes for IRIs without matching prefixes.

When set to true (default), the encoder will automatically generate namespace prefixes for IRIs that don't have a matching prefix in either the custom prefixes or the standard namespace mappings.

The prefix generation process:

  1. Attempts to extract a meaningful namespace from the IRI (splitting at '/' or '#')
  2. Skips IRIs with only protocol specifiers (e.g., "http://")
  3. Only generates prefixes for namespaces ending with '/' or '#' (proper RDF namespace delimiters)
  4. Uses RdfNamespaceMappings.getOrGeneratePrefix to create a compact, unique prefix

Setting this to false will result in all IRIs without matching prefixes being written as full IRIs in the JSON-LD output.

Applies to JsonLdOutputMode.compact and JsonLdOutputMode.flattened. Has no effect in JsonLdOutputMode.expanded (which has no @context).

Implementation

final bool generateMissingPrefixes;