summaryrefslogtreecommitdiffstats
path: root/sord
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-16 00:43:58 +0000
committerDavid Robillard <d@drobilla.net>2011-02-16 00:43:58 +0000
commit228533ee26fa5ee8b33e4be61e036550fafe4239 (patch)
tree86340a4bc225e21197c79a16e167a92cd204d159 /sord
parent9bcc1bf6088ed17d0a753ebf41c989af4d0e71eb (diff)
downloadsord-228533ee26fa5ee8b33e4be61e036550fafe4239.tar.gz
sord-228533ee26fa5ee8b33e4be61e036550fafe4239.tar.bz2
sord-228533ee26fa5ee8b33e4be61e036550fafe4239.zip
Remove pointless SordID type.
git-svn-id: http://svn.drobilla.net/sord/trunk@31 3d64ff67-21c5-427c-a301-fe4f08042e5a
Diffstat (limited to 'sord')
-rw-r--r--sord/sord.h62
1 files changed, 23 insertions, 39 deletions
diff --git a/sord/sord.h b/sord/sord.h
index bc69875..90c3bf6 100644
--- a/sord/sord.h
+++ b/sord/sord.h
@@ -53,12 +53,11 @@
typedef struct _Sord* Sord; ///< Quad store
typedef struct _SordIter* SordIter; ///< Store iterator
typedef struct _SordNode* SordNode; ///< Node
-typedef void* SordID; ///< Integer ID of a Node (0 reserved for NULL)
/** Quad of IDs (statement), or a quad pattern.
* Nodes are ordered (S P O G). The ID of the default graph is 0.
*/
-typedef SordID SordQuad[4];
+typedef SordNode SordQuad[4];
/** Index into a SordQuad. */
typedef enum {
@@ -89,85 +88,70 @@ typedef enum {
* @{
*/
-/** Create a new store. */
+/** Create a new store.
+ * @param indices SordIndexOption flags (e.g. SORD_SPO|SORD_OPS).
+ * Be sure to choose indices such that there is an index where the most
+ * significant node(s) are not variables for your queries. For example,
+ * if you are going to make (? P O) queries, you should enable either
+ * SORD_OPS or SORD_POS.
+ * @param graphs If true, store (and index) graph contexts.
+ */
SORD_API
Sord
sord_new(unsigned indices, bool graphs);
-/** Close and free @a sord, leaving disk data intact. */
+/** Close and free @a sord. */
SORD_API
void
sord_free(Sord sord);
/** @} */
-/** @name Node Loading
- * Searching for node IDs by value and loading nodes from disk by ID.
+/** @name Nodes
+ * A Node is a component of a Quad. Nodes may be URIs, blank nodes, or
+ * (in the case of quad objects only) string literals. Literal nodes may
+ * have an associate language or datatype (but not both).
* @{
*/
-/** Dereference an ID, loading node data into memory.
- * The returned node is allocated memory owned by @a sord,
- * it can only be freed by the caller via sord_clear_cache.
- */
-SORD_API
-SordNode
-sord_node_load(Sord sord, SordID id);
-
-/** Set @a s, @a p, and @a o to the nodes in @a tup. */
-SORD_API
-void
-sord_quad_load(Sord sord,
- SordQuad tup,
- SordNode* s,
- SordNode* p,
- SordNode* o);
-
/** Find a URI, creating a new one if necessary iff @a create is true.
* Use sord_get_uri_counted instead if the length of @a str is known.
*/
SORD_API
-SordID
+SordNode
sord_get_uri(Sord sord, bool create, const uint8_t* str);
/** Find a URI, creating a new one if necessary iff @a create is true. */
SORD_API
-SordID
+SordNode
sord_get_uri_counted(Sord sord, bool create, const uint8_t* str, int str_len);
/** Find a blank, creating a new one if necessary iff @a create is true
* Use sord_get_blank_counted instead if the length of @a str is known.
*/
SORD_API
-SordID
+SordNode
sord_get_blank(Sord sord, bool create, const uint8_t* str);
/** Find a blank, creating a new one if necessary iff @a create is true. */
SORD_API
-SordID
+SordNode
sord_get_blank_counted(Sord sord, bool create, const uint8_t* str, int str_len);
/** Find a literal, creating a new one if necessary iff @a create is true.
* Use sord_get_literal_counted instead if the length of @a str is known.
*/
SORD_API
-SordID
-sord_get_literal(Sord sord, bool create, SordID type,
+SordNode
+sord_get_literal(Sord sord, bool create, SordNode type,
const uint8_t* str, const char* lang);
/** Find a literal, creating a new one if necessary iff @a create is true. */
SORD_API
-SordID
-sord_get_literal_counted(Sord sord, bool create, SordID type,
+SordNode
+sord_get_literal_counted(Sord sord, bool create, SordNode type,
const uint8_t* str, int str_len,
const char* lang, uint8_t lang_len);
-
-/** @} */
-/** @name Node Values
- * Investigating loaded (in-memory) node values.
- * @{
- */
-
/** Return the type of a node (SORD_URI, SORD_BLANK, or SORD_LITERAL). */
SORD_API
SordNodeType
@@ -259,7 +243,7 @@ sord_remove_iter(Sord sord, SordIter iter);
/** Remove a graph from the store. */
SORD_API
void
-sord_remove_graph(Sord sord, SordID graph);
+sord_remove_graph(Sord sord, SordNode graph);
/** @} */
/** @name Iteration