summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sord.c2
-rw-r--r--src/sord_test.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/sord.c b/src/sord.c
index 9a0dd58..218234b 100644
--- a/src/sord.c
+++ b/src/sord.c
@@ -1266,7 +1266,7 @@ sord_erase(SordModel* sord, SordIter* iter)
SordNode* quad = NULL;
for (unsigned i = 0; i < NUM_ORDERS; ++i) {
- if (sord->indices[i]) {
+ if (sord->indices[i] && (i < GSPO || tup[3])) {
if (zix_btree_remove(sord->indices[i], tup, (void**)&quad,
i == iter->order ? &iter->cur : NULL)) {
return (i == 0) ? SERD_ERR_NOT_FOUND : SERD_ERR_INTERNAL;
diff --git a/src/sord_test.c b/src/sord_test.c
index 5eeb6d6..6c74017 100644
--- a/src/sord_test.c
+++ b/src/sord_test.c
@@ -684,9 +684,10 @@ main(int argc, char** argv)
}
sord_iter_free(iter);
+ // Erase the first tuple (an element in the default graph)
iter = sord_begin(sord);
- if (!sord_erase(sord, iter)) {
- return test_fail("Succesfully erased iterator on empty model\n");
+ if (sord_erase(sord, iter)) {
+ return test_fail("Failed to erase begin iterator on non-empty model\n");
}
// Ensure only the other graph is left