convert method

  1. @override
RdfDataset convert(
  1. String input, {
  2. String? documentUrl,
})
override

Decodes a TriG document into an RDF dataset

This method parses a string containing TriG syntax into an RDF dataset structure with support for named graphs. It delegates to the internal TriGParser implementation to handle the actual parsing.

Parameters:

  • input The TriG document to decode as a string.
  • documentUrl Optional base URI for the document, used for resolving relative IRIs in the TriG content. If not provided, relative IRIs will result in an error unless there's a @base directive in the content.

Returns:

  • An RdfDataset containing the parsed quads organized into default and named graphs.

Throws:

Implementation

@override
RdfDataset convert(String input, {String? documentUrl}) {
  final parser = TriGParser(
    input,
    baseUri: documentUrl,
    parsingFlags: _options.parsingFlags,
    namespaceMappings: _namespaceMappings,
    iriTermFactory: _iriTermFactory,
    format: _format,
  );
  return RdfDataset.fromQuads(parser.parse());
}