encodeDataset method
- RdfDataset dataset, {
- String? contentType,
- String? baseUri,
- RdfGraphEncoderOptions? options,
Encode an RDF dataset to a string representation
Converts an in-memory RDF dataset into a serialized string representation in the specified format. If no format is specified, the default dataset codec is used.
The dataset
parameter is the RDF dataset to encode.
The contentType
parameter is an optional MIME type to specify the output format.
The baseUri
parameter is an optional base URI for the serialized output, which may enable
more compact representations with relative URIs.
The options
parameter contains optional format-specific encoder options.
Returns a string containing the serialized RDF dataset data.
Throws CodecNotSupportedException if the requested codec is not supported. Throws codec-specific exceptions for serialization errors.
Implementation
String encodeDataset(
RdfDataset dataset, {
String? contentType,
String? baseUri,
RdfGraphEncoderOptions? options,
}) =>
datasetCodec(
contentType: contentType,
encoderOptions: options,
).encode(dataset, baseUri: baseUri);