9typedef struct store_reg_entry {
18static int nsmap_comp_fn (
const void *a,
const void *b,
void *_unused)
28static uint64_t nsmap_hash_fn (
29 const void *item, uint64_t seed0, uint64_t _unused)
37static void nsmap_free_fn (
void *item)
38{ free (((
NSEntry *) item)->ns); }
41static int store_reg_comp_fn (
const void *a,
const void *b,
void *_unused)
47 return strcmp (ela->
id, elb->
id);
50static uint64_t store_reg_hash_fn (
51 const void *item, uint64_t seed0, uint64_t _unused)
76 char *_loglevel = getenv (
"VOLK_LOGLEVEL");
77 int loglevel = (_loglevel == NULL) ? LOG_INFO : atoi (_loglevel);
79 log_set_level (loglevel);
84 nsmap_hash_fn, nsmap_comp_fn, nsmap_free_fn, NULL);
93 const char *default_ctx_str = getenv (
"VOLK_DEFAULT_CTX");
115 store_reg_hash_fn, store_reg_comp_fn, NULL, NULL);
119 log_info (
"Volksdata environment initialized.");
143 log_info (
"Volksdata environment torn down.");
const char * init_nsmap[][2]
Initial namespace map.
Handle LSUP environment initialization and teardown.
VOLK_Buffer * VOLK_default_ctx_buf
Serialized default context.
void VOLK_buffer_free(VOLK_Buffer *buf)
Free a buffer.
void VOLK_done(void)
Close the default environment.
#define DEFAULT_CTX_LABEL
Default context.
VOLK_rc VOLK_init(void)
Initialize the default environment.
struct hashmap * VOLK_store_reg
Internal registry of store handles.
#define VOLK_HASH_SEED
Seed used for all hashing. Compile-time configurable.
#define VOLK_HASH64(buf, size, seed)
Default 64-bit hashing function.
bool VOLK_env_is_init
Whether the environment is initialized.
struct hashmap * VOLK_default_nsm
Default namespace prefix map.
VOLK_rc VOLK_nsmap_add(const char *pfx, const char *nsstr)
Add a prefix -> namespace pair to the map or update it.
#define PFX_LEN
Namespace prefix length, including terminator.
#define LOG_RC(rc)
Log an error or warning for return codes that are not VOLK_OK.
#define PRCCK(exp)
Return exp return value if it is of VOLK_rc type and negative (=error).
#define VOLK_ERROR
Generic error return code.
#define VOLK_MEM_ERR
Memory allocation error.
#define VOLK_OK
Generic success return code.
#define VOLK_NOACTION
No action taken.
VOLK_rc VOLK_term_set_add(VOLK_TermSet *ts, VOLK_Term *term, VOLK_Term **existing)
Add term to a term set.
VOLK_Term * VOLK_iriref_new(const char *data)
Create an IRI reference.
VOLK_Term * VOLK_default_datatype
Default literal data type URI.
VOLK_TermSet * VOLK_term_set_new()
Create a new term set.
void VOLK_term_free(VOLK_Term *term)
VOLK_Buffer * VOLK_term_serialize(const VOLK_Term *term)
Serialize a term into a buffer.
#define DEFAULT_DTYPE
Default data type for untyped literals (prefixed IRI).
VOLK_Term * VOLK_default_ctx
Default context.
VOLK_TermSet * VOLK_term_cache
Global term cache.