|
@@ -120,33 +120,20 @@ PyTypeObject TripleType = {
|
|
|
PyObject *
|
|
|
build_triple (LSUP_Triple *spo)
|
|
|
{
|
|
|
- PyObject *s_obj, *p_obj, *o_obj, *spo_obj, *term_args, *trp_args;
|
|
|
-
|
|
|
- term_args = Py_BuildValue (
|
|
|
- "bszz", spo->s->type, spo->s->data,
|
|
|
- spo->s->datatype, spo->s->lang);
|
|
|
- s_obj = PyObject_CallObject ((PyObject *)&TermType, term_args);
|
|
|
- Py_DECREF (term_args);
|
|
|
- if (UNLIKELY (!s_obj)) return NULL;
|
|
|
-
|
|
|
- term_args = Py_BuildValue (
|
|
|
- "bszz", spo->p->type, spo->p->data,
|
|
|
- spo->p->datatype, spo->p->lang);
|
|
|
- p_obj = PyObject_CallObject ((PyObject *)&TermType, term_args);
|
|
|
- if (UNLIKELY (!p_obj)) return NULL;
|
|
|
- Py_DECREF (term_args);
|
|
|
-
|
|
|
- term_args = Py_BuildValue (
|
|
|
- "bszz", spo->o->type, spo->o->data,
|
|
|
- spo->o->datatype, spo->o->lang);
|
|
|
- o_obj = PyObject_CallObject ((PyObject *)&TermType, term_args);
|
|
|
- if (UNLIKELY (!o_obj)) return NULL;
|
|
|
- Py_DECREF (term_args);
|
|
|
-
|
|
|
- trp_args = Py_BuildValue ("OOO", s_obj, p_obj, o_obj);
|
|
|
- spo_obj = PyObject_CallObject ((PyObject *)&TripleType, trp_args);
|
|
|
- if (UNLIKELY (!spo_obj)) return NULL;
|
|
|
+ log_info ("Building triple.");
|
|
|
+ PyObject *trp_args = Py_BuildValue (
|
|
|
+ "OOO",
|
|
|
+ build_term (spo->s), build_term (spo->p), build_term (spo->o));
|
|
|
+ if (UNLIKELY (!trp_args)) {
|
|
|
+ PyErr_SetString (PyExc_SystemError, "Error building triple args.");
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+ PyObject *spo_obj = PyObject_CallObject ((PyObject *)&TripleType, trp_args);
|
|
|
Py_DECREF (trp_args);
|
|
|
+ if (UNLIKELY (!spo_obj)) {
|
|
|
+ PyErr_SetString (PyExc_SystemError, "Error building triple object.");
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
|
|
|
return spo_obj;
|
|
|
}
|