14#define UUID4_URN_SIZE UUIDSTR_SIZE + 10
17#define VOLK_RDF_TYPE "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
18#define VOLK_RDF_TYPE_NS "rdf:type"
20#define DEFAULT_DTYPE "http://www.w3.org/2001/XMLSchema#string"
21#define DEFAULT_DTYPE_NS "xsd:string"
42typedef struct match_coord_t {
48typedef struct iri_info_t {
62typedef struct term_t {
76#define VOLK_IS_LITERAL(term) \
77 ((term)->type == VOLK_TERM_LITERAL || (term)->type == VOLK_TERM_LT_LITERAL)
86typedef struct triple_t {
180#define TERM_DUMMY VOLK_term_new (VOLK_TERM_UNDEFINED, NULL, NULL)
442#define TRP_DUMMY VOLK_triple_new (NULL, NULL, NULL)
661VOLK_LinkMapIterator *
VOLK_Key VOLK_btriple_hash(const VOLK_BufferTriple *strp)
Hash a buffer triple.
void VOLK_btriple_free(VOLK_BufferTriple *sspo)
Free a buffer triple and all its internal pointers.
VOLK_TriplePos
Triple position of s, p, o.
VOLK_rc VOLK_nsmap_normalize_uri(const char *pfx_uri, char **fq_uri_p)
Convert a namespace-prefixed string to a FQ URI sring if mapped.
#define RCNL(exp)
Return NULL if exp returns a nonzero value.
size_t VOLK_Key
Term key, i.e., hash of a serialized term.
VOLK_Key VOLK_triple_hash(const VOLK_Triple *trp)
Hash a triple.
VOLK_Term * VOLK_lt_literal_new(const char *data, char *lang)
Shortcut to create a language-tagged literal term.
VOLK_rc VOLK_term_set_add(VOLK_TermSet *ts, VOLK_Term *term, VOLK_Term **existing)
Add term to a term set.
VOLK_Triple * VOLK_triple_new_from_btriple(const VOLK_BufferTriple *sspo)
struct hashmap VOLK_TermSet
a set of unique terms.
VOLK_rc VOLK_term_set_next(VOLK_TermSet *ts, size_t *i, VOLK_Term **term)
Iterate trough a term set.
VOLK_Triple * VOLK_triple_new(VOLK_Term *s, VOLK_Term *p, VOLK_Term *o)
Create a new triple from three terms.
char * VOLK_iriref_frag(const VOLK_Term *iri)
Get the fragment portion of a IRI ref.
VOLK_Term * VOLK_iriref_new_rel(const VOLK_Term *root, const VOLK_Term *iri)
Create a new relative IRI from an absolute IRI and a web root IRI.
VOLK_rc VOLK_parse_iri(char *iri_str, VOLK_IRIInfo *iri_info)
scan an IRI string and parse IRI parts.
void VOLK_link_map_iter_free(VOLK_LinkMapIterator *it)
Free a link map iterator.
VOLK_Term * VOLK_iriref_new(const char *data)
Create an IRI reference.
bool VOLK_term_equals(const VOLK_Term *term1, const VOLK_Term *term2)
Compare two terms.
size_t VOLK_term_set_size(VOLK_TermSet *ts)
Size of a term set.
VOLK_Term * VOLK_iriref_new_abs(const VOLK_Term *root, const VOLK_Term *iri)
Create a new absolute IRI from a path relative to a root IRI.
VOLK_Term * VOLK_literal_new(const char *data, VOLK_Term *datatype)
Shortcut to create a literal term.
VOLK_LinkMapIterator * VOLK_link_map_iter_new(const VOLK_LinkMap *lmap)
Create a new iterator to loop through a link map.
char * VOLK_iriref_prefix(const VOLK_Term *iri)
Get the prefix portion of a IRI ref.
VOLK_LinkMap * VOLK_link_map_new(const VOLK_Term *linked_term, VOLK_LinkType type)
New link map.
VOLK_Term * VOLK_default_datatype
Default literal data type URI.
VOLK_rc VOLK_link_map_triples(VOLK_LinkMapIterator *it, VOLK_Triple *spo)
Iterate over a link map and generate triples.
void VOLK_triple_done(VOLK_Triple *spo)
Free the internal pointers of a triple.
VOLK_rc VOLK_triple_init(VOLK_Triple *spo, VOLK_Term *s, VOLK_Term *p, VOLK_Term *o)
Initialize internal term pointers in a heap-allocated triple.
const VOLK_Term * VOLK_term_set_get(VOLK_TermSet *ts, VOLK_Key key)
Get a term from a term set.
VOLK_Term * VOLK_bnode_new(const char *data)
Shortcut to create a blank node.
VOLK_TermSet * VOLK_term_set_new(void)
Create a new term set.
uint32_t VOLK_default_dtype_key
Compiled hash of default literal data type.
void VOLK_term_set_free(VOLK_TermSet *ts)
Free a term set.
VOLK_Key VOLK_term_hash(const VOLK_Term *term)
Hash a buffer.
VOLK_rc VOLK_link_map_next(VOLK_LinkMapIterator *it, VOLK_Term **lt, VOLK_TermSet **ts)
Iterate through a link map.
void VOLK_link_map_free(VOLK_LinkMap *lm)
Free a link map.
VOLK_Term * VOLK_iriref_new_ns(const char *data)
Create an IRI reference from a namespace-prefixed string.
char * VOLK_iriref_path(const VOLK_Term *iri)
Get the path portion of a IRI ref.
char VOLK_LangTag[8]
Language tag, currently restricted to 7 characters.
void VOLK_term_free(VOLK_Term *term)
VOLK_Term * VOLK_triple_pos(const VOLK_Triple *trp, const VOLK_TriplePos n)
Get triple by term position.
VOLK_Buffer * VOLK_term_serialize(const VOLK_Term *term)
Serialize a term into a buffer.
VOLK_Term * VOLK_default_ctx
Default context.
VOLK_Term * VOLK_term_new_from_buffer(const VOLK_Buffer *sterm)
Deserialize a buffer into a term.
VOLK_rc VOLK_link_map_add(VOLK_LinkMap *lmap, VOLK_Term *term, VOLK_TermSet *tset)
Add a term - term set pair to a link map.
VOLK_LinkType VOLK_link_map_type(const VOLK_LinkMap *map)
Return the link map type.
VOLK_BufferTriple * VOLK_triple_serialize(const VOLK_Triple *spo)
VOLK_Term * VOLK_term_new(VOLK_TermType type, const char *data, void *metadata)
Create a new term.
VOLK_TermSet * VOLK_term_cache
Global term cache.
void VOLK_triple_free(VOLK_Triple *spo)
Free a triple and all its internal pointers.
VOLK_Term * VOLK_term_copy(const VOLK_Term *src)
Copy a term.
@ VOLK_LINK_EDGE
Edge link (so).
@ VOLK_LINK_INBOUND
Inbound link (sp).
@ VOLK_LINK_OUTBOUND
Outbound link (po).
@ VOLK_TERM_IRIREF
IRI reference.
@ VOLK_TERM_LT_LITERAL
Language-tagged string literal.
@ VOLK_TERM_LITERAL
Literal without language tag.
@ VOLK_TERM_BNODE
Blank node.
Match coordinates in IRI parsing results.
unsigned int size
Length of match.
unsigned int offset
Offset of match from start of string.
General-purpose data buffer.
Matching sub-patterns for IRI parts.
MatchCoord frag
Fragment (frag).
MatchCoord auth
Authority (example.org).
MatchCoord query
Query (query=blah).
MatchCoord prefix
Prefix (http://example.org).
MatchCoord scheme
Scheme (http).
VOLK_Key bnode_id
BN ID for comparison & skolemization.
void * metadata
Generic metadata pointer.
char * data
URI, literal value, or BNode label.
struct term_t * datatype
Data type IRI for VOLK_TERM_LITERAL.
VOLK_TermType type
Term type.
VOLK_LangTag lang
Lang tag for VOLK_TERM_LT_LITERAL.
Opaque link map iterator.