5.7 Syntax Utilities

enum SerdSyntax

Syntax supported by serd.

enumerator SERD_SYNTAX_EMPTY

Empty syntax.

enumerator SERD_TURTLE

Terse triples http://www.w3.org/TR/turtle.

enumerator SERD_NTRIPLES

Flat triples http://www.w3.org/TR/n-triples/.

enumerator SERD_NQUADS

Flat quads http://www.w3.org/TR/n-quads/.

enumerator SERD_TRIG

Terse quads http://www.w3.org/TR/trig/.

SerdSyntax serd_syntax_by_name(const char *name)

Get a syntax by name.

Case-insensitive, supports “Turtle”, “NTriples”, “NQuads”, and “TriG”.

Returns

The syntax with the given name, or the empty syntax if the name is unknown.

SerdSyntax serd_guess_syntax(const char *filename)

Guess a syntax from a filename.

This uses the file extension to guess the syntax of a file, for example a filename that ends with “.ttl” will be considered Turtle.

Returns

The likely syntax of the given file, or the empty syntax if the extension is unknown.

bool serd_syntax_has_graphs(SerdSyntax syntax)

Return whether a syntax can represent multiple graphs in one document.

Returns

True for SerdSyntax.SERD_NQUADS and SerdSyntax.SERD_TRIG, false otherwise.