|
@@ -7,15 +7,12 @@
|
|
static int
|
|
static int
|
|
_graph_new (LSUP_StoreType type)
|
|
_graph_new (LSUP_StoreType type)
|
|
{
|
|
{
|
|
- const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
-
|
|
|
|
LSUP_Graph *gr;
|
|
LSUP_Graph *gr;
|
|
LSUP_Store *store = NULL;
|
|
LSUP_Store *store = NULL;
|
|
if (type == LSUP_STORE_HTABLE) {
|
|
if (type == LSUP_STORE_HTABLE) {
|
|
gr = LSUP_graph_new (NULL, NULL, NULL);
|
|
gr = LSUP_graph_new (NULL, NULL, NULL);
|
|
} else {
|
|
} else {
|
|
- store = LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ store = LSUP_store_new (type, NULL, 0, true);
|
|
gr = LSUP_graph_new (store, NULL, NULL);
|
|
gr = LSUP_graph_new (store, NULL, NULL);
|
|
}
|
|
}
|
|
ASSERT (gr != NULL, "Error creating graph!");
|
|
ASSERT (gr != NULL, "Error creating graph!");
|
|
@@ -24,6 +21,7 @@ _graph_new (LSUP_StoreType type)
|
|
EXPECT_STR_EQ (LSUP_graph_uri (gr)->data, "urn:gr:1");
|
|
EXPECT_STR_EQ (LSUP_graph_uri (gr)->data, "urn:gr:1");
|
|
|
|
|
|
// Check that setup function is idempotent with clear == false.
|
|
// Check that setup function is idempotent with clear == false.
|
|
|
|
+ const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
if (sif->setup_fn) EXPECT_INT_EQ (
|
|
if (sif->setup_fn) EXPECT_INT_EQ (
|
|
sif->setup_fn (NULL, false), LSUP_NOACTION);
|
|
sif->setup_fn (NULL, false), LSUP_NOACTION);
|
|
|
|
|
|
@@ -44,7 +42,6 @@ static int
|
|
_graph_ns_uri (LSUP_StoreType type)
|
|
_graph_ns_uri (LSUP_StoreType type)
|
|
{
|
|
{
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
|
|
|
|
LSUP_NSMap *nsm = LSUP_nsmap_new();
|
|
LSUP_NSMap *nsm = LSUP_nsmap_new();
|
|
LSUP_nsmap_add (nsm, "ns1", "urn:ns1#");
|
|
LSUP_nsmap_add (nsm, "ns1", "urn:ns1#");
|
|
@@ -54,7 +51,7 @@ _graph_ns_uri (LSUP_StoreType type)
|
|
LSUP_Graph *gr;
|
|
LSUP_Graph *gr;
|
|
LSUP_Store *store = NULL;
|
|
LSUP_Store *store = NULL;
|
|
if (sif->features & LSUP_STORE_PERM) {
|
|
if (sif->features & LSUP_STORE_PERM) {
|
|
- store = LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ store = LSUP_store_new (type, NULL, 0, true);
|
|
store->sif->nsm_put_fn (store->data, nsm, NULL);
|
|
store->sif->nsm_put_fn (store->data, nsm, NULL);
|
|
}
|
|
}
|
|
gr = LSUP_graph_new (store, "ns1:gr1", nsm);
|
|
gr = LSUP_graph_new (store, "ns1:gr1", nsm);
|
|
@@ -81,15 +78,12 @@ _graph_ns_uri (LSUP_StoreType type)
|
|
static int
|
|
static int
|
|
_graph_add (LSUP_StoreType type)
|
|
_graph_add (LSUP_StoreType type)
|
|
{
|
|
{
|
|
- const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
-
|
|
|
|
LSUP_Triple **trp = create_triples();
|
|
LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
LSUP_Graph *gr;
|
|
LSUP_Graph *gr;
|
|
LSUP_Store *store;
|
|
LSUP_Store *store;
|
|
if (type == LSUP_STORE_HTABLE) store = NULL;
|
|
if (type == LSUP_STORE_HTABLE) store = NULL;
|
|
- else store = LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ else store = LSUP_store_new (type, NULL, 0, true);
|
|
|
|
|
|
gr = LSUP_graph_new (store, NULL, NULL);
|
|
gr = LSUP_graph_new (store, NULL, NULL);
|
|
ASSERT (gr != NULL, "Error creating graph!");
|
|
ASSERT (gr != NULL, "Error creating graph!");
|
|
@@ -136,13 +130,11 @@ _graph_get (LSUP_StoreType type)
|
|
// Skip if the store doesn't support contexts.
|
|
// Skip if the store doesn't support contexts.
|
|
if (!(sif->features & LSUP_STORE_CTX)) return 0;
|
|
if (!(sif->features & LSUP_STORE_CTX)) return 0;
|
|
|
|
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
-
|
|
|
|
LSUP_Triple **trp = create_triples();
|
|
LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
LSUP_Store *store;
|
|
LSUP_Store *store;
|
|
if (type == LSUP_STORE_HTABLE) store = NULL;
|
|
if (type == LSUP_STORE_HTABLE) store = NULL;
|
|
- else store = LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ else store = LSUP_store_new (type, NULL, 0, true);
|
|
LSUP_Graph
|
|
LSUP_Graph
|
|
*gr1 = LSUP_graph_new (store, NULL, NULL),
|
|
*gr1 = LSUP_graph_new (store, NULL, NULL),
|
|
*gr2 = LSUP_graph_new (store, NULL, NULL);
|
|
*gr2 = LSUP_graph_new (store, NULL, NULL);
|
|
@@ -195,15 +187,11 @@ _graph_get (LSUP_StoreType type)
|
|
static int
|
|
static int
|
|
_graph_link_map (LSUP_StoreType type)
|
|
_graph_link_map (LSUP_StoreType type)
|
|
{
|
|
{
|
|
- const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
|
|
-
|
|
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
-
|
|
|
|
LSUP_Triple **trp = create_triples();
|
|
LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
LSUP_Store *store;
|
|
LSUP_Store *store;
|
|
if (type == LSUP_STORE_HTABLE) store = NULL;
|
|
if (type == LSUP_STORE_HTABLE) store = NULL;
|
|
- else store = LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ else store = LSUP_store_new (type, NULL, 0, true);
|
|
LSUP_Graph *gr = LSUP_graph_new (store, NULL, NULL);
|
|
LSUP_Graph *gr = LSUP_graph_new (store, NULL, NULL);
|
|
|
|
|
|
size_t ct;
|
|
size_t ct;
|
|
@@ -314,13 +302,11 @@ _graph_bool_ops (LSUP_StoreType type)
|
|
// Skip if the store doesn't support contexts.
|
|
// Skip if the store doesn't support contexts.
|
|
if (!(sif->features & LSUP_STORE_CTX)) return 0;
|
|
if (!(sif->features & LSUP_STORE_CTX)) return 0;
|
|
|
|
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
-
|
|
|
|
LSUP_Triple **trp = create_triples();
|
|
LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
LSUP_Store *store;
|
|
LSUP_Store *store;
|
|
if (type == LSUP_STORE_HTABLE) store = NULL;
|
|
if (type == LSUP_STORE_HTABLE) store = NULL;
|
|
- else store = LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ else store = LSUP_store_new (type, NULL, 0, true);
|
|
LSUP_Graph
|
|
LSUP_Graph
|
|
*gr1 = LSUP_graph_new (store, NULL, NULL),
|
|
*gr1 = LSUP_graph_new (store, NULL, NULL),
|
|
*gr2 = LSUP_graph_new (store, NULL, NULL),
|
|
*gr2 = LSUP_graph_new (store, NULL, NULL),
|
|
@@ -417,7 +403,6 @@ _graph_bool_ops (LSUP_StoreType type)
|
|
static int
|
|
static int
|
|
_graph_lookup (LSUP_StoreType type)
|
|
_graph_lookup (LSUP_StoreType type)
|
|
{
|
|
{
|
|
- const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
|
|
LSUP_Triple **trp = create_triples();
|
|
LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
// Lookup triples.
|
|
// Lookup triples.
|
|
@@ -466,14 +451,12 @@ _graph_lookup (LSUP_StoreType type)
|
|
};
|
|
};
|
|
*/
|
|
*/
|
|
|
|
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
-
|
|
|
|
LSUP_Graph *gr;
|
|
LSUP_Graph *gr;
|
|
LSUP_Store *store = NULL;
|
|
LSUP_Store *store = NULL;
|
|
if (type == LSUP_STORE_HTABLE) {
|
|
if (type == LSUP_STORE_HTABLE) {
|
|
gr = LSUP_graph_new (NULL, NULL, NULL);
|
|
gr = LSUP_graph_new (NULL, NULL, NULL);
|
|
} else {
|
|
} else {
|
|
- store = LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ store = LSUP_store_new (type, NULL, 0, true);
|
|
gr = LSUP_graph_new (store, NULL, NULL);
|
|
gr = LSUP_graph_new (store, NULL, NULL);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -534,9 +517,6 @@ _graph_lookup (LSUP_StoreType type)
|
|
static int
|
|
static int
|
|
_graph_remove (LSUP_StoreType type)
|
|
_graph_remove (LSUP_StoreType type)
|
|
{
|
|
{
|
|
- const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
-
|
|
|
|
LSUP_Triple **trp = create_triples();
|
|
LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
LSUP_Graph *gr;
|
|
LSUP_Graph *gr;
|
|
@@ -544,7 +524,7 @@ _graph_remove (LSUP_StoreType type)
|
|
if (type == LSUP_STORE_HTABLE) {
|
|
if (type == LSUP_STORE_HTABLE) {
|
|
gr = LSUP_graph_new (NULL, NULL, NULL);
|
|
gr = LSUP_graph_new (NULL, NULL, NULL);
|
|
} else {
|
|
} else {
|
|
- store = LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ store = LSUP_store_new (type, NULL, 0, true);
|
|
gr = LSUP_graph_new (store, NULL, NULL);
|
|
gr = LSUP_graph_new (store, NULL, NULL);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -586,14 +566,12 @@ _graph_txn (LSUP_StoreType type)
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
if (!(sif->features & LSUP_STORE_TXN)) return 0;
|
|
if (!(sif->features & LSUP_STORE_TXN)) return 0;
|
|
|
|
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
-
|
|
|
|
LSUP_Triple **trp = create_triples();
|
|
LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
LSUP_Graph *gr;
|
|
LSUP_Graph *gr;
|
|
LSUP_Store *store =
|
|
LSUP_Store *store =
|
|
type == LSUP_STORE_HTABLE ? NULL
|
|
type == LSUP_STORE_HTABLE ? NULL
|
|
- : LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ : LSUP_store_new (type, NULL, 0, true);
|
|
|
|
|
|
gr = LSUP_graph_new (store, NULL, NULL);
|
|
gr = LSUP_graph_new (store, NULL, NULL);
|
|
|
|
|
|
@@ -628,10 +606,6 @@ _graph_txn (LSUP_StoreType type)
|
|
static int
|
|
static int
|
|
_graph_relative (LSUP_StoreType type)
|
|
_graph_relative (LSUP_StoreType type)
|
|
{
|
|
{
|
|
- const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
|
|
-
|
|
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
-
|
|
|
|
LSUP_Term
|
|
LSUP_Term
|
|
*s = LSUP_iriref_new ("http://onto.knowledgetx.com/gr1/s1", NULL),
|
|
*s = LSUP_iriref_new ("http://onto.knowledgetx.com/gr1/s1", NULL),
|
|
*s2 = LSUP_iriref_new ("http://onto.knowledgetx.com/gr2/s1", NULL),
|
|
*s2 = LSUP_iriref_new ("http://onto.knowledgetx.com/gr2/s1", NULL),
|
|
@@ -649,7 +623,7 @@ _graph_relative (LSUP_StoreType type)
|
|
|
|
|
|
LSUP_Store *store =
|
|
LSUP_Store *store =
|
|
type == LSUP_STORE_HTABLE ? NULL
|
|
type == LSUP_STORE_HTABLE ? NULL
|
|
- : LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ : LSUP_store_new (type, NULL, 0, true);
|
|
|
|
|
|
LSUP_Graph *gr = LSUP_graph_new (store, c->data, NULL);
|
|
LSUP_Graph *gr = LSUP_graph_new (store, c->data, NULL);
|
|
|
|
|
|
@@ -690,9 +664,7 @@ _graph_list (LSUP_StoreType type)
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
if (!(sif->features & LSUP_STORE_CTX)) return 0;
|
|
if (!(sif->features & LSUP_STORE_CTX)) return 0;
|
|
|
|
|
|
- if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
-
|
|
|
|
- LSUP_Store *store = LSUP_store_new (type, NULL, 0);
|
|
|
|
|
|
+ LSUP_Store *store = LSUP_store_new (type, NULL, 0, true);
|
|
|
|
|
|
LSUP_Graph *gg[3] = {
|
|
LSUP_Graph *gg[3] = {
|
|
LSUP_graph_new (store, "urn:gr:1", NULL),
|
|
LSUP_graph_new (store, "urn:gr:1", NULL),
|