generateMissingPrefixes property
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:
- Attempts to extract a meaningful namespace from the IRI (splitting at '/' or '#')
- Skips IRIs with only protocol specifiers (e.g., "http://")
- Only generates prefixes for namespaces ending with '/' or '#' (proper RDF namespace delimiters)
- 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 angle brackets (e.g., <http://example.org/term>
).
This option is particularly useful for:
- Reducing the verbosity of the Turtle output
- Making the serialized data more human-readable
- Automatically handling unknown namespaces without manual prefix declaration
Implementation
final bool generateMissingPrefixes;