LMMS
Loading...
Searching...
No Matches
Sratom

Typedefs

typedef struct SratomImpl Sratom
typedef struct SratomImpl Sratom

Enumerations

enum  SratomObjectMode { SRATOM_OBJECT_MODE_BLANK , SRATOM_OBJECT_MODE_BLANK_SUBJECT }
enum  SratomObjectMode { SRATOM_OBJECT_MODE_BLANK , SRATOM_OBJECT_MODE_BLANK_SUBJECT }

Functions

SRATOM_API Sratomsratom_new (LV2_URID_Map *map)
SRATOM_API void sratom_free (Sratom *sratom)
SRATOM_API void sratom_set_env (Sratom *sratom, SerdEnv *env)
SRATOM_API void sratom_set_sink (Sratom *sratom, const char *base_uri, SerdStatementSink sink, SerdEndSink end_sink, void *handle)
SRATOM_API void sratom_set_pretty_numbers (Sratom *sratom, bool pretty_numbers)
SRATOM_API void sratom_set_object_mode (Sratom *sratom, SratomObjectMode object_mode)
SRATOM_API int sratom_write (Sratom *sratom, LV2_URID_Unmap *unmap, uint32_t flags, const SerdNode *subject, const SerdNode *predicate, uint32_t type_urid, uint32_t size, const void *body)
SRATOM_API void sratom_read (Sratom *sratom, LV2_Atom_Forge *forge, SordWorld *world, SordModel *model, const SordNode *node)
SRATOM_API char * sratom_to_turtle (Sratom *sratom, LV2_URID_Unmap *unmap, const char *base_uri, const SerdNode *subject, const SerdNode *predicate, uint32_t type, uint32_t size, const void *body)
SRATOM_API LV2_Atomsratom_from_turtle (Sratom *sratom, const char *base_uri, const SerdNode *subject, const SerdNode *predicate, const char *str)
SRATOM_API LV2_Atom_Forge_Ref sratom_forge_sink (LV2_Atom_Forge_Sink_Handle handle, const void *buf, uint32_t size)
SRATOM_API LV2_Atomsratom_forge_deref (LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref)

Detailed Description

A library for serialising LV2 Atoms.

An LV2 Atom RDF serialisation library.

Typedef Documentation

◆ Sratom [1/2]

typedef struct SratomImpl Sratom

Atom serialiser.

◆ Sratom [2/2]

typedef struct SratomImpl Sratom

Atom serialiser.

Enumeration Type Documentation

◆ SratomObjectMode [1/2]

Mode for reading resources to LV2 Objects.

This affects how resources (which are either blank nodes or have URIs) are read by sratom_read(), since they may be read as simple references (a URI or blank node ID) or a complete description (an atom "Object").

Currently, blank nodes are always read as Objects, but support for reading blank node IDs may be added in the future.

Enumerator
SRATOM_OBJECT_MODE_BLANK 

Read blank nodes as Objects, and named resources as URIs.

SRATOM_OBJECT_MODE_BLANK_SUBJECT 

Read blank nodes and the main subject as Objects, and any other named resources as URIs. The "main subject" is the subject parameter passed to sratom_read(); if this is a resource it will be read as an Object, but all other named resources encountered will be read as URIs.

◆ SratomObjectMode [2/2]

Mode for reading resources to LV2 Objects.

This affects how resources (which are either blank nodes or have URIs) are read by sratom_read(), since they may be read as simple references (a URI or blank node ID) or a complete description (an atom "Object").

Currently, blank nodes are always read as Objects, but support for reading blank node IDs may be added in the future.

Enumerator
SRATOM_OBJECT_MODE_BLANK 

Read blank nodes as Objects, and named resources as URIs.

SRATOM_OBJECT_MODE_BLANK_SUBJECT 

Read blank nodes and the main subject as Objects, and any other named resources as URIs. The "main subject" is the subject parameter passed to sratom_read(); if this is a resource it will be read as an Object, but all other named resources encountered will be read as URIs.

Function Documentation

◆ sratom_forge_deref()

SRATOM_API LV2_Atom * sratom_forge_deref ( LV2_Atom_Forge_Sink_Handle handle,
LV2_Atom_Forge_Ref ref )

The corresponding deref function for sratom_forge_sink.

◆ sratom_forge_sink()

SRATOM_API LV2_Atom_Forge_Ref sratom_forge_sink ( LV2_Atom_Forge_Sink_Handle handle,
const void * buf,
uint32_t size )

A convenient resizing sink for LV2_Atom_Forge. The handle must point to an initialized SerdChunk.

◆ sratom_free()

SRATOM_API void sratom_free ( Sratom * sratom)

Free an Atom serialisation.

◆ sratom_from_turtle()

SRATOM_API LV2_Atom * sratom_from_turtle ( Sratom * sratom,
const char * base_uri,
const SerdNode * subject,
const SerdNode * predicate,
const char * str )

Read an Atom from a Turtle string. The returned atom must be free()'d by the caller.

◆ sratom_new()

SRATOM_API Sratom * sratom_new ( LV2_URID_Map * map)

Create a new Atom serialiser.

◆ sratom_read()

SRATOM_API void sratom_read ( Sratom * sratom,
LV2_Atom_Forge * forge,
SordWorld * world,
SordModel * model,
const SordNode * node )

Read an Atom from RDF. The resulting atom will be written to Forge.

◆ sratom_set_env()

SRATOM_API void sratom_set_env ( Sratom * sratom,
SerdEnv * env )

Set the environment for reading or writing Turtle.

This can be used to set namespace prefixes and a base URI for sratom_to_turtle() and sratom_from_turtle().

◆ sratom_set_object_mode()

SRATOM_API void sratom_set_object_mode ( Sratom * sratom,
SratomObjectMode object_mode )

Configure how resources will be read to form LV2 Objects.

◆ sratom_set_pretty_numbers()

SRATOM_API void sratom_set_pretty_numbers ( Sratom * sratom,
bool pretty_numbers )

Write pretty numeric literals.

If pretty_numbers is true, numbers will be written as pretty Turtle literals, rather than string literals with precise types. The cost of this is that the types might get fudged on a round-trip to RDF and back.

◆ sratom_set_sink()

SRATOM_API void sratom_set_sink ( Sratom * sratom,
const char * base_uri,
SerdStatementSink sink,
SerdEndSink end_sink,
void * handle )

Set the sink(s) where sratom will write its output.

This must be called before calling sratom_write().

◆ sratom_to_turtle()

SRATOM_API char * sratom_to_turtle ( Sratom * sratom,
LV2_URID_Unmap * unmap,
const char * base_uri,
const SerdNode * subject,
const SerdNode * predicate,
uint32_t type,
uint32_t size,
const void * body )

Serialise an Atom to a Turtle string. The returned string must be free()'d by the caller.

◆ sratom_write()

SRATOM_API int sratom_write ( Sratom * sratom,
LV2_URID_Unmap * unmap,
uint32_t flags,
const SerdNode * subject,
const SerdNode * predicate,
uint32_t type_urid,
uint32_t size,
const void * body )

Write an Atom to RDF. The serialised atom is written to the sink set by sratom_set_sink().

Returns
0 on success, or a non-zero error code otherwise.