TurtleEncoder constructor

TurtleEncoder({
  1. RdfNamespaceMappings? namespaceMappings,
  2. TurtleEncoderOptions options = const TurtleEncoderOptions(),
})

Creates a new Turtle encoder with the specified options.

Parameters:

  • namespaceMappings Optional custom namespace mappings to use for resolving prefixes. If not provided, default RDF namespace mappings are used.
  • options Configuration options that control encoding behavior. Default options include automatic prefix generation.

Example:

// Create an encoder with custom options
final encoder = TurtleEncoder(
  namespaceMappings: extendedNamespaces,
  options: TurtleEncoderOptions(generateMissingPrefixes: false)
);

Implementation

TurtleEncoder({
  RdfNamespaceMappings? namespaceMappings,
  TurtleEncoderOptions options = const TurtleEncoderOptions(),
}) : _options = options,
     // Use default namespace mappings if none provided
     _namespaceMappings = namespaceMappings ?? RdfNamespaceMappings();