JsonLdGraphDecoder class
Decoder for JSON-LD format
Adapter that bridges the RdfDecoder base class to the implementation-specific JsonLdParser. This class is responsible for:
- Adapting the RDF Core decoder interface to the JSON-LD parser
- Converting parsed triples into an RdfGraph
- Managing configuration options for the parsing process
- 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:
- NamedGraphHandling.strict: Throws an exception if named graphs are present
- NamedGraphHandling.ignoreNamedGraphs: Returns only the default graph
- NamedGraphHandling.mergeIntoDefault: Merges all graphs into one
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);
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
thiswithother.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