JsonLdGraphDecoder class

Decoder for JSON-LD format

Adapter that bridges the RdfDecoder base class to the implementation-specific JsonLdParser. This class is responsible for:

  1. Adapting the RDF Core decoder interface to the JSON-LD parser
  2. Converting parsed triples into an RdfGraph
  3. Managing configuration options for the parsing process
  4. Handling named graphs according to the configured mode

The decoder creates an RDF Graph from the JSON-LD input. How named graphs are handled depends on the JsonLdGraphDecoderOptions.namedGraphHandling setting:

Example usage:

// Strict mode (default)
final decoder = JsonLdGraphDecoder();
final graph = decoder.convert(jsonLdString); // throws if named graphs present

// Merge mode
final mergeDecoder = JsonLdGraphDecoder(
  options: JsonLdGraphDecoderOptions(
    namedGraphHandling: NamedGraphHandling.mergeIntoDefault,
  ),
);
final mergedGraph = mergeDecoder.convert(jsonLdString);
Inheritance

Constructors

JsonLdGraphDecoder({JsonLdGraphDecoderOptions options = const JsonLdGraphDecoderOptions(), IriTermFactory iriTermFactory = IriTerm.validated})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bind(Stream<String> stream) Stream<RdfGraph>
Transforms the provided stream.
inherited
cast<RS, RT>() Converter<RS, RT>
Provides a Converter<RS, RT> view of this stream transformer.
inherited
convert(String input, {String? documentUrl}) → RdfGraph
Decodes an RDF document and returns an RDF graph
fuse<TT>(Converter<RdfGraph, TT> other) Converter<String, TT>
Fuses this with other.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startChunkedConversion(Sink<RdfGraph> sink) Sink<String>
Starts a chunked conversion.
inherited
toString() String
A string representation of this object.
inherited
withOptions(RdfGraphDecoderOptions options) → RdfGraphDecoder
Creates a new decoder with the specified options

Operators

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