JsonLdEncoderOptions class

Configuration options for JSON-LD encoding

This class provides configuration options for customizing the behavior of the JSON-LD encoder. It extends the base RDF encoder options to add JSON-LD specific functionality.

Currently, the main customization is the ability to provide custom prefixes for the JSON-LD context, allowing for more readable and application-specific compact IRIs in the output.

Potential future options might include:

  • Control over formatting (compact vs. expanded form)
  • Custom handling of complex datatypes
  • Options for including/excluding @context
  • Named graph serialization settings

Example usage:

final options = JsonLdEncoderOptions(
  customPrefixes: {
    'ex': 'http://example.org/',
    'app': 'http://myapp.com/terms#'
  }
);

final encoder = JsonLdEncoder(options: options);
Inheritance

Constructors

JsonLdEncoderOptions.new({Map<String, String> customPrefixes = const {}, bool generateMissingPrefixes = true, bool includeBaseDeclaration = true})
Creates a new JSON-LD encoder options object
const

Properties

customPrefixes Map<String, String>
Custom namespace prefixes to use during encoding.
finalinherited
generateMissingPrefixes bool
Controls automatic generation of namespace prefixes for IRIs without matching prefixes.
final
hashCode int
The hash code for this object.
no setterinherited
includeBaseDeclaration bool
Whether to include base URI declarations in the output
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({Map<String, String>? customPrefixes, bool? generateMissingPrefixes, bool? includeBaseDeclaration}) JsonLdEncoderOptions
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

from(RdfGraphEncoderOptions options) JsonLdEncoderOptions
Creates a JSON-LD encoder options object from generic RDF encoder options