Typedef Documentation

typedef
struct SordModelImpl SordModel
Sord Model. A model is an indexed set of Quads (i.e. it can
contain several RDF graphs). It may be searched using
various patterns depending on which indices are enabled.

typedef
struct SordInserterImpl SordInserter
Model Inserter. An inserter is used for writing statements
to a model using the Serd sink interface. This makes it
simple to write to a model directly using a SerdReader, or
any other code that writes statements to a
SerdStatementSink.

typedef
struct SordIterImpl SordIter
Model Iterator.

typedef
struct SordNodeImpl SordNode
RDF Node. A Node is a component of a Quad. Nodes may be
URIs, blank nodes, or (in the case of quad objects only)
string literals. Literal nodes may have an associate
language or datatype (but not both).

Function Documentation

SordWorld*
sord_world_new (void)
Create a new Sord World. It is safe to use multiple worlds
in one process, though no data (e.g. nodes) can be shared
between worlds, and this should be avoided if possible for
performance reasons.

void
sord_world_free (SordWorld * world)
Free world.

void
sord_world_set_error_sink (SordWorld * world, SerdErrorSink
error_sink, void * handle)
Set a function to be called when errors occur. The
error_sink will be called with handle as
its first argument. If no error function is set, errors are
printed to stderr.

SordNode*
sord_new_uri (SordWorld * world, const uint8_t * uri)
Get a URI node from a string. Note this function measures
str, which is a common bottleneck. Use
sord_node_from_serd_node() instead if str is
already measured.

SordNode*
sord_new_blank (SordWorld * world, const uint8_t * str)
Get a blank node from a string. Note this function measures
str, which is a common bottleneck. Use
sord_node_from_serd_node() instead if str is
already measured.

const
uint8_t* sord_node_get_string_counted (const SordNode *
node, size_t * bytes)
Return the string value of a node, and set bytes to
its length in bytes.

const
uint8_t* sord_node_get_string_measured (const SordNode *
node, size_t * bytes, size_t * chars)
Return the string value of a node, and set bytes to
its length in bytes, and count to its length in
characters.

bool
sord_node_is_inline_object (const SordNode * node)
Return true iff node can be serialised as an inline object.
More specifically, this returns true iff the node is the
object field of exactly one statement, and therefore can be
inlined since it needn’t be referred to by name.

world The world in which
to make this model.
indices SordIndexOption flags (e.g. SORD_SPO|SORD_OPS).
Be sure to enable an index where the most significant
node(s) are not variables in your queries (e.g. to make (? P
O) queries, enable either SORD_OPS or SORD_POS).
graphs If true, store (and index) graph contexts.

void
sord_free (SordModel * model)
Close and free model.

SordWorld*
sord_get_world (SordModel * model)
Get the world associated with model.

size_t
sord_num_nodes (const SordWorld * world)
Return the number of nodes stored in world. Nodes
are included in this count iff they are a part of a quad in
world.

SordNode*
sord_get (SordModel * model, const SordNode * s, const
SordNode * p, const SordNode * o, const SordNode * g)
Search for a single node that matches a pattern. Exactly one
of s, p, o must be NULL. This
function is mainly useful for predicates that only have one
value. The returned node must be freed using
sord_node_free().