NamedGraphHandling enum

Defines how to handle named graphs when decoding JSON-LD to RdfGraph

Since RdfGraph does not support named graphs (only RdfDataset does), this enum controls what happens when the JSON-LD document contains named graphs.

Inheritance
Available extensions

Values

strict → const NamedGraphHandling

Throw an exception if any named graphs are encountered

This is the safest default mode as it prevents silent data loss or misinterpretation. Use this when you need to ensure you're only working with simple graphs without named graph structures.

Example:

final decoder = JsonLdGraphDecoder(
  options: JsonLdGraphDecoderOptions(
    namedGraphHandling: NamedGraphHandling.strict,
  ),
);
// Will throw RdfDecoderException if named graphs are present
ignoreNamedGraphs → const NamedGraphHandling

Ignore named graphs and only return the default graph

When named graphs are present, they are silently ignored and only triples from the default graph are returned. This is useful when you know the document might contain named graphs but you only care about the default graph content.

By default, this logs at fine (debug) level when named graphs are ignored.

Example:

final decoder = JsonLdGraphDecoder(
  options: JsonLdGraphDecoderOptions(
    namedGraphHandling: NamedGraphHandling.ignoreNamedGraphs,
  ),
);
// Named graphs will be silently ignored
mergeIntoDefault → const NamedGraphHandling

Merge all triples from named graphs into the default graph

All triples from all named graphs are merged into the default graph, losing the graph name information but preserving all triple data. This is semantically valid in RDF - you're just losing the graph boundary context.

By default, this logs at warning level as it represents a significant semantic change (loss of graph boundaries).

Example:

final decoder = JsonLdGraphDecoder(
  options: JsonLdGraphDecoderOptions(
    namedGraphHandling: NamedGraphHandling.mergeIntoDefault,
  ),
);
// All triples from all graphs will be merged together

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Constants

values → const List<NamedGraphHandling>
A constant List of the values in this enum, in order of their declaration.