convert method
override
Decodes an RDF document and returns an RDF graph
This method transforms a textual RDF document into a structured RdfGraph
object
containing triples parsed from the input. It implements the convert
method
from the Converter
interface.
Parameters:
input
The RDF document to decode, as a string.documentUrl
The absolute URL of the document, used for resolving relative IRIs. If not provided, relative IRIs will be kept as-is or handled according to format-specific rules.
Returns:
- An RdfGraph containing the triples parsed from the input.
The specific decoding behavior depends on the implementation of this interface, which will handle format-specific details like prefix resolution, blank node handling, etc.
May throw format-specific parsing exceptions if the input is malformed.
Implementation
@override
RdfGraph convert(String input, {String? documentUrl}) {
final dataset = _decoder.convert(input, documentUrl: documentUrl);
if (dataset.namedGraphs.isNotEmpty) {
_logger.warning(
'N-Triples document contains named graphs, which will be ignored. Only the default graph will be returned.');
}
return dataset.defaultGraph;
}