diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/node.c | 4 | ||||
-rw-r--r-- | src/port.c | 15 | ||||
-rw-r--r-- | src/world.c | 16 |
3 files changed, 35 insertions, 0 deletions
@@ -92,6 +92,10 @@ lilv_node_new(LilvWorld* world, LilvNodeType type, const char* str) LilvNode* lilv_node_new_from_node(LilvWorld* world, const SordNode* node) { + if (!node) { + return NULL; + } + LilvNode* result = NULL; SordNode* datatype_uri = NULL; LilvNodeType type = LILV_VALUE_STRING; @@ -127,6 +127,21 @@ lilv_port_get_value(const LilvPlugin* p, } LILV_API +LilvNode* +lilv_port_get(const LilvPlugin* p, + const LilvPort* port, + const LilvNode* predicate) +{ + LilvNodes* values = lilv_port_get_value(p, port, predicate); + + LilvNode* value = lilv_node_duplicate( + values ? lilv_nodes_get_first(values) : NULL); + + lilv_nodes_free(values); + return value; +} + +LILV_API uint32_t lilv_port_get_index(const LilvPlugin* p, const LilvPort* port) diff --git a/src/world.c b/src/world.c index a3f59ed..147690b 100644 --- a/src/world.c +++ b/src/world.c @@ -201,6 +201,22 @@ lilv_world_find_nodes(LilvWorld* world, object ? object->node : NULL); } +LILV_API +LilvNode* +lilv_world_get(LilvWorld* world, + const LilvNode* subject, + const LilvNode* predicate, + const LilvNode* object) +{ + return lilv_node_new_from_node( + world, + sord_get(world->model, + subject ? subject->node : NULL, + predicate ? predicate->node : NULL, + object ? object->node : NULL, + NULL)); +} + SordIter* lilv_world_query_internal(LilvWorld* world, const SordNode* subject, |