RdfDatasetCodec class abstract
Represents a dataset codec that can be handled by the RDF framework.
A dataset codec plugin encapsulates all the logic needed to work with a specific RDF dataset serialization format (like N-Quads, TriG, JSON-LD datasets, etc.). It provides both decoding and encoding capabilities for the format.
To add support for a new RDF dataset format, implement this interface and register an instance with the RdfDatasetCodecRegistry.
Example of implementing a new dataset format:
class MyCustomDatasetCodec implements RdfDatasetCodec {
@override
String get primaryMimeType => 'application/x-custom-dataset';
@override
Set<String> get supportedMimeTypes => {primaryMimeType};
@override
RdfDatasetDecoder get decoder => MyCustomDatasetDecoder();
@override
RdfDatasetEncoder get encoder => MyCustomDatasetEncoder();
@override
bool canParse(String content) {
// Check if the content appears to be in this dataset format
return content.contains('CUSTOM-DATASET-FORMAT');
}
@override
RdfDatasetCodec withOptions({
RdfDatasetEncoderOptions? encoder,
RdfDatasetDecoderOptions? decoder,
}) => this;
}
- Inheritance
-
- Object
- Codec<
RdfDataset, String> - RdfCodec<
RdfDataset> - RdfDatasetCodec
- Implementers
Constructors
- RdfDatasetCodec.new()
-
Creates a new codec instance with default settings
const
Properties
- decoder → RdfDatasetDecoder
-
Creates a decoder instance for this codec
no setteroverride
- encoder → RdfDatasetEncoder
-
Creates an encoder instance for this codec
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
-
inverted
→ Codec<
String, RdfDataset> -
Inverts
this
.no setterinherited - primaryMimeType → String
-
The primary MIME type for this codec
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
supportedMimeTypes
→ Set<
String> -
All MIME types supported by this codec
no setterinherited
Methods
-
canParse(
String content) → bool -
Tests if the provided content is likely in this codec's format
inherited
-
decode(
String input, {String? documentUrl, RdfGraphDecoderOptions? options}) → RdfDataset -
Decodes a string containing RDF data into an RDF graph
inherited
-
encode(
RdfDataset input, {String? baseUri, RdfGraphEncoderOptions? options}) → String -
Encodes an RDF graph to a string representation in this codec
inherited
-
fuse<
R> (Codec< String, R> other) → Codec<RdfDataset, R> -
Fuses
this
withother
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withOptions(
{RdfGraphEncoderOptions? encoder, RdfGraphDecoderOptions? decoder}) → RdfDatasetCodec -
Creates a new codec instance with the specified options
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited