Volksdata 1.0b7
RDF library
Loading...
Searching...
No Matches
RDF term and triple module
Collaboration diagram for RDF term and triple module:

Data Structures

struct  MatchCoord
 Match coordinates in IRI parsing results. More...
struct  VOLK_IRIInfo
 Matching sub-patterns for IRI parts. More...
struct  VOLK_Term
 RDF term. More...
struct  VOLK_Triple
 RDF triple. More...

Macros

#define UUID4_URN_SIZE   UUIDSTR_SIZE + 10
#define VOLK_RDF_TYPE   "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
#define VOLK_RDF_TYPE_NS   "rdf:type"
#define DEFAULT_DTYPE   "http://www.w3.org/2001/XMLSchema#string"
 Default data type for untyped literals (prefixed IRI).
#define DEFAULT_DTYPE_NS   "xsd:string"
#define VOLK_IS_LITERAL(term)
 Shorthand to test if a term is a literal of any kind.
#define TERM_DUMMY   VOLK_term_new (VOLK_TERM_UNDEFINED, NULL, NULL)
 Placeholder term to use with VOLK_term_reset.
#define TRP_DUMMY   VOLK_triple_new (NULL, NULL, NULL)
 Dummy triple with NULL slots. It is not a valid triple.

Typedefs

typedef char VOLK_LangTag[8]
 Language tag, currently restricted to 7 characters.
typedef struct link_map VOLK_LinkMap
 The immediate neighborhood of terms connected to a term.
typedef struct hashmap VOLK_TermSet
 a set of unique terms.

Enumerations

enum  VOLK_TermType {
  VOLK_TERM_UNDEFINED = 0 , VOLK_TERM_IRIREF , VOLK_TERM_LITERAL , VOLK_TERM_LT_LITERAL ,
  VOLK_TERM_BNODE
}
 Term type. More...
enum  VOLK_LinkType { VOLK_LINK_INBOUND , VOLK_LINK_OUTBOUND , VOLK_LINK_EDGE }
 Link type. More...

Functions

VOLK_TermVOLK_term_new (VOLK_TermType type, const char *data, void *metadata)
 Create a new term.
VOLK_TermVOLK_iriref_new (const char *data)
 Create an IRI reference.
VOLK_TermVOLK_iriref_new_ns (const char *data)
 Create an IRI reference from a namespace-prefixed string.
VOLK_TermVOLK_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_TermVOLK_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_TermVOLK_literal_new (const char *data, VOLK_Term *datatype)
 Shortcut to create a literal term.
VOLK_rc VOLK_parse_iri (char *iri_str, VOLK_IRIInfo *iri_info)
 scan an IRI string and parse IRI parts.
VOLK_TermVOLK_lt_literal_new (const char *data, char *lang)
 Shortcut to create a language-tagged literal term.
VOLK_TermVOLK_bnode_new (const char *data)
 Shortcut to create a blank node.
VOLK_TermVOLK_term_copy (const VOLK_Term *src)
 Copy a term.
VOLK_TermVOLK_term_new_from_buffer (const VOLK_Buffer *sterm)
 Deserialize a buffer into a term.
VOLK_BufferVOLK_term_serialize (const VOLK_Term *term)
 Serialize a term into a buffer.
VOLK_Key VOLK_term_hash (const VOLK_Term *term)
 Hash a buffer.
bool VOLK_term_equals (const VOLK_Term *term1, const VOLK_Term *term2)
 Compare two terms.
void VOLK_term_free (VOLK_Term *term)
char * VOLK_iriref_prefix (const VOLK_Term *iri)
 Get the prefix portion of a IRI ref.
char * VOLK_iriref_path (const VOLK_Term *iri)
 Get the path portion of a IRI ref.
char * VOLK_iriref_frag (const VOLK_Term *iri)
 Get the fragment portion of a IRI ref.
VOLK_TripleVOLK_triple_new (VOLK_Term *s, VOLK_Term *p, VOLK_Term *o)
 Create a new triple from three terms.
VOLK_TripleVOLK_triple_new_from_btriple (const VOLK_BufferTriple *sspo)
VOLK_BufferTripleVOLK_triple_serialize (const VOLK_Triple *spo)
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.
void VOLK_triple_done (VOLK_Triple *spo)
 Free the internal pointers of a triple.
void VOLK_triple_free (VOLK_Triple *spo)
 Free a triple and all its internal pointers.
VOLK_TermVOLK_triple_pos (const VOLK_Triple *trp, const VOLK_TriplePos n)
 Get triple by term position.
VOLK_Key VOLK_triple_hash (const VOLK_Triple *trp)
 Hash a triple.
VOLK_TermSetVOLK_term_set_new (void)
 Create a new term set.
void VOLK_term_set_free (VOLK_TermSet *ts)
 Free a term set.
VOLK_rc VOLK_term_set_add (VOLK_TermSet *ts, VOLK_Term *term, VOLK_Term **existing)
 Add term to a term set.
const VOLK_TermVOLK_term_set_get (VOLK_TermSet *ts, VOLK_Key key)
 Get a term from a term set.
VOLK_rc VOLK_term_set_next (VOLK_TermSet *ts, size_t *i, VOLK_Term **term)
 Iterate trough a term set.
size_t VOLK_term_set_size (VOLK_TermSet *ts)
 Size of a term set.
VOLK_LinkMapVOLK_link_map_new (const VOLK_Term *linked_term, VOLK_LinkType type)
 New link map.
void VOLK_link_map_free (VOLK_LinkMap *lm)
 Free a link map.
VOLK_LinkType VOLK_link_map_type (const VOLK_LinkMap *map)
 Return the link map type.
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_LinkMapIterator * VOLK_link_map_iter_new (const VOLK_LinkMap *lmap)
 Create a new iterator to loop through a link map.
VOLK_rc VOLK_link_map_next (VOLK_LinkMapIterator *it, VOLK_Term **lt, VOLK_TermSet **ts)
 Iterate through a link map.
void VOLK_link_map_iter_free (VOLK_LinkMapIterator *it)
 Free a link map iterator.
VOLK_rc VOLK_link_map_triples (VOLK_LinkMapIterator *it, VOLK_Triple *spo)
 Iterate over a link map and generate triples.

Variables

uint32_t VOLK_default_dtype_key
 Compiled hash of default literal data type.
VOLK_TermVOLK_default_datatype
 Default literal data type URI.
VOLK_TermSetVOLK_term_cache
 Global term cache.
VOLK_TermVOLK_default_ctx
 Default context.

Detailed Description

Macro Definition Documentation

◆ UUID4_URN_SIZE

#define UUID4_URN_SIZE   UUIDSTR_SIZE + 10

Definition at line 14 of file term.h.

◆ VOLK_RDF_TYPE

#define VOLK_RDF_TYPE   "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"

Definition at line 17 of file term.h.

◆ VOLK_RDF_TYPE_NS

#define VOLK_RDF_TYPE_NS   "rdf:type"

Definition at line 18 of file term.h.

◆ DEFAULT_DTYPE

#define DEFAULT_DTYPE   "http://www.w3.org/2001/XMLSchema#string"

Default data type for untyped literals (prefixed IRI).

Definition at line 20 of file term.h.

◆ DEFAULT_DTYPE_NS

#define DEFAULT_DTYPE_NS   "xsd:string"

Definition at line 21 of file term.h.

◆ VOLK_IS_LITERAL

#define VOLK_IS_LITERAL ( term)
Value:
((term)->type == VOLK_TERM_LITERAL || (term)->type == VOLK_TERM_LT_LITERAL)
@ VOLK_TERM_LT_LITERAL
Language-tagged string literal.
Definition term.h:37
@ VOLK_TERM_LITERAL
Literal without language tag.
Definition term.h:36

Shorthand to test if a term is a literal of any kind.

Definition at line 76 of file term.h.

◆ TERM_DUMMY

#define TERM_DUMMY   VOLK_term_new (VOLK_TERM_UNDEFINED, NULL, NULL)

Placeholder term to use with VOLK_term_reset.

Definition at line 180 of file term.h.

◆ TRP_DUMMY

#define TRP_DUMMY   VOLK_triple_new (NULL, NULL, NULL)

Dummy triple with NULL slots. It is not a valid triple.

Definition at line 442 of file term.h.

Typedef Documentation

◆ VOLK_LangTag

typedef char VOLK_LangTag[8]

Language tag, currently restricted to 7 characters.

Definition at line 28 of file term.h.

◆ VOLK_LinkMap

typedef struct link_map VOLK_LinkMap

The immediate neighborhood of terms connected to a term.

This is a hash map whose each term is related to a set of one or more other terms. The hash map is inside an opaque handle and is manipulated via the VOLK_link_map_* functions.

If the type of the link map is VOLK_LINK_INBOUND, the map keys represent predicates and the sets related to them are the objects, and the term associated to the link map is the object.

If the type is VOLK_LINK_OUTBOUND, the keys represent predicates, the related sets objects, and the associated term is the subject.

If the type is VOLK_LINK_EDGE, the keys represent subjects and the related sets objects, and the associated term is the predicate.

Definition at line 117 of file term.h.

◆ VOLK_TermSet

typedef struct hashmap VOLK_TermSet

a set of unique terms.

This is used to bulk-add terms to a link map.

Definition at line 124 of file term.h.

Enumeration Type Documentation

◆ VOLK_TermType

Term type.

Enumerator
VOLK_TERM_UNDEFINED 

Undefined placeholder or result of an error.

                       Invalid for most operations. 
VOLK_TERM_IRIREF 

IRI reference.

VOLK_TERM_LITERAL 

Literal without language tag.

VOLK_TERM_LT_LITERAL 

Language-tagged string literal.

VOLK_TERM_BNODE 

Blank node.

Definition at line 31 of file term.h.

◆ VOLK_LinkType

Link type.

Enumerator
VOLK_LINK_INBOUND 

Inbound link (sp).

VOLK_LINK_OUTBOUND 

Outbound link (po).

VOLK_LINK_EDGE 

Edge link (so).

Definition at line 94 of file term.h.

Function Documentation

◆ VOLK_term_new()

VOLK_Term * VOLK_term_new ( VOLK_TermType type,
const char * data,
void * metadata )

Create a new term.

This is a generic function; it is recommended to use specialized functions such as VOLK_iriref_new(), VOLK_literal_new(), etc. as they have strict type checks for the metadata parameter.

Parameters
[in]typeTerm type. One of VOLK_TermType.
[in]dataTerm data: textual URI, literal value without data type or langtag, etc. It may be NULL for IRI refs and BNodes, in which case a random identifier is generated.
[in]metadatalanguage tag (VOLK_LangTag *) for language-tagged literals; or data type (VOLK_Term *) for other literals. It may be NULL.
Returns
New term, which must be freed with VOLK_term_free after use; or NULL on error.

Definition at line 157 of file term.c.

◆ VOLK_iriref_new()

VOLK_Term * VOLK_iriref_new ( const char * data)
inline

Create an IRI reference.

Must be freed with VOLK_term_free.

Parameters
[in]dataThe fully qualified URI. If NULL, a UUID4 URN is generated.
Returns
same as VOLK_term_new().

Definition at line 192 of file term.h.

◆ VOLK_iriref_new_ns()

VOLK_Term * VOLK_iriref_new_ns ( const char * data)
inline

Create an IRI reference from a namespace-prefixed string.

Must be freed with VOLK_term_free.

Parameters
[in]dataNamespace-prefixed URI. It MUST NOT be NULL,
Returns
same as VOLK_term_new().

Definition at line 205 of file term.h.

◆ VOLK_iriref_new_abs()

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.

If the provided IRI is already an absolute IRI, the result is semantically identical to the input.

If the relative IRI begins with a '/', the resulting IRI is relative to the web root of the root IRI. I.e. if a root IRI has a path after the webroot, it is ignored.

Otherwise, the resulting IRI is relative to the full root string.

Parameters
[in]rootRoot IRI that the new IRI should be relative to.
[in]iriTerm with an IRI relative to the webroot.
Returns
New absolute IRI, or NULL if either term is not an IRI.

Definition at line 231 of file term.c.

◆ VOLK_iriref_new_rel()

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.

This works with namespace-prefixed IRIs and returns a term of the same type as the input.

Parameters
[in]rootRoot IRI that the new IRI should be relative to.
[in]iriFull IRI.
Returns
New IRI, or NULL if either term is not an IRI. If the input IRI is not a path under the root IRI, the result will be identical to the input.

Definition at line 273 of file term.c.

◆ VOLK_literal_new()

VOLK_Term * VOLK_literal_new ( const char * data,
VOLK_Term * datatype )
inline

Shortcut to create a literal term.

Must be freed with VOLK_term_free.

Parameters
[in]dataThe literal string.
[in]datatypeData type URI string. If NULL, the default data type (xsd:string) is used. The new term takes ownership of the pointer.
Returns
same as VOLK_term_new().

Definition at line 266 of file term.h.

◆ VOLK_parse_iri()

VOLK_rc VOLK_parse_iri ( char * iri_str,
VOLK_IRIInfo * iri_info )

scan an IRI string and parse IRI parts.

Replacement of a regex engine for better performance.

Slightly adapted from regex on https://datatracker.ietf.org/doc/html/rfc3986#appendix-B to capture relevant parts of the IRI.

Reference regex and group numbering: ^((?([^:/?#]+):)?(?//([^/?#]*))?)((?[^?#]*)(??([^#]*))?(?#(.*))?) 1 2 3 4 5 6

Capturing groups:

#0: Full parsed URI (http://example.org/123/456/?query=blah#frag) #1: Prefix (http://example.org) #2: Scheme (http) #3: Authority (example.org) #4: Path, including query and fragment (/123/456/?query=blah#frag) #5: Query (query=blah) #6: Fragment (frag)

Parameters
[in]iri_strIRI string to parse.
[in,out]iri_infoCoordinates to be stored.

The first element of each MatchCoord element stores the position of a match, and the second one stores the length of the match. A length of 0 indicates no match.

Definition at line 887 of file term.c.

◆ VOLK_lt_literal_new()

VOLK_Term * VOLK_lt_literal_new ( const char * data,
char * lang )
inline

Shortcut to create a language-tagged literal term.

Must be freed with VOLK_term_free.

Parameters
[in]dataThe literal string.
[in]langLanguage tag string.
Returns
same as VOLK_term_new().

Definition at line 317 of file term.h.

◆ VOLK_bnode_new()

VOLK_Term * VOLK_bnode_new ( const char * data)
inline

Shortcut to create a blank node.

Must be freed with VOLK_term_free.

Parameters
[in]dataThe BNode identifier. It can be NULL, in which case, a random identifier is minted.
Returns
same as VOLK_term_new().

Definition at line 331 of file term.h.

◆ VOLK_term_copy()

VOLK_Term * VOLK_term_copy ( const VOLK_Term * src)

Copy a term.

Parameters
[in]srcThe term to copy.
Returns
A new duplicate term handle.

Definition at line 174 of file term.c.

◆ VOLK_term_new_from_buffer()

VOLK_Term * VOLK_term_new_from_buffer ( const VOLK_Buffer * sterm)

Deserialize a buffer into a term.

Parameters
[in]stermBuffer to convert into a term. It must be a valid serialized term from store or obtained with VOLK_term_serialize().
Returns
New term handle. It must be freed with VOLK_term_free().

Deserialize a buffer into a term.

Definition at line 189 of file term.c.

◆ VOLK_term_serialize()

VOLK_Buffer * VOLK_term_serialize ( const VOLK_Term * term)

Serialize a term into a buffer.

Parameters
[in]termTerm to convert into a buffer.
Returns
New buffer handle. It must be freed with VOLK_buffer_free().

Definition at line 293 of file term.c.

◆ VOLK_term_hash()

VOLK_Key VOLK_term_hash ( const VOLK_Term * term)

Hash a buffer.

Definition at line 371 of file term.c.

◆ VOLK_term_equals()

bool VOLK_term_equals ( const VOLK_Term * term1,
const VOLK_Term * term2 )
inline

Compare two terms.

The terms evaluate as equal if their hashes are equal—i.e. if they are semantically equivalent.

Definition at line 377 of file term.h.

◆ VOLK_term_free()

void VOLK_term_free ( VOLK_Term * term)

Definition at line 387 of file term.c.

◆ VOLK_iriref_prefix()

char * VOLK_iriref_prefix ( const VOLK_Term * iri)

Get the prefix portion of a IRI ref.

Parameters
[in]iriIRI reference handle.
Returns
String containing the protocol and domain name part of the IRI. It should be freed after use.

Definition at line 403 of file term.c.

◆ VOLK_iriref_path()

char * VOLK_iriref_path ( const VOLK_Term * iri)

Get the path portion of a IRI ref.

Parameters
[in]iriIRI reference handle.
Returns
String containing the path of the IRI relative to the web root. For a URN, such as urn:myns:myid, it would be myns:myid. This string should be freed after use.

Definition at line 420 of file term.c.

◆ VOLK_iriref_frag()

char * VOLK_iriref_frag ( const VOLK_Term * iri)

Get the fragment portion of a IRI ref.

Parameters
[in]iriIRI reference handle.
Returns
String containing the fragment part of the IRI, or NULL if the IRI contains no fragment. It should be freed after use.

Definition at line 436 of file term.c.

◆ VOLK_triple_new()

VOLK_Triple * VOLK_triple_new ( VOLK_Term * s,
VOLK_Term * p,
VOLK_Term * o )

Create a new triple from three terms.

Terms are NOT copied. To free them with the triple, use VOLK_triple_free(). To only free the triple, use free().

TODO Term types are not validated at the moment.

Parameters
[in]sTriple subject. It must be an IRIRef or BNode.
[in]pTriple predicate. It must be an IRIRef.
[in]oTriple object.

Definition at line 456 of file term.c.

◆ VOLK_triple_new_from_btriple()

VOLK_Triple * VOLK_triple_new_from_btriple ( const VOLK_BufferTriple * sspo)

Definition at line 471 of file term.c.

◆ VOLK_triple_serialize()

VOLK_BufferTriple * VOLK_triple_serialize ( const VOLK_Triple * spo)

Definition at line 485 of file term.c.

◆ VOLK_triple_init()

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.

See also
VOLK_triple_new()
Parameters
[in]spoTriple pointer to initialize.
[in]sTriple subject. It must be an IRIRef or BNode.
[in]pTriple predicate. It must be an IRIRef.
[in]oTriple object.

Definition at line 499 of file term.c.

◆ VOLK_triple_done()

void VOLK_triple_done ( VOLK_Triple * spo)

Free the internal pointers of a triple.

Parameters
[in]spoTriple to be freed.

Definition at line 521 of file term.c.

◆ VOLK_triple_free()

void VOLK_triple_free ( VOLK_Triple * spo)

Free a triple and all its internal pointers.

NOTE: If the term pointers are not to be freed (e.g. they are owned by a back end), use a simple free(spo) instead of this.

Parameters
[in]spoTriple to be freed.

Definition at line 532 of file term.c.

◆ VOLK_triple_pos()

VOLK_Term * VOLK_triple_pos ( const VOLK_Triple * trp,
const VOLK_TriplePos n )
inline

Get triple by term position.

Useful for looping over all terms.

Parameters
[in]trpTriple pointer.
[in]nA number between 0÷2.
Returns
Corresponding triple term or NULL if n is out of range.

Definition at line 499 of file term.h.

◆ VOLK_triple_hash()

VOLK_Key VOLK_triple_hash ( const VOLK_Triple * trp)
inline

Hash a triple.

TODO This doesn't handle blank nodes correctly.

Definition at line 513 of file term.h.

◆ VOLK_term_set_new()

VOLK_TermSet * VOLK_term_set_new ( void )

Create a new term set.

Returns
New empty term set.

Definition at line 549 of file term.c.

◆ VOLK_term_set_free()

void VOLK_term_set_free ( VOLK_TermSet * ts)

Free a term set.

Parameters
[in]tsTerm set handle.

Definition at line 604 of file term.c.

◆ VOLK_term_set_add()

VOLK_rc VOLK_term_set_add ( VOLK_TermSet * ts,
VOLK_Term * term,
VOLK_Term ** existing )

Add term to a term set.

If the same term is already in the set, it is not replaced, and the existing term's handle is made available in the existing variable. In this case, the caller may want to free the passed term which has not been added.

Parameters
[in]tsTerm set to be added to.
[in]termTerm to be added to the list. The term set will take ownership of the term and free it when it's freed with VOLK_term_set_free()—only if the return code is VOLK_OK.
[out]existingIf not NULL, and if the term being added is a duplicate, this variable will be populated with the existing term handle.
Returns
VOLK_OK on success; VOLK_NOACTION if the term is duplicate; VOLK_MEM_ERR on memory error. Note: if not VOLK_OK, the caller is in charge of freeing the RDF term and triple module handle.

Definition at line 562 of file term.c.

◆ VOLK_term_set_get()

const VOLK_Term * VOLK_term_set_get ( VOLK_TermSet * ts,
VOLK_Key key )

Get a term from a term set.

Parameters
[in]tsTerm set handle.
[in]keyKey for the queried term.
Returns
The retrieved term if found, or NULL. The term must not be modified or freed.

Definition at line 581 of file term.c.

◆ VOLK_term_set_next()

VOLK_rc VOLK_term_set_next ( VOLK_TermSet * ts,
size_t * i,
VOLK_Term ** term )

Iterate trough a term set.

Parameters
[in]tsTerm set handle.
[in,out]iIterator to be initially set to 0.
[out]termPointer to be populated with the next term on success. It may be NULL.
Returns
VOLK_OK if the next term was retrieved; VOLK_END if the end of the set has been reached.

Definition at line 592 of file term.c.

◆ VOLK_term_set_size()

size_t VOLK_term_set_size ( VOLK_TermSet * ts)

Size of a term set.

Parameters
[in]tsTerm set handle.
Returns
Number of unique terms in the term set.

Definition at line 612 of file term.c.

◆ VOLK_link_map_new()

VOLK_LinkMap * VOLK_link_map_new ( const VOLK_Term * linked_term,
VOLK_LinkType type )

New link map.

Parameters
[in]linked_termTerm to be linked to map. The term is copied and may be freed after this function call.
[in]typeType of links that the link map shall contain.
See also
VOLK_LinkType
Returns
a new empty link map.

Definition at line 617 of file term.c.

◆ VOLK_link_map_free()

void VOLK_link_map_free ( VOLK_LinkMap * lm)

Free a link map.

All arrays and term handles are recursively freed.

Parameters
[in]lmlink map handle obtained with VOLK_link_map_new().

Definition at line 637 of file term.c.

◆ VOLK_link_map_type()

VOLK_LinkType VOLK_link_map_type ( const VOLK_LinkMap * map)

Return the link map type.

Returns
Link type.
See also
VOLK_LinkType

Definition at line 646 of file term.c.

◆ VOLK_link_map_add()

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.

If there is already a term set for the given term, items from the added term are added to the existing term set (if not duplicated). Otherwise, the term set handle is linked to the new term.

In any case, the caller should not directly use the term and term set after passing them to this function.

Parameters
[in]lmapLink map handle obtained with VOLK_link_map_new().
[in]termTerm to be associated with the given object list. The link map takes ownership of the term.
[in]tsetterm set to be associated with the given term. The link map takes ownership of the term set and the terms in it.
Returns
VOLK_OK on success; VOLK_MEM_ERR on allocation error.

Definition at line 652 of file term.c.

◆ VOLK_link_map_iter_new()

VOLK_LinkMapIterator * VOLK_link_map_iter_new ( const VOLK_LinkMap * lmap)

Create a new iterator to loop through a link map.

Parameters
[in]lmapMap handle to iterate.

Definition at line 695 of file term.c.

◆ VOLK_link_map_next()

VOLK_rc VOLK_link_map_next ( VOLK_LinkMapIterator * it,
VOLK_Term ** lt,
VOLK_TermSet ** ts )

Iterate through a link map.

Each call to this function yields a linked term and the related term set.

Parameters
[in]itLink map iterator obtained with VOLK_link_map_iter_new().
[out]ltLinked term returned.
[out]tsTerm set returned.
Returns
VOLK_OK if a result was yielded; VOLK_END if the end of the link map has been reached.

Definition at line 711 of file term.c.

◆ VOLK_link_map_iter_free()

void VOLK_link_map_iter_free ( VOLK_LinkMapIterator * it)

Free a link map iterator.

Definition at line 707 of file term.c.

◆ VOLK_link_map_triples()

VOLK_rc VOLK_link_map_triples ( VOLK_LinkMapIterator * it,
VOLK_Triple * spo )

Iterate over a link map and generate triples.

Calling this function repeatedly builds triples for all the linked terms and term sets in the map, based on a given related term.

Parameters
[in]itLink map iterator handle, obtained with VOLK_link_map_iter_new().
[in,out]spoResult triple. The triple handle must be pre-allocated (it may be TRP_DUMMY) and calls to this function will be set its memebers to term handles owned by the link map. If rc != VOLK_OK, the contents are undefined.
Returns
VOLK_OK if a new triple was yielded; VOLK_END if the end of the loop has been reached; <0 on error.

Definition at line 726 of file term.c.

Variable Documentation

◆ VOLK_default_dtype_key

uint32_t VOLK_default_dtype_key
extern

Compiled hash of default literal data type.

Definition at line 58 of file term.c.

◆ VOLK_default_datatype

VOLK_Term* VOLK_default_datatype
extern

Default literal data type URI.

Literal terms created with undefined data type will have it set to this URI implicitly.

Definition at line 60 of file term.c.

◆ VOLK_term_cache

VOLK_TermSet* VOLK_term_cache
extern

Global term cache.

Stores frequently used terms, e.g. data type URIs.

Definition at line 61 of file term.c.

◆ VOLK_default_ctx

VOLK_Term* VOLK_default_ctx
extern

Default context.

Definition at line 59 of file term.c.