|
@@ -11,8 +11,7 @@ LSR_desc_new_multi (LSUP_Graph *const *data, LSR_Desc **rsrc_p)
|
|
uuid_generate_random (rsrc->id);
|
|
uuid_generate_random (rsrc->id);
|
|
|
|
|
|
// Default context graph.
|
|
// Default context graph.
|
|
- rsrc->main_data = LSUP_graph_new (
|
|
|
|
- NULL, LSUP_term_copy (LSUP_default_ctx), NULL);
|
|
|
|
|
|
+ rsrc->main_data = LSUP_graph_new (NULL, LSUP_default_ctx, NULL);
|
|
log_debug (
|
|
log_debug (
|
|
"Main data graph: %s",
|
|
"Main data graph: %s",
|
|
LSUP_graph_uri(rsrc->main_data)->data);
|
|
LSUP_graph_uri(rsrc->main_data)->data);
|
|
@@ -51,8 +50,7 @@ LSR_desc_new_multi (LSUP_Graph *const *data, LSR_Desc **rsrc_p)
|
|
LSUP_term_free (rel_uri);
|
|
LSUP_term_free (rel_uri);
|
|
if (rc < 0) goto finally;
|
|
if (rc < 0) goto finally;
|
|
|
|
|
|
- rsrc->user_data[i] = LSUP_graph_new (
|
|
|
|
- NULL, LSUP_term_copy (gr_uri), NULL);
|
|
|
|
|
|
+ rsrc->user_data[i] = LSUP_graph_new (NULL, gr_uri, NULL);
|
|
log_debug (
|
|
log_debug (
|
|
"User data graph (@%p): %s",
|
|
"User data graph (@%p): %s",
|
|
LSUP_graph_uri(rsrc->user_data[i]),
|
|
LSUP_graph_uri(rsrc->user_data[i]),
|
|
@@ -231,6 +229,7 @@ loop_end:
|
|
LSUP_triple_init (dest_spo, dest_s, dest_p, dest_o);
|
|
LSUP_triple_init (dest_spo, dest_s, dest_p, dest_o);
|
|
LSUP_graph_add_iter (admin_add_it, dest_spo);
|
|
LSUP_graph_add_iter (admin_add_it, dest_spo);
|
|
LSUP_term_free (dest_p);
|
|
LSUP_term_free (dest_p);
|
|
|
|
+ LSUP_term_free (dest_s); // === gr_uri
|
|
|
|
|
|
LSUP_graph_add_done (admin_add_it);
|
|
LSUP_graph_add_done (admin_add_it);
|
|
admin_add_it = NULL;
|
|
admin_add_it = NULL;
|
|
@@ -301,8 +300,7 @@ LSR_desc_store (const LSR_Desc *rsrc)
|
|
LSUP_rc rc = LSUP_NOACTION;
|
|
LSUP_rc rc = LSUP_NOACTION;
|
|
for (size_t i = 0; rsrc->user_data[i] != NULL; i++) {
|
|
for (size_t i = 0; rsrc->user_data[i] != NULL; i++) {
|
|
tmp_gr = LSUP_graph_new (
|
|
tmp_gr = LSUP_graph_new (
|
|
- LSR_store,
|
|
|
|
- LSUP_term_copy (LSUP_graph_uri (rsrc->user_data[i])), NULL);
|
|
|
|
|
|
+ LSR_store, LSUP_graph_uri (rsrc->user_data[i]), NULL);
|
|
if (UNLIKELY (!tmp_gr)) {
|
|
if (UNLIKELY (!tmp_gr)) {
|
|
rc = LSUP_MEM_ERR;
|
|
rc = LSUP_MEM_ERR;
|
|
goto fail;
|
|
goto fail;
|
|
@@ -314,8 +312,7 @@ LSR_desc_store (const LSR_Desc *rsrc)
|
|
|
|
|
|
// Update admin data.
|
|
// Update admin data.
|
|
tmp_gr = LSUP_graph_new (
|
|
tmp_gr = LSUP_graph_new (
|
|
- LSR_store,
|
|
|
|
- LSUP_term_copy (LSUP_graph_uri (rsrc->admin_data)), NULL);
|
|
|
|
|
|
+ LSR_store, LSUP_graph_uri (rsrc->admin_data), NULL);
|
|
if (UNLIKELY (!tmp_gr)) {
|
|
if (UNLIKELY (!tmp_gr)) {
|
|
rc = LSUP_MEM_ERR;
|
|
rc = LSUP_MEM_ERR;
|
|
goto fail;
|
|
goto fail;
|
|
@@ -326,8 +323,7 @@ LSR_desc_store (const LSR_Desc *rsrc)
|
|
|
|
|
|
// Update graph metadata.
|
|
// Update graph metadata.
|
|
tmp_gr = LSUP_graph_new (
|
|
tmp_gr = LSUP_graph_new (
|
|
- LSR_store,
|
|
|
|
- LSUP_term_copy (LSUP_graph_uri (rsrc->main_data)), NULL);
|
|
|
|
|
|
+ LSR_store, LSUP_graph_uri (rsrc->main_data), NULL);
|
|
if (UNLIKELY (!tmp_gr)) {
|
|
if (UNLIKELY (!tmp_gr)) {
|
|
rc = LSUP_MEM_ERR;
|
|
rc = LSUP_MEM_ERR;
|
|
goto fail;
|
|
goto fail;
|
|
@@ -362,8 +358,7 @@ LSR_desc_get (const uuid_t id, LSR_Desc **rsrc_p)
|
|
{
|
|
{
|
|
LSUP_rc rc = LSUP_OK;
|
|
LSUP_rc rc = LSUP_OK;
|
|
|
|
|
|
- LSUP_Graph *main_gr = LSUP_graph_new (
|
|
|
|
- LSR_store, LSUP_term_copy (LSUP_default_ctx), NULL);
|
|
|
|
|
|
+ LSUP_Graph *main_gr = LSUP_graph_new (LSR_store, LSUP_default_ctx, NULL);
|
|
if (!main_gr) return LSUP_DB_ERR;
|
|
if (!main_gr) return LSUP_DB_ERR;
|
|
|
|
|
|
LSUP_Triple *spo = LSUP_triple_new (
|
|
LSUP_Triple *spo = LSUP_triple_new (
|
|
@@ -394,7 +389,7 @@ LSR_desc_get (const uuid_t id, LSR_Desc **rsrc_p)
|
|
main_gr, NULL, spo->p, spo->s, &ct);
|
|
main_gr, NULL, spo->p, spo->s, &ct);
|
|
LSUP_Graph **data = calloc (sizeof (*data), ct + 1);
|
|
LSUP_Graph **data = calloc (sizeof (*data), ct + 1);
|
|
while (LSUP_graph_iter_next (it, &spo)) {
|
|
while (LSUP_graph_iter_next (it, &spo)) {
|
|
- data[i] = LSUP_graph_new (LSR_store, LSUP_term_copy (spo->s), NULL);
|
|
|
|
|
|
+ data[i] = LSUP_graph_new (LSR_store, spo->s, NULL);
|
|
if (! data[i++]) break; // Last slot remains NULL (sentinel).
|
|
if (! data[i++]) break; // Last slot remains NULL (sentinel).
|
|
}
|
|
}
|
|
LSUP_graph_iter_free (it);
|
|
LSUP_graph_iter_free (it);
|
|
@@ -417,8 +412,7 @@ LSUP_Graph *
|
|
LSR_desc_metadata (const LSR_Desc *rsrc)
|
|
LSR_desc_metadata (const LSR_Desc *rsrc)
|
|
{
|
|
{
|
|
LSUP_Graph *res = LSUP_graph_new (
|
|
LSUP_Graph *res = LSUP_graph_new (
|
|
- LSR_store, LSUP_term_copy (LSUP_graph_uri (rsrc->admin_data)),
|
|
|
|
- NULL);
|
|
|
|
|
|
+ LSR_store, LSUP_graph_uri (rsrc->admin_data), NULL);
|
|
LSUP_graph_copy_contents (rsrc->admin_data, res);
|
|
LSUP_graph_copy_contents (rsrc->admin_data, res);
|
|
|
|
|
|
return res;
|
|
return res;
|
|
@@ -435,8 +429,7 @@ LSR_desc_user_data (const LSR_Desc *rsrc)
|
|
|
|
|
|
for (size_t i = 0; i < ct; i++) {
|
|
for (size_t i = 0; i < ct; i++) {
|
|
res[i] = LSUP_graph_new (
|
|
res[i] = LSUP_graph_new (
|
|
- LSR_store,
|
|
|
|
- LSUP_term_copy (LSUP_graph_uri (rsrc->user_data[i])), NULL);
|
|
|
|
|
|
+ LSR_store, LSUP_graph_uri (rsrc->user_data[i]), NULL);
|
|
LSUP_graph_copy_contents (rsrc->user_data[i], res[i]);
|
|
LSUP_graph_copy_contents (rsrc->user_data[i], res[i]);
|
|
}
|
|
}
|
|
|
|
|