useNumericLocalNames property

bool useNumericLocalNames
final

Controls whether local names that start with a digit are written using prefix notation.

According to the Turtle specification, local names that begin with a digit cannot be written directly in the prefixed notation, as this would produce invalid Turtle syntax.

When set to true, the encoder will use prefixed notation for IRIs with local names that start with digits. This requires each of these local names to be escaped properly and is not recommended by default.

When set to false (default), the encoder will always write IRIs with local names that start with a digit as full IRIs in angle brackets, regardless of whether a matching prefix exists.

For example, with this option set to false:

  • The IRI http://example.org/123 will be written as <http://example.org/123> even if the prefix ex: is defined for http://example.org/

This behavior ensures compliant Turtle output and improves readability while avoiding potential syntax errors.

Implementation

final bool useNumericLocalNames;