NTriplesCodec class final

Format definition for the N-Triples RDF serialization format.

N-Triples is a line-based, plain text RDF serialization format defined by the W3C. It is a simplified subset of Turtle, where each line represents exactly one triple statement. N-Triples is designed to be simple to parse and generate.

The format is specified in the RDF 1.1 N-Triples W3C Recommendation.

N-Triples characteristics:

  • Each line contains exactly one triple statement
  • No abbreviations or prefixes are supported
  • Everything is written out explicitly, making it verbose but simple
  • All IRIs are enclosed in angle brackets
  • The format is line-based, making it easy to process with standard text tools

Example N-Triples document:

<http://example.org/subject> <http://example.org/predicate> <http://example.org/object> .
<http://example.org/subject> <http://example.org/predicate> "Literal value" .
<http://example.org/subject> <http://example.org/predicate> "Value"@en .
Inheritance

Constructors

NTriplesCodec({NTriplesEncoderOptions encoderOptions = const NTriplesEncoderOptions(), NTriplesDecoderOptions decoderOptions = const NTriplesDecoderOptions()})
Creates a new N-Triples format definition
const

Properties

decoder RdfGraphDecoder
Returns a decoder configured with the current decoder options
no setteroverride
encoder RdfGraphEncoder
Returns an encoder configured with the current encoder options
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
inverted Codec<String, RdfGraph>
Inverts this.
no setterinherited
primaryMimeType String
Returns the primary MIME type for N-Triples: 'application/n-triples'
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportedMimeTypes Set<String>
Returns the set of all supported MIME types for N-Triples
no setteroverride

Methods

canParse(String content) bool
Determines if the given content is likely in N-Triples format.
override
decode(String input, {String? documentUrl, RdfGraphDecoderOptions? options}) RdfGraph
Decodes a string containing RDF data into an RDF graph
inherited
encode(RdfGraph 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<RdfGraph, R>
Fuses this with other.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a string representation of this codec
override
withOptions({RdfGraphEncoderOptions? encoder, RdfGraphDecoderOptions? decoder}) NTriplesCodec
Creates a new codec instance with the specified options
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

alternativeMimeTypes → const List<String>
The additional MIME types that should be recognized as N-Triples
fileExtensions → const List<String>
The file extensions associated with N-Triples files