summaryrefslogtreecommitdiffstats
path: root/src/sord.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sord.c')
-rw-r--r--src/sord.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sord.c b/src/sord.c
index 9510d50..cad3c4d 100644
--- a/src/sord.c
+++ b/src/sord.c
@@ -844,6 +844,31 @@ sord_search(SordModel* model,
return sord_find(model, pat);
}
+const SordNode*
+sord_get(SordModel* model,
+ const SordNode* s,
+ const SordNode* p,
+ const SordNode* o,
+ const SordNode* g)
+{
+ if ((bool)s + (bool)p + (bool)o != 2) {
+ return NULL;
+ }
+
+ SordIter* i = sord_search(model, s, p, o, g);
+ const SordNode* ret = NULL;
+ if (!s) {
+ ret = sord_iter_get_node(i, SORD_SUBJECT);
+ } else if (!p) {
+ ret = sord_iter_get_node(i, SORD_PREDICATE);
+ } else if (!o) {
+ ret = sord_iter_get_node(i, SORD_OBJECT);
+ }
+
+ sord_iter_free(i);
+ return ret;
+}
+
bool
sord_ask(SordModel* model,
const SordNode* s,