Browse Source

Remane D-RES and O-RES.

scossu 5 days ago
parent
commit
f19ed466aa
7 changed files with 134 additions and 108 deletions
  1. 56 37
      README.md
  2. 3 3
      doc/ROADMAP.md
  3. 29 29
      include/dres.h
  4. 1 1
      include/lsup_repo.h
  5. 25 25
      src/dres.c
  6. 2 2
      test.c
  7. 18 11
      test/test_dres.c

+ 56 - 37
README.md

@@ -40,9 +40,9 @@ to replace the essential functionality of a previous project,
 
 
 ## Status
 ## Status
 
 
-Pre-alpha. Currently at the beginning of the implementation phase. The
-structure of the code may change radically. Features mentioned below are to be
-intended as goals.
+Alpha. Currently at the beginning of the implementation phase. The
+structure of the code may change radically. Basic functionality is still being
+built. See [road map](doc/ROADMAP.md) for details.
 
 
 ## Features
 ## Features
 
 
@@ -79,9 +79,9 @@ While the underlying `LSUP_RDF` allows for working with multiple, user-defined
 storage back ends, `LSUP_REPO` has two designated stores: an in-memory staging
 storage back ends, `LSUP_REPO` has two designated stores: an in-memory staging
 area, where resources are created and manipulated, and a persistent storage
 area, where resources are created and manipulated, and a persistent storage
 backed by LMDB, where resources are pushed after they are modified. Functions
 backed by LMDB, where resources are pushed after they are modified. Functions
-such as `LSR_desc_new`, `LSR_desc_update`, and `LSR_desc_triples` operate on
-the staging area. Functions such as `LSR_desc_store`, `LRS_desc_get`, and
-`LSR_desc_delete` move resources between the staging area and the persistent
+such as `LSR_dres_new`, `LSR_dres_update`, and `LSR_dres_triples` operate on
+the staging area. Functions such as `LSR_dres_store`, `LRS_dres_get`, and
+`LSR_dres_delete` move resources between the staging area and the persistent
 store, or delete them from the persistent store.
 store, or delete them from the persistent store.
 
 
 Usual actions in a resource lifecycle flow in `LSUP_REPO` may be, for example:
 Usual actions in a resource lifecycle flow in `LSUP_REPO` may be, for example:
@@ -111,22 +111,25 @@ following lines:
 - A soft-deleted resource or an active resource can be hard-deleted (i.e.
 - A soft-deleted resource or an active resource can be hard-deleted (i.e.
   entirely and irrevocably removed from storage).
   entirely and irrevocably removed from storage).
 
 
-### Data resources
+### Opaque resources
 
 
-At the center of Lakesuperior is the goal of storing and organizing arbitrary
-files that can be found in a hard drive, remote server, etc. These files are
-called *Data Resources* (DATA-R). Their contents are entirely opaque to
-Lakesuperior, therefore any type of document can be handled.
+Lakesuperior stores and organizes arbitrary files that can be found in a hard
+drive, remote server, etc. These files are called *Opaque Resources* (O-RES).
+Their contents are entirely opaque to Lakesuperior, therefore any type of
+document can be handled.
+
+In further development phases `LSUP_REPO` may perform some essential
+preservation tasks, such as checksum and basic characterization.
 
 
 ### Descriptive Resources
 ### Descriptive Resources
 
 
-Each data resource is accompanied by a *Descriptive Resource* (DESC-R). In the
+Each opaque resource is accompanied by a *Descriptive Resource* (D-RES). In the
 first iteration of Lakesuperior this is a RDF named graph which at a minimum
 first iteration of Lakesuperior this is a RDF named graph which at a minimum
 contains a pointer to the data location and basic technical metadata. the URI
 contains a pointer to the data location and basic technical metadata. the URI
-of the named graph is globally unique. Such resource stands for the non-RDF
-resource in a Linked Data context. It can also be added user-defined metadata.
+of the named graph is globally unique. This resource can be added any
+user-defined metadata.
 
 
-Descriptive resources may also exist independently of data resources for
+Descriptive resources may also exist independently of opaque resources for
 cataloging and organizational purposes. They have a few characteristics in
 cataloging and organizational purposes. They have a few characteristics in
 common:
 common:
 
 
@@ -139,31 +142,32 @@ common:
 - They may consist of several named graphs, each with a purpose defined by the
 - They may consist of several named graphs, each with a purpose defined by the
   software: library-managed data, user-provided data, versioning data, etc.
   software: library-managed data, user-provided data, versioning data, etc.
 
 
-Partitioning a DESC-R into multiple graphs allows individual data sets to be
+An O-RES cannot be looked up directly and has no metadata directly attached to
+it; instead, its related D-RES is looked up, which contains the file's metadata
+and a link to the file.
+
+Partitioning a D-RES into multiple graphs allows individual data sets to be
 annotated, e.g. to establish provenance or versioning information about the
 annotated, e.g. to establish provenance or versioning information about the
 asserted facts. Future developments of `lsup_repo` or software built upon it
 asserted facts. Future developments of `lsup_repo` or software built upon it
 may take advantage of this structure.
 may take advantage of this structure.
 
 
-Triples in a DESC-R can have any subject; however it is recommended to maintain
+Triples in a D-RES can have any subject; however it is recommended to maintain
 some consistency about which subjects are treated in each resource.
 some consistency about which subjects are treated in each resource.
 Specifically, the use of a resource as an aggregation or container of triples
 Specifically, the use of a resource as an aggregation or container of triples
-about multiple independent entities is discouraged in favor of the use of
+about multiple independent subjects is discouraged in favor of the use of
 dedicated data structures, as described below.
 dedicated data structures, as described below.
 
 
-### Resource Structures
+### Data Structures
 
 
 Descriptive resources can be organized in varios aggregation forms. The
 Descriptive resources can be organized in varios aggregation forms. The
 aggregating resources are normal descriptive resources, with specific
 aggregating resources are normal descriptive resources, with specific
 predicates pointing to other descriptive resources.
 predicates pointing to other descriptive resources.
 
 
-It is important to notice that, unlike in Fedora or other LDP implementations,
-the life cycle of resource aggregations is entirely independent of the
-aggregated resources. In LDP, deleting a container would remove its contained
-resources. Also, in LDP a resource can be only contained by a single container
-(except in the case of indirect containers, to some extent). In Lakesuperior an
-aggregation only "contains" pointers to other entirely independent resources,
-which can be pointed to by an arbitrary number of other aggregations, which can
-be removed at any time without changing the state of the aggregated resources.
+The life cycle of resource aggregations is entirely independent of the
+aggregated resources. An aggregation only "contains" pointers to other entirely
+independent resources, which can be pointed to by an arbitrary number of other
+aggregations, which can be removed at any time without changing the state of
+the aggregated resources.
 
 
 On the other hand, deleting a resource that is part of some structure causes a
 On the other hand, deleting a resource that is part of some structure causes a
 scan of all inbound links (see "Referential Integrity" below) and the removal
 scan of all inbound links (see "Referential Integrity" below) and the removal
@@ -182,12 +186,16 @@ Set members, as well as performing boolean operations on them, shall be made
 available. As it is a descriptive resource, a Set may have descriptive metadata
 available. As it is a descriptive resource, a Set may have descriptive metadata
 added to it, such as taxonomy, descriptions, labels, etc.
 added to it, such as taxonomy, descriptions, labels, etc.
 
 
+Deleting a resource contained in a set also deletes the membership relationship
+in the set.
+
 #### List
 #### List
 
 
-A Lakesuperior *List* is the implementation of a "Linked List" data structure.
-It contains a link to a single descriptive resource. This resource, called a
-*List Item*, represents the first item in the list. Each list item, except for
-the last one, contains a single link to the next list item.
+A Lakesuperior *List* is a plain implementation of a linked list data
+structure. The list resource contains a link to a single descriptive resource.
+This resource, called a *List Item*, represents the first item in the list.
+Each list item, except for the last one, contains a single link to the next
+list item.
 
 
 In addition, every list item has either:
 In addition, every list item has either:
 
 
@@ -201,6 +209,15 @@ Shorthand functions to perform common list operations shall be made available.
 As with other descriptive resources, Lists and List Items can have any type of
 As with other descriptive resources, Lists and List Items can have any type of
 user-defined metadata and relationships added.
 user-defined metadata and relationships added.
 
 
+Deleting a list removes all list items under it, but leaves the resources
+pointed to by the list items intact.
+
+Deleting a list item deletes all child items and shift the following item, if
+existent, to the position the deleted item occupied.
+
+Deleting an object that a list item stands for, causes the list item to be
+deleted as well.
+
 #### Proxy
 #### Proxy
 
 
 A List Item is a special case of a *Proxy*, which is a descriptive resource
 A List Item is a special case of a *Proxy*, which is a descriptive resource
@@ -213,6 +230,8 @@ well, as one sees fit.
 Proxy definitions follow the [OAI ORE](http://www.openarchives.org/ore/)
 Proxy definitions follow the [OAI ORE](http://www.openarchives.org/ore/)
 ontology.
 ontology.
 
 
+Deleting a resource that a proxy stands for, also deletes the proxy.
+
 ### Referential Integrity
 ### Referential Integrity
 
 
 The concept of Linked data, which `lsup_repo` is partly built upon, does not
 The concept of Linked data, which `lsup_repo` is partly built upon, does not
@@ -222,13 +241,13 @@ for managing that resource, let alone having any agency upon it. Therefore,
 "broken links" are not excluded. 
 "broken links" are not excluded. 
 
 
 `lsup_repo`, however, relies on the assumption that a specific set of resources
 `lsup_repo`, however, relies on the assumption that a specific set of resources
-is under its full control, and therefore guarantees that all references to
-internally managed resources are maintained at all times. This means that when
-a resource is deleted, all links pointing to it are identified and removed.
-This is called *referential integrity*.
+(all under the `urn:lsres:` namespace) is under its full control, and therefore
+guarantees that all references to internally managed resources are maintained
+at all times. This means that when a resource is deleted, all links pointing to
+it are identified and removed. This is called *referential integrity*.
 
 
-Tools shall be developed to perform periodical referential integrity checks and
-to notify of dangling links and/or repair them.
+Tools shall be developed to perform referential integrity checks and to notify
+of dangling links and/or repair them.
 
 
 ### Managed resources
 ### Managed resources
 
 

+ 3 - 3
doc/ROADMAP.md

@@ -5,7 +5,7 @@ P: Pending; W: working on it; T: testing; D: done
 - General repo
 - General repo
   - *D* Initialize and tear down
   - *D* Initialize and tear down
   - *D* Environment assets
   - *D* Environment assets
-- DESC-R
+- D-RES
   - *D* Create
   - *D* Create
   - *D* Store
   - *D* Store
   - *W* Modify
   - *W* Modify
@@ -25,9 +25,9 @@ P: Pending; W: working on it; T: testing; D: done
     - Proxies
     - Proxies
     - Sets
     - Sets
     - Linked lists
     - Linked lists
-- *P* DATA-R
+- *P* O-RES
   - Store
   - Store
-  - Metadata (DESC-R) linking
+  - Metadata (O-RES) linking
   - Versioning (see above)
   - Versioning (see above)
   - Deletion (see above)
   - Deletion (see above)
   - Versioning (see above)
   - Versioning (see above)

+ 29 - 29
include/desc.h → include/dres.h

@@ -1,13 +1,13 @@
-/** @file desc.h
+/** @file dres.h
  *
  *
  * @brief Descriptive (RDF) resource.
  * @brief Descriptive (RDF) resource.
  *
  *
- * The Descriptive Resource (DESC-R), together with the Data Resource (DATA-R),
+ * The Descriptive Resource (D-RES), together with the Data Resource (DATA-R),
  * is the building block of lsup_repo information. Its contents are fully
  * is the building block of lsup_repo information. Its contents are fully
  * understood by the library.
  * understood by the library.
  */
  */
 
 
-#ifndef _LSR_DESC_H
+#ifndef _LSR_DRES_H
 #define _LSR_DESC_H
 #define _LSR_DESC_H
 
 
 #include "repo_core.h"
 #include "repo_core.h"
@@ -17,9 +17,9 @@
  * Typedefs.
  * Typedefs.
  */
  */
 
 
-/** @brief DESC-R structure.
+/** @brief D-RES structure.
  *
  *
- * A Descriptive Resource (DESC-R) is made up of several RDF named graphs.
+ * A Descriptive Resource (D-RES) is made up of several RDF named graphs.
  * Each graph has a function defined by the framework and may be managed by
  * Each graph has a function defined by the framework and may be managed by
  * the framework or by the user.
  * the framework or by the user.
  *
  *
@@ -42,20 +42,20 @@
  * Relationships between these graphs are expressed by triples stored in the
  * Relationships between these graphs are expressed by triples stored in the
  * `main_data` graph.
  * `main_data` graph.
  */
  */
-typedef struct desc_t {
+typedef struct dres_t {
     LSUP_Graph **           user_data;      ///< User-defined data graphs.
     LSUP_Graph **           user_data;      ///< User-defined data graphs.
     LSUP_Graph *            admin_data;     ///< Managed data (one graph).
     LSUP_Graph *            admin_data;     ///< Managed data (one graph).
     LSUP_Graph *            main_data;      ///< Relationships between graphs.
     LSUP_Graph *            main_data;      ///< Relationships between graphs.
     uuid_t                  id;             ///< Resource identifier (RFC4122).
     uuid_t                  id;             ///< Resource identifier (RFC4122).
     LSR_ResFlags            flags;          ///< Flags.
     LSR_ResFlags            flags;          ///< Flags.
-} LSR_Desc;
+} LSR_Dres;
 
 
 
 
 /*
 /*
  * API functions.
  * API functions.
  */
  */
 
 
-/** @brief Create an in-memory DESC-R from multiple graphs.
+/** @brief Create an in-memory D-RES from multiple graphs.
  *
  *
  * The resource is volatile until it is stored in a persistent back end. It
  * The resource is volatile until it is stored in a persistent back end. It
  * must be stored in a context-capable back end (e.g. `LSUP_STORE_MDB`).
  * must be stored in a context-capable back end (e.g. `LSUP_STORE_MDB`).
@@ -65,7 +65,7 @@ typedef struct desc_t {
  *
  *
  * @param[in] data NULL-terminated array of graph handles, each with a set of
  * @param[in] data NULL-terminated array of graph handles, each with a set of
  *  triples to populate the new resource. Triples and terms are copied and get
  *  triples to populate the new resource. Triples and terms are copied and get
- *  freed when #LSR_desc_free() is called. All URIs, including the graph URI,
+ *  freed when #LSR_dres_free() is called. All URIs, including the graph URI,
  *  if not absolute, are intended as relative to the resource URI.  Hence, to
  *  if not absolute, are intended as relative to the resource URI.  Hence, to
  *  reference the resource itself, an IRIRef with an empty string as data may
  *  reference the resource itself, an IRIRef with an empty string as data may
  *  be used. The graph URI is maintained within the resource. As a convention,
  *  be used. The graph URI is maintained within the resource. As a convention,
@@ -74,41 +74,41 @@ typedef struct desc_t {
  *  underscores are reserved for internal use and are not allowed in the input.
  *  underscores are reserved for internal use and are not allowed in the input.
  *
  *
  * @param[out] rsrc Resource handle pointer. The handle should be freed with
  * @param[out] rsrc Resource handle pointer. The handle should be freed with
- *  #LSR_desc_free(). On a non-success return code, the handle may be garbage.
+ *  #LSR_dres_free(). On a non-success return code, the handle may be garbage.
  *
  *
  * @return LSUP_OK on success; < 0 on error.
  * @return LSUP_OK on success; < 0 on error.
  */
  */
 LSUP_rc
 LSUP_rc
-LSR_desc_new_multi (LSUP_Graph *const *data, LSR_Desc **rsrc);
+LSR_dres_new_multi (LSUP_Graph *const *data, LSR_Dres **rsrc);
 
 
 
 
 /** @brief Shortcut to create a resource from a single graph.
 /** @brief Shortcut to create a resource from a single graph.
  *
  *
  * The graph is automatically assigned the `_main` label. See
  * The graph is automatically assigned the `_main` label. See
- * #LSR_desc_new_multi for other documentation.
+ * #LSR_dres_new_multi for other documentation.
  *
  *
  * @param[in] data Single graph to insert.
  * @param[in] data Single graph to insert.
  *
  *
  * @param[out] rsrc Resource handle pointer. The handle should be freed with
  * @param[out] rsrc Resource handle pointer. The handle should be freed with
- *  #LSR_desc_free(). On a non-success return code, the handle may be garbage.
+ *  #LSR_dres_free(). On a non-success return code, the handle may be garbage.
  *
  *
  * @return LSUP_OK on success; < 0 on error.
  * @return LSUP_OK on success; < 0 on error.
  */
  */
 LSUP_rc
 LSUP_rc
-LSR_desc_new (const LSUP_Graph *data, LSR_Desc **rsrc);
+LSR_dres_new (const LSUP_Graph *data, LSR_Dres **rsrc);
 
 
 
 
 
 
-/** @brief Create an in-memory DESC-R from a stored resource.
+/** @brief Create an in-memory D-RES from a stored resource.
  *
  *
  * Once created, the resource may be modified independently from its stored
  * Once created, the resource may be modified independently from its stored
  * counterpart. In order to make changes permanent, it must be stored again
  * counterpart. In order to make changes permanent, it must be stored again
- * using #LSR_desc_store().
+ * using #LSR_dres_store().
  *
  *
  * @param[in] id ID of the resource to be retrieved, without the namespace.
  * @param[in] id ID of the resource to be retrieved, without the namespace.
  *
  *
  * @param[out] rsrc Resource handle to be populated with the found resource. It
  * @param[out] rsrc Resource handle to be populated with the found resource. It
- *  should be freed with #LSR_desc_free(). If NULL, the resource is only
+ *  should be freed with #LSR_dres_free(). If NULL, the resource is only
  *  checked for existence (much faster). On a non-success return code, the
  *  checked for existence (much faster). On a non-success return code, the
  *  handle may be garbage.
  *  handle may be garbage.
  *
  *
@@ -116,7 +116,7 @@ LSR_desc_new (const LSUP_Graph *data, LSR_Desc **rsrc);
  *  on error.
  *  on error.
  */
  */
 LSUP_rc
 LSUP_rc
-LSR_desc_get (const uuid_t id, LSR_Desc **rsrc);
+LSR_dres_get (const uuid_t id, LSR_Dres **rsrc);
 
 
 
 
 
 
@@ -147,14 +147,14 @@ LSR_desc_get (const uuid_t id, LSR_Desc **rsrc);
  *
  *
  * @return LSUP_OK on successful update; TODO
  * @return LSUP_OK on successful update; TODO
  */
  */
-LSUP_rc LSR_desc_update ( LSR_Desc *rsrc, LSUP_Term *const rm_data[][4],
+LSUP_rc LSR_dres_update ( LSR_Dres *rsrc, LSUP_Term *const rm_data[][4],
         LSUP_Graph *const *add_data);
         LSUP_Graph *const *add_data);
 
 
 
 
-/** @brief Free a DESC-R.
+/** @brief Free a D-RES.
  */
  */
 void
 void
-LSR_desc_free (LSR_Desc *rsrc);
+LSR_dres_free (LSR_Dres *rsrc);
 
 
 
 
 /** @brief Get resource metadata.
 /** @brief Get resource metadata.
@@ -166,7 +166,7 @@ LSR_desc_free (LSR_Desc *rsrc);
  * @return In-memory graph with metadata triples.
  * @return In-memory graph with metadata triples.
  */
  */
 LSUP_Graph *
 LSUP_Graph *
-LSR_desc_metadata (const LSR_Desc *rsrc);
+LSR_dres_metadata (const LSR_Dres *rsrc);
 
 
 
 
 /** @brief Get user-defined data.
 /** @brief Get user-defined data.
@@ -181,7 +181,7 @@ LSR_desc_metadata (const LSR_Desc *rsrc);
  * @return NULL-terminated array of in-memory graphs with data triples.
  * @return NULL-terminated array of in-memory graphs with data triples.
  */
  */
 LSUP_Graph **
 LSUP_Graph **
-LSR_desc_user_data (const LSR_Desc *rsrc);
+LSR_dres_user_data (const LSR_Dres *rsrc);
 
 
 
 
 /** @brief All resource triples in a single graph.
 /** @brief All resource triples in a single graph.
@@ -195,10 +195,10 @@ LSR_desc_user_data (const LSR_Desc *rsrc);
  * resource URN.
  * resource URN.
  */
  */
 LSUP_Graph *
 LSUP_Graph *
-LSR_desc_triples (const LSR_Desc *rsrc);
+LSR_dres_triples (const LSR_Dres *rsrc);
 
 
 
 
-/** @brief Push an in-memory DESC-R into the persistent store.
+/** @brief Push an in-memory D-RES into the persistent store.
  *
  *
  * This is a "create or overwrite" function that deletes any existing resource
  * This is a "create or overwrite" function that deletes any existing resource
  * under the given ID before storing the content of the in-memory resource
  * under the given ID before storing the content of the in-memory resource
@@ -209,10 +209,10 @@ LSR_desc_triples (const LSR_Desc *rsrc);
  * @param[in] rsrc Resource to be created or overwritten.
  * @param[in] rsrc Resource to be created or overwritten.
  */
  */
 LSUP_rc
 LSUP_rc
-LSR_desc_store (const LSR_Desc *rsrc);
+LSR_dres_store (const LSR_Dres *rsrc);
 
 
 
 
-/** @brief Delete a DESC-R.
+/** @brief Delete a D-RES.
  *
  *
  * TODO
  * TODO
  *
  *
@@ -222,7 +222,7 @@ LSR_desc_store (const LSR_Desc *rsrc);
  *  resource was found for the given ID.
  *  resource was found for the given ID.
  */
  */
 LSUP_rc
 LSUP_rc
-LSR_desc_delete (LSR_id id);
+LSR_dres_delete (LSR_id id);
 
 
 
 
 /** @brief Get resource URN.
 /** @brief Get resource URN.
@@ -232,7 +232,7 @@ LSR_desc_delete (LSR_id id);
  * @return New URI term. It must be freed with #LSUP_term_free() eventually.
  * @return New URI term. It must be freed with #LSUP_term_free() eventually.
  */
  */
 inline LSUP_Term *
 inline LSUP_Term *
-LSR_desc_urn (const LSR_Desc *rsrc)
+LSR_dres_urn (const LSR_Dres *rsrc)
 { return LSR_id_to_urn (rsrc->id, NULL); }
 { return LSR_id_to_urn (rsrc->id, NULL); }
 
 
 
 

+ 1 - 1
include/lsup_repo.h

@@ -1,6 +1,6 @@
 #ifndef _LSR_H
 #ifndef _LSR_H
 #define _LSR_H
 #define _LSR_H
 
 
-#include "desc.h"
+#include "dres.h"
 
 
 #endif /* _LSR_H */
 #endif /* _LSR_H */

+ 25 - 25
src/desc.c → src/dres.c

@@ -1,12 +1,12 @@
-#include "desc.h"
+#include "dres.h"
 
 
 
 
 LSUP_rc
 LSUP_rc
-LSR_desc_new_multi (LSUP_Graph *const *data, LSR_Desc **rsrc_p)
+LSR_dres_new_multi (LSUP_Graph *const *data, LSR_Dres **rsrc_p)
 {
 {
     LSUP_rc rc = LSUP_OK;
     LSUP_rc rc = LSUP_OK;
 
 
-    LSR_Desc *rsrc;
+    LSR_Dres *rsrc;
     MALLOC_GUARD (rsrc, LSUP_MEM_ERR);
     MALLOC_GUARD (rsrc, LSUP_MEM_ERR);
 
 
     uuid_generate_random (rsrc->id);
     uuid_generate_random (rsrc->id);
@@ -19,7 +19,7 @@ LSR_desc_new_multi (LSUP_Graph *const *data, LSR_Desc **rsrc_p)
             "Main data graph: %s",
             "Main data graph: %s",
             LSUP_graph_uri(rsrc->main_data)->data);
             LSUP_graph_uri(rsrc->main_data)->data);
 
 
-    PCHECK (LSR_desc_update (rsrc, NULL, data), finally);
+    PCHECK (LSR_dres_update (rsrc, NULL, data), finally);
 
 
     LSUP_Term *rsrc_uri = LSR_id_to_urn (rsrc->id, NULL);
     LSUP_Term *rsrc_uri = LSR_id_to_urn (rsrc->id, NULL);
 
 
@@ -43,14 +43,14 @@ LSR_desc_new_multi (LSUP_Graph *const *data, LSR_Desc **rsrc_p)
         *s = LSUP_iriref_new("", NULL), // Relative to resource URI.
         *s = LSUP_iriref_new("", NULL), // Relative to resource URI.
         *created_t = LSUP_iriref_new ("lsup:created", LSUP_default_nsm),
         *created_t = LSUP_iriref_new ("lsup:created", LSUP_default_nsm),
         *rsrc_t = LSUP_iriref_new ("lsup:Resource", LSUP_default_nsm),
         *rsrc_t = LSUP_iriref_new ("lsup:Resource", LSUP_default_nsm),
-        *desc_rsrc_t = LSUP_iriref_new (
+        *dres_t = LSUP_iriref_new (
                 "lsup:DescriptiveResource", LSUP_default_nsm),
                 "lsup:DescriptiveResource", LSUP_default_nsm),
         *ts_t = LSUP_literal_new (
         *ts_t = LSUP_literal_new (
                 tstamp, LSUP_iriref_new ("xsd:dateTime", LSUP_default_nsm));
                 tstamp, LSUP_iriref_new ("xsd:dateTime", LSUP_default_nsm));
 
 
     LSUP_Triple *admin_trp[] = {
     LSUP_Triple *admin_trp[] = {
         LSUP_triple_new (s, LSR_rdf_t, rsrc_t),
         LSUP_triple_new (s, LSR_rdf_t, rsrc_t),
-        LSUP_triple_new (s, LSR_rdf_t, desc_rsrc_t),
+        LSUP_triple_new (s, LSR_rdf_t, dres_t),
         LSUP_triple_new (s, created_t, ts_t),
         LSUP_triple_new (s, created_t, ts_t),
         NULL,
         NULL,
     };
     };
@@ -63,7 +63,7 @@ LSR_desc_new_multi (LSUP_Graph *const *data, LSR_Desc **rsrc_p)
     LSUP_term_free (s);
     LSUP_term_free (s);
     LSUP_term_free (created_t);
     LSUP_term_free (created_t);
     LSUP_term_free (rsrc_t);
     LSUP_term_free (rsrc_t);
-    LSUP_term_free (desc_rsrc_t);
+    LSUP_term_free (dres_t);
     LSUP_term_free (ts_t);
     LSUP_term_free (ts_t);
 
 
     /* END adding admin data. */
     /* END adding admin data. */
@@ -105,14 +105,14 @@ finally:
     return rc;
     return rc;
 
 
 fail:
 fail:
-    LSR_desc_free (rsrc);
+    LSR_dres_free (rsrc);
     *rsrc_p = NULL;
     *rsrc_p = NULL;
 
 
     return rc;
     return rc;
 }
 }
 
 
 
 
-void LSR_desc_free (LSR_Desc *rsrc)
+void LSR_dres_free (LSR_Dres *rsrc)
 {
 {
     size_t i = 0;
     size_t i = 0;
     while (rsrc->user_data[i])
     while (rsrc->user_data[i])
@@ -126,10 +126,10 @@ void LSR_desc_free (LSR_Desc *rsrc)
 
 
 
 
 LSUP_rc
 LSUP_rc
-LSR_desc_store (const LSR_Desc *rsrc)
+LSR_dres_store (const LSR_Dres *rsrc)
 {
 {
-    LSR_Desc *old_rsrc;
-    LSUP_rc get_rc = LSR_desc_get (rsrc->id, &old_rsrc);
+    LSR_Dres *old_rsrc;
+    LSUP_rc get_rc = LSR_dres_get (rsrc->id, &old_rsrc);
     PRCCK (get_rc);
     PRCCK (get_rc);
 
 
     /*
     /*
@@ -212,7 +212,7 @@ fail:
 
 
 
 
 LSUP_rc
 LSUP_rc
-LSR_desc_delete (LSR_id id)
+LSR_dres_delete (LSR_id id)
 {
 {
     // TODO
     // TODO
     return LSUP_NOT_IMPL_ERR;
     return LSUP_NOT_IMPL_ERR;
@@ -220,7 +220,7 @@ LSR_desc_delete (LSR_id id)
 
 
 
 
 LSUP_rc
 LSUP_rc
-LSR_desc_get (const uuid_t id, LSR_Desc **rsrc_p)
+LSR_dres_get (const uuid_t id, LSR_Dres **rsrc_p)
 {
 {
     LSUP_rc rc = LSUP_OK;
     LSUP_rc rc = LSUP_OK;
 
 
@@ -260,7 +260,7 @@ LSR_desc_get (const uuid_t id, LSR_Desc **rsrc_p)
     }
     }
     LSUP_graph_iter_free (it);
     LSUP_graph_iter_free (it);
 
 
-    rc = LSR_desc_new_multi (data, rsrc_p);
+    rc = LSR_dres_new_multi (data, rsrc_p);
 
 
     i = 0;
     i = 0;
     while (i < ct) LSUP_graph_free (data[i++]);
     while (i < ct) LSUP_graph_free (data[i++]);
@@ -275,7 +275,7 @@ finally:
 
 
 
 
 LSUP_Graph *
 LSUP_Graph *
-LSR_desc_metadata (const LSR_Desc *rsrc)
+LSR_dres_metadata (const LSR_Dres *rsrc)
 {
 {
     LSUP_Graph *res = LSUP_graph_new (
     LSUP_Graph *res = LSUP_graph_new (
             LSR_store, LSUP_graph_uri (rsrc->admin_data), NULL);
             LSR_store, LSUP_graph_uri (rsrc->admin_data), NULL);
@@ -286,7 +286,7 @@ LSR_desc_metadata (const LSR_Desc *rsrc)
 
 
 
 
 LSUP_Graph **
 LSUP_Graph **
-LSR_desc_user_data (const LSR_Desc *rsrc)
+LSR_dres_user_data (const LSR_Dres *rsrc)
 {
 {
     size_t ct = 0;
     size_t ct = 0;
     while (rsrc->user_data[ct]) ct++;
     while (rsrc->user_data[ct]) ct++;
@@ -310,11 +310,11 @@ fail:
 
 
 
 
 LSUP_Graph *
 LSUP_Graph *
-LSR_desc_triples (const LSR_Desc *rsrc)
+LSR_dres_triples (const LSR_Dres *rsrc)
 {
 {
-    LSUP_Graph *res = LSR_desc_metadata (rsrc);
+    LSUP_Graph *res = LSR_dres_metadata (rsrc);
     if (UNLIKELY (!res)) return NULL;
     if (UNLIKELY (!res)) return NULL;
-    LSUP_graph_set_uri (res, LSR_desc_urn (rsrc));
+    LSUP_graph_set_uri (res, LSR_dres_urn (rsrc));
 
 
     size_t ct = 0;
     size_t ct = 0;
     while (rsrc->user_data[ct]) ct++;
     while (rsrc->user_data[ct]) ct++;
@@ -330,8 +330,8 @@ fail:
 
 
 
 
 LSUP_rc
 LSUP_rc
-LSR_desc_update (
-        LSR_Desc *rsrc, LSUP_Term *const rm_data[][4],
+LSR_dres_update (
+        LSR_Dres *rsrc, LSUP_Term *const rm_data[][4],
         LSUP_Graph *const *add_data)
         LSUP_Graph *const *add_data)
 {
 {
     LSUP_rc rc = LSUP_NOACTION;
     LSUP_rc rc = LSUP_NOACTION;
@@ -444,7 +444,7 @@ LSR_desc_update (
             // Check subject.
             // Check subject.
             if (LSR_IS_RSRC_IRI (dest_s)) {
             if (LSR_IS_RSRC_IRI (dest_s)) {
                 uuid_parse (dest_s->data + strlen (LSR_RSRC_NS), id_tmp);
                 uuid_parse (dest_s->data + strlen (LSR_RSRC_NS), id_tmp);
-                tmp_rc = LSR_desc_get (id_tmp, NULL);
+                tmp_rc = LSR_dres_get (id_tmp, NULL);
                 if (tmp_rc != LSUP_OK) {
                 if (tmp_rc != LSUP_OK) {
                     log_error (
                     log_error (
                             "Referenced subject does not exist: %s",
                             "Referenced subject does not exist: %s",
@@ -456,7 +456,7 @@ LSR_desc_update (
             // Check object.
             // Check object.
             if (LSR_IS_RSRC_IRI (dest_o)) {
             if (LSR_IS_RSRC_IRI (dest_o)) {
                 uuid_parse (dest_o->data + strlen (LSR_RSRC_NS), id_tmp);
                 uuid_parse (dest_o->data + strlen (LSR_RSRC_NS), id_tmp);
-                tmp_rc = LSR_desc_get (id_tmp, NULL);
+                tmp_rc = LSR_dres_get (id_tmp, NULL);
                 if (tmp_rc != LSUP_OK) {
                 if (tmp_rc != LSUP_OK) {
                     log_error (
                     log_error (
                             "Referenced object does not exist: %s",
                             "Referenced object does not exist: %s",
@@ -546,5 +546,5 @@ finally:
  * Inline function declarations.
  * Inline function declarations.
  */
  */
 
 
-LSUP_Term *LSR_desc_urn (const LSR_Desc *rsrc);
+LSUP_Term *LSR_dres_urn (const LSR_Dres *rsrc);
 
 

+ 2 - 2
test.c

@@ -1,6 +1,6 @@
 #include <time.h>
 #include <time.h>
 
 
-#include "test_desc.c"
+#include "test_dres.c"
 
 
 #define TEST_STORE_PATH TMPDIR "/lsr_test_mdb"
 #define TEST_STORE_PATH TMPDIR "/lsr_test_mdb"
 
 
@@ -20,7 +20,7 @@ int main(int argc, char **argv) {
     if (rc < 0) return rc;
     if (rc < 0) return rc;
 
 
     if (
     if (
-        desc_tests() ||
+        dres_tests() ||
         0
         0
     ) {
     ) {
         log_error ("Test failed.");
         log_error ("Test failed.");

+ 18 - 11
test/test_desc.c → test/test_dres.c

@@ -2,7 +2,7 @@
 #include "namespace.h"
 #include "namespace.h"
 
 
 static int
 static int
-test_desc_create()
+test_dres_create()
 {
 {
     char
     char
         *ttl1 = "<urn:s:1> <urn:p:2> <urn:o:2> , <urn:o:1> ; "
         *ttl1 = "<urn:s:1> <urn:p:2> <urn:o:2> , <urn:o:1> ; "
@@ -31,15 +31,15 @@ test_desc_create()
     free(err);
     free(err);
 
 
     // Create resource.
     // Create resource.
-    LSR_Desc *rsrc;
-    EXPECT_PASS (LSR_desc_new_multi (data, &rsrc));
+    LSR_Dres *rsrc;
+    EXPECT_PASS (LSR_dres_new_multi (data, &rsrc));
 
 
     // Free input handles before using the resource to ensure that these
     // Free input handles before using the resource to ensure that these
     // pointers are not being referenced by the resource.
     // pointers are not being referenced by the resource.
     LSUP_graph_free (data[0]);
     LSUP_graph_free (data[0]);
     LSUP_graph_free (data[1]);
     LSUP_graph_free (data[1]);
 
 
-    LSUP_Graph *md_gr = LSR_desc_metadata(rsrc);
+    LSUP_Graph *md_gr = LSR_dres_metadata (rsrc);
     ASSERT (md_gr != NULL, "Error retrieving metadata graph!");
     ASSERT (md_gr != NULL, "Error retrieving metadata graph!");
     ASSERT (
     ASSERT (
             LSUP_term_equals (
             LSUP_term_equals (
@@ -50,7 +50,7 @@ test_desc_create()
 
 
 
 
     LSUP_Term
     LSUP_Term
-        *rsrc_urn = LSR_desc_urn (rsrc),
+        *rsrc_urn = LSR_dres_urn (rsrc),
         *main_urn = LSR_id_to_urn (rsrc->id, "__main"),
         *main_urn = LSR_id_to_urn (rsrc->id, "__main"),
         *admin_urn = LSR_id_to_urn (rsrc->id, "__admin"),
         *admin_urn = LSR_id_to_urn (rsrc->id, "__admin"),
         *usr1_urn = LSR_id_to_urn (rsrc->id, "usr1"),
         *usr1_urn = LSR_id_to_urn (rsrc->id, "usr1"),
@@ -72,6 +72,13 @@ test_desc_create()
             LSUP_term_equals (admin_urn, LSUP_graph_uri (md_gr)),
             LSUP_term_equals (admin_urn, LSUP_graph_uri (md_gr)),
             "Admin graph URI is incorrect!");
             "Admin graph URI is incorrect!");
 
 
+    LSUP_Term *t1 = LSUP_iriref_new ("foaf:topic", LSUP_default_nsm);
+    LSUP_Triple *test_spo = LSUP_triple_new (main_urn, t1, rsrc_urn);
+    /*
+    ASSERT (
+            LSUP_graph_contains (rsrc->main_data, test_spo),
+            "Main data missing topic triple!");
+    */
     // TODO
     // TODO
 
 
     LSUP_term_free (usr2_urn);
     LSUP_term_free (usr2_urn);
@@ -83,23 +90,23 @@ test_desc_create()
     LSUP_graph_free (md_gr);
     LSUP_graph_free (md_gr);
 
 
     // Store for next test before freeing.
     // Store for next test before freeing.
-    EXPECT_PASS (LSR_desc_store (rsrc));
+    EXPECT_PASS (LSR_dres_store (rsrc));
 
 
-    LSR_desc_free (rsrc);
+    LSR_dres_free (rsrc);
 
 
     return 0;
     return 0;
 }
 }
 
 
 
 
 static int
 static int
-test_desc_get ()
+test_dres_get ()
 {
 {
     return 0;
     return 0;
 }
 }
 
 
-int desc_tests()
+int dres_tests()
 {
 {
-    RUN (test_desc_create);
-    RUN (test_desc_get);
+    RUN (test_dres_create);
+    RUN (test_dres_get);
     return 0;
     return 0;
 }
 }