|
Volksdata 1.0b7
RDF library
|

Data Structures | |
| struct | VOLK_Codec |
| Codec structure. More... | |
Typedefs | |
| typedef VOLK_rc(* | term_enc_fn_t) (const VOLK_Term *term, char **rep) |
| Term encoder callback type. | |
| typedef void *(* | gr_encode_init_fn_t) (const VOLK_Graph *gr) |
| Initialize a graph encoding loop. | |
| typedef VOLK_rc(* | gr_encode_iter_fn_t) (void *it, char **res) |
| Perform one encoding iteration. | |
| typedef void(* | gr_encode_done_fn_t) (void *it) |
| Finalize an encoding operation. | |
| typedef VOLK_rc(* | term_decode_fn_t) (const char *rep, VOLK_Term **term) |
| Prototype for decoding a string into a VOLK_Term. | |
| typedef VOLK_rc(* | gr_decode_fn_t) (FILE *fh, const char *sh, VOLK_Graph **gr, size_t *ct, char **err) |
| Prototype for decoding a complete RDF document file into a graph. | |
Term encoder callback type.
| [in] | term | Single term handle. |
| [out] | rep | Pointer to a string to be filled with the encoded term. The string is reallocated and, if reused for multiple calls to this function, it only needs to be freed after the last call. It should be initialized to NULL at the beginning. |
| typedef void *(* gr_encode_init_fn_t) (const VOLK_Graph *gr) |
Initialize a graph encoding loop.
This prototype is to be implemented by graph encoding loops. It should create an iterator and perform all initial setup for finding triples.
Implementations MUST set the "codec" member of the iterator to the address of the codec that generated it.
| [in] | gr | The graph to be encoded. The graph's namespace map is used by the codec for namespace prefixing. The graph may only be freed after the loop is finalized. |
| typedef VOLK_rc(* gr_encode_iter_fn_t) (void *it, char **res) |
Perform one encoding iteration.
Implementations of this prototype MUST perform all the steps to encode one or more complete triples into an RDF fragment representing those triples. The input and output units are up to the implementation and a caller SHOULD assume that multiple lines may be yielded at each iteration.
| [in] | it | Iterator handle. |
| [out] | res | Handle to be populated with a string obtained from encoding. The output data should be UTF-8 encoded. This pointer must be initialized (even to NULL) and should be eventually freed manually at the end of the loop. It is reallocated at each iteration, so memory from a previous iteration may be overwritten with new data. |
| typedef void(* gr_encode_done_fn_t) (void *it) |
Prototype for decoding a string into a VOLK_Term.
Implementations MAY ignore any other tokens after finding the first one.
| [in] | rep | NT representation of the term. |
| [out] | term | Pointer to the term handle to be created. Implementaions SHOULD return NULL on a parse error. |
| typedef VOLK_rc(* gr_decode_fn_t) (FILE *fh, const char *sh, VOLK_Graph **gr, size_t *ct, char **err) |
Prototype for decoding a complete RDF document file into a graph.
Implementations SHOULD consume data from the file handle in chunks and MAY read a string handle .
| [in] | fh | Open file handle pointing to the RDF data. Implementations MUST NOT close the file handle. This is exclusive with sh. |
| [in] | sh | string handle for the RDF data. This is exclusive with fh. If both are specified, fh has precedence. |
| [out] | gr | Pointer to a graph handle to be generated from decoding. The handle need not be initialized. The graph URI will be randomly assigned and can be changed at a later time. |
| [out] | ct | If not NULL, it MAY be populated with the number of triples parsed (which may be different from the resulting graph size). Implementations MAY choose not not use this, and they MUST account for the value to be NULL. |
| [out] | err | Pointer to error info string. If no error occurs, it yields NULL. |