2 Serd C API — Serd 0.32.10 documentation

# 2 Serd C API

- 2.1 Status Codes
  - `SerdStatus`
    - `SERD_SUCCESS`
    - `SERD_FAILURE`
    - `SERD_ERR_UNKNOWN`
    - `SERD_ERR_BAD_SYNTAX`
    - `SERD_ERR_BAD_ARG`
    - `SERD_ERR_NOT_FOUND`
    - `SERD_ERR_ID_CLASH`
    - `SERD_ERR_BAD_CURIE`
    - `SERD_ERR_INTERNAL`
    - `SERD_ERR_BAD_WRITE`
    - `SERD_ERR_BAD_TEXT`
  - `serd_strerror()`
- 2.2 String Utilities
  - `serd_base64_decode()`
  - `serd_strlen()`
  - `serd_strtod()`
- 2.3 Byte Streams
  - `SerdSink`
  - `SerdSource`
  - `SerdStreamErrorFunc`
- 2.4 URI
  - `SerdURI`
    - `scheme`
    - `authority`
    - `path_base`
    - `path`
    - `query`
    - `fragment`
  - `serd_file_uri_parse()`
  - `serd_uri_parse()`
  - `serd_uri_resolve()`
  - `serd_uri_serialise()`
  - `serd_uri_serialise_relative()`
  - `serd_uri_string_has_scheme()`
- 2.5 Node
  - `SerdType`
    - `SERD_NOTHING`
    - `SERD_LITERAL`
    - `SERD_URI`
    - `SERD_CURIE`
    - `SERD_BLANK`
  - `SerdNode`
    - `buf`
    - `n_bytes`
    - `n_chars`
    - `flags`
    - `type`
  - `serd_node_copy()`
  - `serd_node_equals()`
  - `serd_node_free()`
  - `serd_node_from_string()`
  - `serd_node_from_substring()`
  - `serd_node_new_blob()`
  - `serd_node_new_decimal()`
  - `serd_node_new_file_uri()`
  - `serd_node_new_integer()`
  - `serd_node_new_relative_uri()`
  - `serd_node_new_uri()`
  - `serd_node_new_uri_from_node()`
  - `serd_node_new_uri_from_string()`
- 2.6 Event Handlers
  - `SerdBaseSink`
  - `SerdEndSink`
  - `SerdErrorSink`
  - `SerdPrefixSink`
  - `SerdStatementFlags`
  - `SerdStatementSink`
  - `SerdStatementFlag`
    - `SERD_EMPTY_S`
    - `SERD_EMPTY_O`
    - `SERD_ANON_S_BEGIN`
    - `SERD_ANON_O_BEGIN`
    - `SERD_ANON_CONT`
    - `SERD_LIST_S_BEGIN`
    - `SERD_LIST_O_BEGIN`
    - `SERD_LIST_CONT`
  - `SerdError`
    - `status`
    - `filename`
    - `line`
    - `col`
    - `fmt`
    - `args`
- 2.7 Environment
  - `SerdEnv`
  - `serd_env_expand()`
  - `serd_env_expand_node()`
  - `serd_env_foreach()`
  - `serd_env_free()`
  - `serd_env_get_base_uri()`
  - `serd_env_new()`
  - `serd_env_qualify()`
  - `serd_env_set_base_uri()`
  - `serd_env_set_prefix()`
  - `serd_env_set_prefix_from_strings()`
- 2.8 Reader
  - `SerdReader`
  - `serd_reader_add_blank_prefix()`
  - `serd_reader_end_stream()`
  - `serd_reader_free()`
  - `serd_reader_get_handle()`
  - `serd_reader_new()`
  - `serd_reader_read_chunk()`
  - `serd_reader_read_file()`
  - `serd_reader_read_file_handle()`
  - `serd_reader_read_source()`
  - `serd_reader_read_string()`
  - `serd_reader_set_default_graph()`
  - `serd_reader_set_error_sink()`
  - `serd_reader_set_strict()`
  - `serd_reader_skip_until_byte()`
  - `serd_reader_start_source_stream()`
  - `serd_reader_start_stream()`
- 2.9 Writer
  - `SerdWriter`
  - `SerdStyle`
    - `SERD_STYLE_ABBREVIATED`
    - `SERD_STYLE_ASCII`
    - `SERD_STYLE_RESOLVED`
    - `SERD_STYLE_CURIED`
    - `SERD_STYLE_BULK`
    - `SERD_STYLE_STRICT`
  - `serd_chunk_sink()`
  - `serd_chunk_sink_finish()`
  - `serd_file_sink()`
  - `serd_writer_chop_blank_prefix()`
  - `serd_writer_end_anon()`
  - `serd_writer_finish()`
  - `serd_writer_free()`
  - `serd_writer_get_env()`
  - `serd_writer_new()`
  - `serd_writer_set_base_uri()`
  - `serd_writer_set_error_sink()`
  - `serd_writer_set_prefix()`
  - `serd_writer_set_root_uri()`
  - `serd_writer_write_statement()`

typedef uint32_t SerdNodeFlags

  Bitwise OR of `SerdNodeFlag` values.

enum SerdNodeFlag

  Flags indicating certain string properties relevant to serialisation.

  enumerator SERD_HAS_NEWLINE

    Contains line breaks (’n’ or ‘r’).

  enumerator SERD_HAS_QUOTE

    Contains quotes (‘”’).

enum SerdSyntax

  RDF syntax type.

  enumerator SERD_TURTLE

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

  enumerator SERD_NTRIPLES

    Line-based triples http://www.w3.org/TR/n-triples/.

  enumerator SERD_NQUADS

    Line-based quads http://www.w3.org/TR/n-quads/.

  enumerator SERD_TRIG

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

struct SerdChunk

  An unterminated string fragment.

  const uint8_t *buf

    Start of chunk.

  size_t len

    Length of chunk in bytes.

void serd_free(void *ptr)

  Free memory allocated by Serd.

  This function exists because some systems require memory allocated by a library to be freed by code in the same library. It is otherwise equivalent to the standard C free() function.