|
@@ -1,3 +1,11 @@
|
|
|
|
+/***
|
|
|
|
+ * Volksdata Triple module.
|
|
|
|
+ *
|
|
|
|
+ * this module handles triples, groups of 3 @{volksdata.Term} objects.
|
|
|
|
+ * @classmod volksdata.Triple
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+
|
|
#include "lua_volksdata.h"
|
|
#include "lua_volksdata.h"
|
|
|
|
|
|
|
|
|
|
@@ -5,6 +13,17 @@
|
|
* Factory methods.
|
|
* Factory methods.
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+/***
|
|
|
|
+ * Create a new triple from existing @{volksdata.Term} objects.
|
|
|
|
+ *
|
|
|
|
+ * @function new
|
|
|
|
+ *
|
|
|
|
+ * @tparam volksdata.Term s Subject.
|
|
|
|
+ * @tparam volksdata.Term p Predicate.
|
|
|
|
+ * @tparam volksdata.Term o Object.
|
|
|
|
+ *
|
|
|
|
+ * @treturn volksdata.Triple New triple.
|
|
|
|
+ */
|
|
static int l_triple_new (lua_State *L)
|
|
static int l_triple_new (lua_State *L)
|
|
{
|
|
{
|
|
VOLK_Triple **trp_p = lua_newuserdatauv (L, sizeof (*trp_p), 1);
|
|
VOLK_Triple **trp_p = lua_newuserdatauv (L, sizeof (*trp_p), 1);
|
|
@@ -29,6 +48,13 @@ static int l_triple_new (lua_State *L)
|
|
* Class methods.
|
|
* Class methods.
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+/***
|
|
|
|
+ * Garbage-collect a triple.
|
|
|
|
+ *
|
|
|
|
+ * @function __gc
|
|
|
|
+ *
|
|
|
|
+ * @tparam volksdata.Triple Triple to free.
|
|
|
|
+ */
|
|
static int l_triple_gc (lua_State *L)
|
|
static int l_triple_gc (lua_State *L)
|
|
{
|
|
{
|
|
VOLK_Triple *trp = check_triple (L, 1);
|
|
VOLK_Triple *trp = check_triple (L, 1);
|
|
@@ -38,14 +64,18 @@ static int l_triple_gc (lua_State *L)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-/** @brief Get information about a triple's term.
|
|
|
|
|
|
+/***
|
|
|
|
+ * Get information about a triple's term.
|
|
*
|
|
*
|
|
* Note that this is only a visual representation, as terms cannot be modified
|
|
* Note that this is only a visual representation, as terms cannot be modified
|
|
* outside of their containing triple (unlike in the C library).
|
|
* outside of their containing triple (unlike in the C library).
|
|
*
|
|
*
|
|
- * @FIXME this doesn't allow chaining access methods, e.g. trp.s.data
|
|
|
|
|
|
+ * FIXME this doesn't allow chaining access methods, e.g. trp.s.data. To get
|
|
|
|
+ * an independent copy of a triple term, use @{copy_term()}.
|
|
*
|
|
*
|
|
- * To get an independent copy of a triple term, use triple.copy_term().
|
|
|
|
|
|
+ * @tparam volksdata.Triple trp Triple to extract the term.
|
|
|
|
+ * @tparam triple_pos Position of the term in the triple.
|
|
|
|
+ * @treturn volksdata.Term Copy of the extracted term.
|
|
*/
|
|
*/
|
|
static int l_triple_get_term (lua_State *L)
|
|
static int l_triple_get_term (lua_State *L)
|
|
{
|
|
{
|