|
Volksdata 1.0b7
RDF library
|

Macros | |
| #define | VOLK_graph_get(...) |
| Non-transactional version of VOLK_graph_get_txn(). | |
| #define | VOLK_graph_copy_contents(...) |
| #define | VOLK_graph_copy(src, dest) |
| #define | VOLK_graph_bool_op(...) |
| Non-transactional version of VOLK_graph_bool_op_txn. | |
| #define | VOLK_graph_add_init(...) |
| Non-transactional version of VOLK_graph_add_init_txn(). | |
| #define | VOLK_graph_add(...) |
| Non-transactional version of VOLK_graph_add_txn. | |
| #define | VOLK_graph_remove(...) |
| Non-transactional version of VOLK_graph_remove_txn. | |
| #define | VOLK_graph_lookup(...) |
| Non-transactional version of VOLK_graph_lookup_txn. | |
| #define | VOLK_graph_list(...) |
| Non-transactional version of VOLK_graph_list_txn. | |
Functions | |
| VOLK_Graph * | VOLK_graph_new (VOLK_Store *store, const char *uri_str) |
| Create new graph. | |
| VOLK_Graph * | VOLK_graph_new_ns (VOLK_Store *store, const char *ns_str) |
| Create an empty graph using a namespace-prefixed string for its URI. | |
| VOLK_Graph * | VOLK_graph_get_txn (void *txn, VOLK_Store *store, const VOLK_Term *uri, size_t *ct) |
| Create a temp graph from stored triples. | |
| VOLK_rc | VOLK_graph_copy_contents_txn (void *txn, const VOLK_Graph *src, VOLK_Graph *dest, const VOLK_Term *s, const VOLK_Term *p, const VOLK_Term *o) |
| Copy triples from a source graph into a destination one. | |
| VOLK_rc | VOLK_graph_bool_op_txn (void *txn, const VOLK_bool_op op, const VOLK_Graph *gr1, const VOLK_Graph *gr2, VOLK_Graph *res) |
| void | VOLK_graph_free (VOLK_Graph *gr) |
| Free a graph. | |
| bool | VOLK_graph_equals (const VOLK_Graph *gr1, const VOLK_Graph *gr2) |
| Compare two graphs. | |
| const VOLK_Term * | VOLK_graph_uri (const VOLK_Graph *gr) |
| Read-only graph URI. | |
| VOLK_Store * | VOLK_graph_store (const VOLK_Graph *gr) |
| Underlying graph store handle. | |
| VOLK_rc | VOLK_graph_set_uri (VOLK_Graph *gr, const char *uri_str) |
| size_t | VOLK_graph_size (const VOLK_Graph *gr) |
| Number of triples in a graph. | |
| bool | VOLK_graph_contains (const VOLK_Graph *gr, const VOLK_Triple *spo) |
| Whether a graph contains a triple. | |
| VOLK_GraphIterator * | VOLK_graph_add_init_txn (void *txn, VOLK_Graph *gr) |
| Initialize an iterator to add triples. | |
| VOLK_rc | VOLK_graph_add_iter (VOLK_GraphIterator *it, const VOLK_Triple *spo) |
| Add a single triple to the store. | |
| VOLK_rc | VOLK_graph_add_txn (void *txn, VOLK_Graph *gr, VOLK_Triple *const *trp, size_t *ct) |
| Add triples to a graph. | |
| VOLK_rc | VOLK_graph_remove_txn (void *txn, VOLK_Graph *gr, const VOLK_Term *s, const VOLK_Term *p, const VOLK_Term *o, size_t *ct) |
| Delete triples by a matching pattern. | |
| VOLK_GraphIterator * | VOLK_graph_lookup_txn (void *txn, const VOLK_Graph *gr, const VOLK_Term *s, const VOLK_Term *p, const VOLK_Term *o, size_t *ct) |
| Look up triples by a matching pattern and yield an iterator. | |
| VOLK_rc | VOLK_graph_iter_next (VOLK_GraphIterator *it, VOLK_Triple **spo) |
| Advance a cursor obtained by a lookup and return a matching triple. | |
| const VOLK_Graph * | VOLK_graph_iter_graph (VOLK_GraphIterator *it) |
| Return the graph related to an iterator. | |
| void | VOLK_graph_iter_free (VOLK_GraphIterator *it) |
| Free a graph iterator. | |
| void | VOLK_graph_print (const VOLK_Graph *gr) |
| Print graph information and triples to stdout. | |
| VOLK_LinkMap * | VOLK_graph_connections (const VOLK_Graph *gr, const VOLK_Term *t, const VOLK_LinkType type) |
| Get term pairs connected to a term in a graph. | |
| VOLK_TermSet * | VOLK_graph_term_set (const VOLK_Graph *gr, const VOLK_Term *t1, const VOLK_TriplePos t1_pos, const VOLK_Term *t2, const VOLK_TriplePos t2_pos) |
| Get a list of terms related to a term pair in a graph. | |
| VOLK_TermSet * | VOLK_graph_unique_terms (const VOLK_Graph *gr, VOLK_TriplePos pos) |
| Get all unique subjcts, predicates, or objects in a graph. | |
| VOLK_TermSet * | VOLK_graph_list_txn (void *txn, VOLK_Store *store) |
| List all graph URIs in a store. | |
| size_t | VOLK_graph_add_link_map (VOLK_GraphIterator *it, VOLK_LinkMap *lm) |
| Add triples for a term and related link map to a graph. | |
| VOLK_Term * | VOLK_bnode_add_collection (VOLK_GraphIterator *it, VOLK_TermSet *ts) |
| Add triples for an anonymous collection to a graph. | |
| #define VOLK_graph_get | ( | ... | ) |
Non-transactional version of VOLK_graph_get_txn().
| #define VOLK_graph_copy_contents | ( | ... | ) |
| #define VOLK_graph_copy | ( | src, | |
| dest ) |
| #define VOLK_graph_bool_op | ( | ... | ) |
Non-transactional version of VOLK_graph_bool_op_txn.
| #define VOLK_graph_add_init | ( | ... | ) |
Non-transactional version of VOLK_graph_add_init_txn().
| #define VOLK_graph_add | ( | ... | ) |
Non-transactional version of VOLK_graph_add_txn.
| #define VOLK_graph_remove | ( | ... | ) |
Non-transactional version of VOLK_graph_remove_txn.
| #define VOLK_graph_lookup | ( | ... | ) |
Non-transactional version of VOLK_graph_lookup_txn.
| #define VOLK_graph_list | ( | ... | ) |
Non-transactional version of VOLK_graph_list_txn.
| VOLK_Graph * VOLK_graph_new | ( | VOLK_Store * | store, |
| const char * | uri_str ) |
Create new graph.
| [in] | store | Back end store handle. It may be the result of VOLK_store_new(), or NULL; in the latter case, it defaults to a temporary HTable store that is freed together with the graph. |
| [in] | uri_str | URI string of the new graph. It MUST be a non-prefixed URI. For a namespace-prefixed URI, use VOLK_graph_new_ns(). If NULL, a UUID4 URN is generated. |
|
inline |
Create an empty graph using a namespace-prefixed string for its URI.
| [in] | store | Back end store handle. It may be the result of VOLK_store_new(), or NULL; in the latter case, it defaults to a temporary HTable store that is freed together with the graph. |
| [in] | ns_str | URI string of the new graph. It MUST be a namespace- prefixed URI registered in the global namespace map. It cannot be NULL. |
| VOLK_Graph * VOLK_graph_get_txn | ( | void * | txn, |
| VOLK_Store * | store, | ||
| const VOLK_Term * | uri, | ||
| size_t * | ct ) |
Create a temp graph from stored triples.
The new graph is stored in a hash map and is made up of all the triples found in the store with the given context URI. The new graph URI is the same as the given context.
| [in] | txn | Transaction handle. If not NULL, new child transaction will be opened under the one provided. |
| [in] | store | Back end store handle. |
| [in] | uri | URI of the graph to retrieve. |
| [out] | ct | If not NULL, it will be populated with the number of triples found. TODO deprecate. VOLK_graph_size() does the same. |
| VOLK_rc VOLK_graph_copy_contents_txn | ( | void * | txn, |
| const VOLK_Graph * | src, | ||
| VOLK_Graph * | dest, | ||
| const VOLK_Term * | s, | ||
| const VOLK_Term * | p, | ||
| const VOLK_Term * | o ) |
Copy triples from a source graph into a destination one.
The destination graph is not initialized here, so the copy is cumulative.
A 3-term pattern may be provided to filter triples to be extracted from the source graph. If all terms are NULL, all triples are copied.
| [in] | txn | Transaction handle. It may be NULL, or an open transaction handle, in which case the copy is done within the specified transaction. |
| [in] | src | Source graph. |
| [in] | dest | Destination graph. |
| [in] | s,p,o | Terms to look up for filtering. Any and all terms can be NULL, which indicate unbound terms. |
| VOLK_rc VOLK_graph_bool_op_txn | ( | void * | txn, |
| const VOLK_bool_op | op, | ||
| const VOLK_Graph * | gr1, | ||
| const VOLK_Graph * | gr2, | ||
| VOLK_Graph * | res ) |
Perform a boolean operation between two graphs.
This method populates an initialized graph with the result of the operation between two other graphs. The resulting graph may be of any store type and may be the result of graphs of different store types.
| [in] | txn | R/W transaction handle for the destination store. It may be NULL, or an open transaction within which the operation is performed. |
| [in] | op | Operation to perform. One of VOLK_bool_op. |
| [in] | gr1 | First operand. |
| [in] | gr2 | Second operand. |
| [out] | res | Result graph. The handle should be initialized via VOLK_graph_new() or equivalent. Any preexisting contents are not removed. If an unrecoverable error occurs, this graph is freed, and any preexisting triples are lost. Therefore, reusing a result graph handle should only be done in tightly controlled loops or sequences. |
| bool VOLK_graph_equals | ( | const VOLK_Graph * | gr1, |
| const VOLK_Graph * | gr2 ) |
Compare two graphs.
Note that if any of the two graphs has an open transaction, the function is performed in the first graph's transaction.
| [in] | gr1 | First operand. |
| [in] | gr2 | Second operand. |
| const VOLK_Term * VOLK_graph_uri | ( | const VOLK_Graph * | gr | ) |
Read-only graph URI.
Note that, while VOLK_graph_new() and VOLK_graph_set_uri() expect a string, this function returns the complete VOLK_Term structure.
To change the graph URI, use VOLK_graph_set_uri.
| VOLK_Store * VOLK_graph_store | ( | const VOLK_Graph * | gr | ) |
| VOLK_rc VOLK_graph_set_uri | ( | VOLK_Graph * | gr, |
| const char * | uri_str ) |
Set the URI of a graph.
Note that by changing the URI of a graph backed by a context-sensitive store (i.e. VOLK_STORE_MDB*) effectively changes the underlying context that the triples are bound to. Triples are looked up in, and added to, the context that the graph URI represents. A non-context graph retains the same triple set when a graph URI changes, and relative URI lookups are resolved in real-time against the current graph URI.
| [in] | gr | Graph handle. |
| [in] | uri_str | New URI string. If namespace-prefixed, it will be resolved according to the graph's namespace map. |
| size_t VOLK_graph_size | ( | const VOLK_Graph * | gr | ) |
| bool VOLK_graph_contains | ( | const VOLK_Graph * | gr, |
| const VOLK_Triple * | spo ) |
| VOLK_GraphIterator * VOLK_graph_add_init_txn | ( | void * | txn, |
| VOLK_Graph * | gr ) |
Initialize an iterator to add triples.
| [in] | txn | Transaction handle. It may be NULL. If not NULL, its handle will be bound to the iterator handle for its whole life cycle. |
| [in] | gr | Graph to add to. It is added to the iterator state. |
| VOLK_rc VOLK_graph_add_iter | ( | VOLK_GraphIterator * | it, |
| const VOLK_Triple * | spo ) |
Add a single triple to the store.
| [in] | it | Iterator obtained with VOLK_graph_add_init_txn(). |
| [in] | spo | Triple to add. Caller retains ownership. NOTE: the triple subject and object, if IRIRefs, are stored as relative to the graph URI. |
| VOLK_rc VOLK_graph_add_txn | ( | void * | txn, |
| VOLK_Graph * | gr, | ||
| VOLK_Triple *const * | trp, | ||
| size_t * | ct ) |
| VOLK_rc VOLK_graph_remove_txn | ( | void * | txn, |
| VOLK_Graph * | gr, | ||
| const VOLK_Term * | s, | ||
| const VOLK_Term * | p, | ||
| const VOLK_Term * | o, | ||
| size_t * | ct ) |
Delete triples by a matching pattern.
| [in] | txn | Transaction handle. It may be NULL. |
| [in] | gr | Graph to delete triples from. |
| [in] | s,p,o | Matching pattern. Any and all of s, p, o can be NULL. |
| [out] | ct | If not NULL it is populated with the number of triples deleted. |
| VOLK_GraphIterator * VOLK_graph_lookup_txn | ( | void * | txn, |
| const VOLK_Graph * | gr, | ||
| const VOLK_Term * | s, | ||
| const VOLK_Term * | p, | ||
| const VOLK_Term * | o, | ||
| size_t * | ct ) |
Look up triples by a matching pattern and yield an iterator.
| [in] | txn | Transaction handle. It may be NULL. |
| [in] | gr | Graph to look up. |
| [in] | s | Subject to look for. It can be NULL, which indicates an unbound term. |
| [in] | p | Predicate to look for. It can be NULL, which indicates an unbound term. |
| [in] | o | Object to look for. It can be NULL, which indicates an unbound term. |
| [out] | ct | If not NULL, this handle is populated with the number of entries found. |
| VOLK_rc VOLK_graph_iter_next | ( | VOLK_GraphIterator * | it, |
| VOLK_Triple ** | spo ) |
Advance a cursor obtained by a lookup and return a matching triple.
| [in] | it | Iterator handle obtained through VOLK_graph_lookup_txn. |
| [out] | spo | Triple handle pointer to be populated with the next result. If not NULL, it will allocate a new triple and new terms, and should be freed with VOLK_triple_free(). |
| const VOLK_Graph * VOLK_graph_iter_graph | ( | VOLK_GraphIterator * | it | ) |
| void VOLK_graph_iter_free | ( | VOLK_GraphIterator * | it | ) |
Free a graph iterator.
DO NOT USE with iterators obtained with VOLK_graph_add_init_txn(). Use VOLK_graph_iter_free() with those.
| [in] | it | Iterator to finalize. |
| void VOLK_graph_print | ( | const VOLK_Graph * | gr | ) |
| VOLK_LinkMap * VOLK_graph_connections | ( | const VOLK_Graph * | gr, |
| const VOLK_Term * | t, | ||
| const VOLK_LinkType | type ) |
Get term pairs connected to a term in a graph.
This returns a VOLK_LinkMap extracted from a graph for a given term. The map can generate triples using VOLK_link_map_triples().
Depending on the type requested (VOLK_CONN_*), the term can be leveraged as a subject, predicate, or object.
| [in] | gr | Graph to extract the connection list from. |
| [in] | t | Term to query for connections. |
| [in] | type | Type of connections to look up. |
| VOLK_TermSet * VOLK_graph_term_set | ( | const VOLK_Graph * | gr, |
| const VOLK_Term * | t1, | ||
| const VOLK_TriplePos | t1_pos, | ||
| const VOLK_Term * | t2, | ||
| const VOLK_TriplePos | t2_pos ) |
Get a list of terms related to a term pair in a graph.
| [in] | gr | Graph to extract terms from. |
| [in] | t1 | First term. |
| [in] | t1_pos | Position of the first term in the triples to look up. |
| [in] | t2 | Second term. |
| [in] | t2_pos | Position of the second term in the triples to look up. |
| VOLK_TermSet * VOLK_graph_unique_terms | ( | const VOLK_Graph * | gr, |
| VOLK_TriplePos | pos ) |
| VOLK_TermSet * VOLK_graph_list_txn | ( | void * | txn, |
| VOLK_Store * | store ) |
| size_t VOLK_graph_add_link_map | ( | VOLK_GraphIterator * | it, |
| VOLK_LinkMap * | lm ) |
Add triples for a term and related link map to a graph.
The link map can be of inbound, outbound, or edge type; depending on that, triples are added with the given term as the subject, the predicate, or the object.
| [in] | it | Graph iterator obtained with VOLK_graph_add_init_txn(). |
| [in] | lm | Link map. |
| VOLK_Term * VOLK_bnode_add_collection | ( | VOLK_GraphIterator * | it, |
| VOLK_TermSet * | ts ) |
Add triples for an anonymous collection to a graph.
The rdf:first, rdf:rest, etc. terms are automatically added and the term for the first item in the list is returned.
| [in] | it | Graph iterator to use for insertion. |
| [in] | ts | Source term set. |