decode method

RdfGraph decode(
  1. String content, {
  2. String? contentType,
  3. String? documentUrl,
  4. RdfGraphDecoderOptions? options,
})

Decode RDF content to create a graph

Converts a string containing serialized RDF data into an in-memory RDF graph. The format can be explicitly specified using the contentType parameter, or automatically detected from the content if not specified.

The content parameter is the RDF content to parse as a string.

The contentType parameter is an optional MIME type to specify the format (e.g., "text/turtle").

The documentUrl parameter is an optional base URI for resolving relative references in the document.

The options parameter contains optional format-specific decoder options (e.g., TurtleDecoderOptions).

Returns an RdfGraph containing the parsed triples.

Throws codec-specific exceptions for parsing errors. Throws CodecNotSupportedException if the codec is not supported and cannot be detected.

Implementation

RdfGraph decode(
  String content, {
  String? contentType,
  String? documentUrl,
  RdfGraphDecoderOptions? options,
}) => codec(
  contentType: contentType,
  decoderOptions: options,
).decode(content, documentUrl: documentUrl);