summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lilv_internal.h16
-rw-r--r--src/node.c14
-rw-r--r--src/plugin.c92
-rw-r--r--src/pluginclass.c2
-rw-r--r--src/port.c20
-rw-r--r--src/query.c12
-rw-r--r--src/state.c94
-rw-r--r--src/world.c133
8 files changed, 187 insertions, 196 deletions
diff --git a/src/lilv_internal.h b/src/lilv_internal.h
index 89ba122..df86786 100644
--- a/src/lilv_internal.h
+++ b/src/lilv_internal.h
@@ -71,15 +71,15 @@ dlerror(void)
#define FOREACH_MATCH(statement_name_, range) \
for (const SerdStatement* statement_name_ = NULL; \
- !serd_range_empty(range) && \
- (statement_name_ = serd_range_front(range)); \
- serd_range_next(range))
+ !serd_cursor_is_end(range) && \
+ (statement_name_ = serd_cursor_get(range)); \
+ serd_cursor_advance(range))
#define FOREACH_PAT(name_, model_, s_, p_, o_, g_) \
- for (SerdRange* r_ = serd_model_range(model_, s_, p_, o_, g_); \
- !serd_range_empty(r_) || (serd_range_free(r_), false); \
- serd_range_next(r_)) \
- for (const SerdStatement* name_ = serd_range_front(r_); name_; name_ = NULL)
+ for (SerdCursor* r_ = serd_model_find(model_, s_, p_, o_, g_); \
+ !serd_cursor_is_end(r_) || (serd_cursor_free(r_), false); \
+ serd_cursor_advance(r_)) \
+ for (const SerdStatement* name_ = serd_cursor_get(r_); name_; name_ = NULL)
/*
*
@@ -405,7 +405,7 @@ lilv_world_filter_model(LilvWorld* world,
const SerdNode* graph);
LilvNodes*
-lilv_nodes_from_range(LilvWorld* world, SerdRange* range, SerdField field);
+lilv_nodes_from_range(LilvWorld* world, SerdCursor* range, SerdField field);
char*
lilv_strjoin(const char* first, ...);
diff --git a/src/node.c b/src/node.c
index f10ed91..098298f 100644
--- a/src/node.c
+++ b/src/node.c
@@ -31,7 +31,7 @@ LilvNode*
lilv_new_uri(LilvWorld* world, const char* uri)
{
(void)world;
- return serd_new_uri(SERD_MEASURE_STRING(uri));
+ return serd_new_uri(SERD_STRING(uri));
}
LilvNode*
@@ -40,8 +40,8 @@ lilv_new_file_uri(LilvWorld* world, const char* host, const char* path)
(void)world;
char* abs_path = lilv_path_absolute(path);
- SerdNode* s =
- serd_new_file_uri(SERD_MEASURE_STRING(abs_path), SERD_MEASURE_STRING(host));
+ SerdNode* s = serd_new_file_uri(
+ SERD_STRING(abs_path), host ? SERD_STRING(host) : SERD_EMPTY_STRING());
free(abs_path);
return s;
@@ -52,7 +52,7 @@ lilv_new_string(LilvWorld* world, const char* str)
{
(void)world;
- return serd_new_string(SERD_MEASURE_STRING(str));
+ return serd_new_string(SERD_STRING(str));
}
LilvNode*
@@ -60,7 +60,7 @@ lilv_new_int(LilvWorld* world, int val)
{
(void)world;
- return serd_new_integer(val, world->uris.xsd_int);
+ return serd_new_integer(val, serd_node_string_view(world->uris.xsd_int));
}
LilvNode*
@@ -76,9 +76,7 @@ lilv_new_bool(LilvWorld* world, bool val)
{
(void)world;
- return serd_new_typed_literal(val ? SERD_STATIC_STRING("true")
- : SERD_STATIC_STRING("false"),
- serd_node_string_view(world->uris.xsd_boolean));
+ return serd_new_boolean(val);
}
LilvNode*
diff --git a/src/plugin.c b/src/plugin.c
index 05a15f9..0f36169 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -160,23 +160,22 @@ lilv_plugin_load(LilvPlugin* plugin)
inserter,
LILV_READER_STACK_SIZE);
- SerdModel* prots = lilv_world_filter_model(plugin->world,
+ SerdModel* prots = lilv_world_filter_model(plugin->world,
plugin->world->model,
plugin->plugin_uri,
plugin->world->uris.lv2_prototype,
NULL,
NULL);
- SerdModel* skel = serd_model_new(plugin->world->world, SERD_INDEX_SPO);
- SerdIter* iter = serd_model_begin(prots);
- for (; !serd_iter_equals(iter, serd_model_end(prots)); serd_iter_next(iter)) {
- const SerdStatement* statement = serd_iter_get(iter);
+ SerdModel* skel = serd_model_new(plugin->world->world, SERD_ORDER_SPO, 0u);
+ SerdCursor* iter = serd_model_begin(prots);
+ for (; !serd_cursor_is_end(iter); serd_cursor_advance(iter)) {
+ const SerdStatement* statement = serd_cursor_get(iter);
const SerdNode* t = serd_statement_object(statement);
LilvNode* prototype = serd_node_copy(t);
lilv_world_load_resource(plugin->world, prototype);
- FOREACH_PAT(s, plugin->world->model, prototype, NULL, NULL, NULL)
- {
+ FOREACH_PAT (s, plugin->world->model, prototype, NULL, NULL, NULL) {
serd_model_add(skel,
plugin->plugin_uri,
serd_statement_predicate(s),
@@ -186,11 +185,11 @@ lilv_plugin_load(LilvPlugin* plugin)
lilv_node_free(prototype);
}
- serd_iter_free(iter);
+ serd_cursor_free(iter);
- SerdRange* all = serd_model_all(skel, SERD_ORDER_SPO);
- serd_model_add_range(plugin->world->model, all);
- serd_range_free(all);
+ SerdCursor* all = serd_model_begin_ordered(skel, SERD_ORDER_SPO);
+ serd_model_insert_statements(plugin->world->model, all);
+ serd_cursor_free(all);
serd_model_free(skel);
serd_model_free(prots);
@@ -268,7 +267,7 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_plugin)
plugin->ports = (LilvPort**)malloc(sizeof(LilvPort*));
plugin->ports[0] = NULL;
- SerdRange* ports = serd_model_range(plugin->world->model,
+ SerdCursor* ports = serd_model_find(plugin->world->model,
plugin->plugin_uri,
plugin->world->uris.lv2_port,
NULL,
@@ -321,7 +320,7 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_plugin)
plugin->ports[this_index] = this_port;
}
- SerdRange* types = serd_model_range(
+ SerdCursor* types = serd_model_find(
plugin->world->model, port, plugin->world->uris.rdf_a, NULL, NULL);
FOREACH_MATCH (t, types) {
const SerdNode* type = serd_statement_object(t);
@@ -333,12 +332,12 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_plugin)
lilv_node_as_uri(plugin->plugin_uri));
}
}
- serd_range_free(types);
+ serd_cursor_free(types);
lilv_node_free(symbol);
lilv_node_free(index);
}
- serd_range_free(ports);
+ serd_cursor_free(ports);
// Check sanity
for (uint32_t i = 0; i < plugin->num_ports; ++i) {
@@ -380,7 +379,7 @@ lilv_plugin_get_library_uri(const LilvPlugin* plugin)
lilv_plugin_load_if_necessary((LilvPlugin*)plugin);
if (!plugin->binary_uri) {
// <plugin> lv2:binary ?binary
- SerdRange* i = serd_model_range(plugin->world->model,
+ SerdCursor* i = serd_model_find(plugin->world->model,
plugin->plugin_uri,
plugin->world->uris.lv2_binary,
NULL,
@@ -392,7 +391,7 @@ lilv_plugin_get_library_uri(const LilvPlugin* plugin)
break;
}
}
- serd_range_free(i);
+ serd_cursor_free(i);
}
if (!plugin->binary_uri) {
LILV_WARNF("Plugin <%s> has no lv2:binary\n",
@@ -413,7 +412,7 @@ lilv_plugin_get_class(const LilvPlugin* plugin)
lilv_plugin_load_if_necessary((LilvPlugin*)plugin);
if (!plugin->plugin_class) {
// <plugin> a ?class
- SerdRange* c = serd_model_range(plugin->world->model,
+ SerdCursor* c = serd_model_find(plugin->world->model,
plugin->plugin_uri,
plugin->world->uris.rdf_a,
NULL,
@@ -438,7 +437,7 @@ lilv_plugin_get_class(const LilvPlugin* plugin)
lilv_node_free(klass);
}
- serd_range_free(c);
+ serd_cursor_free(c);
if (plugin->plugin_class == NULL) {
((LilvPlugin*)plugin)->plugin_class = plugin->world->lv2_plugin_class;
@@ -632,7 +631,7 @@ lilv_plugin_has_latency(const LilvPlugin* plugin)
{
lilv_plugin_load_if_necessary(plugin);
- SerdRange* ports = serd_model_range(plugin->world->model,
+ SerdCursor* ports = serd_model_find(plugin->world->model,
plugin->plugin_uri,
plugin->world->uris.lv2_port,
NULL,
@@ -655,7 +654,7 @@ lilv_plugin_has_latency(const LilvPlugin* plugin)
break;
}
}
- serd_range_free(ports);
+ serd_cursor_free(ports);
return ret;
}
@@ -838,8 +837,7 @@ lilv_plugin_get_author(const LilvPlugin* plugin)
{
lilv_plugin_load_if_necessary(plugin);
- SerdNode* doap_maintainer =
- serd_new_uri(SERD_STATIC_STRING(NS_DOAP "maintainer"));
+ SerdNode* doap_maintainer = serd_new_uri(SERD_STRING(NS_DOAP "maintainer"));
const SerdNode* maintainer = serd_model_get(
plugin->world->model, plugin->plugin_uri, doap_maintainer, NULL, NULL);
@@ -867,7 +865,7 @@ lilv_plugin_get_author_property(const LilvPlugin* plugin, const char* uri)
{
SerdNode* author = lilv_plugin_get_author(plugin);
if (author) {
- SerdNode* pred = serd_new_uri(SERD_MEASURE_STRING(uri));
+ SerdNode* pred = serd_new_uri(SERD_STRING(uri));
LilvNode* ret = lilv_plugin_get_one(plugin, author, pred);
serd_node_free(pred);
serd_node_free(author);
@@ -905,11 +903,11 @@ lilv_plugin_get_uis(const LilvPlugin* plugin)
{
lilv_plugin_load_if_necessary(plugin);
- SerdNode* ui_ui_node = serd_new_uri(SERD_STATIC_STRING(LV2_UI__ui));
- SerdNode* ui_binary_node = serd_new_uri(SERD_STATIC_STRING(LV2_UI__binary));
+ SerdNode* ui_ui_node = serd_new_uri(SERD_STRING(LV2_UI__ui));
+ SerdNode* ui_binary_node = serd_new_uri(SERD_STRING(LV2_UI__binary));
- LilvUIs* result = lilv_uis_new();
- SerdRange* uis = serd_model_range(
+ LilvUIs* result = lilv_uis_new();
+ SerdCursor* uis = serd_model_find(
plugin->world->model, plugin->plugin_uri, ui_ui_node, NULL, NULL);
FOREACH_MATCH (s, uis) {
@@ -936,7 +934,7 @@ lilv_plugin_get_uis(const LilvPlugin* plugin)
zix_tree_insert((ZixTree*)result, lilv_ui, NULL);
}
- serd_range_free(uis);
+ serd_cursor_free(uis);
serd_node_free(ui_binary_node);
serd_node_free(ui_ui_node);
@@ -979,20 +977,13 @@ new_lv2_env(const SerdNode* base)
{
SerdEnv* env = serd_env_new(serd_node_string_view(base));
- serd_env_set_prefix(
- env, SERD_STATIC_STRING("doap"), SERD_STATIC_STRING(NS_DOAP));
- serd_env_set_prefix(
- env, SERD_STATIC_STRING("foaf"), SERD_STATIC_STRING(NS_FOAF));
- serd_env_set_prefix(
- env, SERD_STATIC_STRING("lv2"), SERD_STATIC_STRING(NS_LV2));
- serd_env_set_prefix(
- env, SERD_STATIC_STRING("owl"), SERD_STATIC_STRING(NS_OWL));
- serd_env_set_prefix(
- env, SERD_STATIC_STRING("rdf"), SERD_STATIC_STRING(NS_RDF));
- serd_env_set_prefix(
- env, SERD_STATIC_STRING("rdfs"), SERD_STATIC_STRING(NS_RDFS));
- serd_env_set_prefix(
- env, SERD_STATIC_STRING("xsd"), SERD_STATIC_STRING(NS_XSD));
+ serd_env_set_prefix(env, SERD_STRING("doap"), SERD_STRING(NS_DOAP));
+ serd_env_set_prefix(env, SERD_STRING("foaf"), SERD_STRING(NS_FOAF));
+ serd_env_set_prefix(env, SERD_STRING("lv2"), SERD_STRING(NS_LV2));
+ serd_env_set_prefix(env, SERD_STRING("owl"), SERD_STRING(NS_OWL));
+ serd_env_set_prefix(env, SERD_STRING("rdf"), SERD_STRING(NS_RDF));
+ serd_env_set_prefix(env, SERD_STRING("rdfs"), SERD_STRING(NS_RDFS));
+ serd_env_set_prefix(env, SERD_STRING("xsd"), SERD_STRING(NS_XSD));
return env;
}
@@ -1020,7 +1011,7 @@ lilv_plugin_write_description(LilvWorld* world,
SerdEnv* env = new_lv2_env(base);
SerdByteSink* const sink =
- serd_byte_sink_new_function((SerdWriteFunc)fwrite, plugin_file, 1);
+ serd_byte_sink_new_function((SerdWriteFunc)fwrite, NULL, plugin_file, 1);
SerdWriter* writer = serd_writer_new(world->world, SERD_TURTLE, 0, env, sink);
@@ -1030,15 +1021,15 @@ lilv_plugin_write_description(LilvWorld* world,
maybe_write_prefixes(iface, env, plugin_file);
// Write plugin description
- SerdRange* plug_range =
- serd_model_range(world->model, subject, NULL, NULL, NULL);
+ SerdCursor* plug_range =
+ serd_model_find(world->model, subject, NULL, NULL, NULL);
serd_write_range(plug_range, iface, 0);
// Write port descriptions
for (uint32_t i = 0; i < num_ports; ++i) {
const LilvPort* port = plugin->ports[i];
- SerdRange* port_range =
- serd_model_range(world->model, port->node, NULL, NULL, NULL);
+ SerdCursor* port_range =
+ serd_model_find(world->model, port->node, NULL, NULL, NULL);
serd_write_range(port_range, iface, 0);
}
@@ -1058,7 +1049,7 @@ lilv_plugin_write_manifest_entry(LilvWorld* world,
SerdEnv* env = new_lv2_env(base);
SerdByteSink* const sink =
- serd_byte_sink_new_function((SerdWriteFunc)fwrite, manifest_file, 1);
+ serd_byte_sink_new_function((SerdWriteFunc)fwrite, NULL, manifest_file, 1);
SerdWriter* writer = serd_writer_new(world->world, SERD_TURTLE, 0, env, sink);
@@ -1075,8 +1066,7 @@ lilv_plugin_write_manifest_entry(LilvWorld* world,
plugin->world->uris.lv2_Plugin,
NULL);
- const SerdNode* file_node =
- serd_new_uri(SERD_MEASURE_STRING(plugin_file_path));
+ const SerdNode* file_node = serd_new_uri(SERD_STRING(plugin_file_path));
serd_sink_write(serd_writer_sink(writer),
0,
diff --git a/src/pluginclass.c b/src/pluginclass.c
index 96ad2cb..64bbf51 100644
--- a/src/pluginclass.c
+++ b/src/pluginclass.c
@@ -33,7 +33,7 @@ lilv_plugin_class_new(LilvWorld* world,
pc->world = world;
pc->uri = serd_node_copy(uri);
- pc->label = serd_new_string(SERD_MEASURE_STRING(label));
+ pc->label = serd_new_string(SERD_STRING(label));
pc->parent_uri = (parent_node ? serd_node_copy(parent_node) : NULL);
return pc;
diff --git a/src/port.c b/src/port.c
index 5bae3a9..033182e 100644
--- a/src/port.c
+++ b/src/port.c
@@ -37,7 +37,7 @@ lilv_port_new(const SerdNode* node, uint32_t index, const char* symbol)
port->node = serd_node_copy(node);
port->index = index;
- port->symbol = serd_new_string(SERD_MEASURE_STRING(symbol));
+ port->symbol = serd_new_string(SERD_STRING(symbol));
port->classes = lilv_nodes_new();
return port;
}
@@ -94,7 +94,7 @@ lilv_port_supports_event(const LilvPlugin* plugin,
for (const char** pred = predicates; *pred; ++pred) {
if (serd_model_ask(plugin->world->model,
port->node,
- serd_new_uri(SERD_MEASURE_STRING(*pred)),
+ serd_new_uri(SERD_STRING(*pred)),
event_type,
NULL)) {
return true;
@@ -229,15 +229,15 @@ lilv_port_get_range(const LilvPlugin* plugin,
LilvScalePoints*
lilv_port_get_scale_points(const LilvPlugin* plugin, const LilvPort* port)
{
- SerdRange* points =
- serd_model_range(plugin->world->model,
- port->node,
- serd_new_uri(SERD_STATIC_STRING(LV2_CORE__scalePoint)),
- NULL,
- NULL);
+ SerdCursor* points =
+ serd_model_find(plugin->world->model,
+ port->node,
+ serd_new_uri(SERD_STRING(LV2_CORE__scalePoint)),
+ NULL,
+ NULL);
LilvScalePoints* ret = NULL;
- if (!serd_range_empty(points)) {
+ if (!serd_cursor_is_end(points)) {
ret = lilv_scale_points_new();
}
@@ -254,7 +254,7 @@ lilv_port_get_scale_points(const LilvPlugin* plugin, const LilvPort* port)
zix_tree_insert((ZixTree*)ret, lilv_scale_point_new(value, label), NULL);
}
}
- serd_range_free(points);
+ serd_cursor_free(points);
assert(!ret || lilv_nodes_size(ret) > 0);
return ret;
diff --git a/src/query.c b/src/query.c
index b77c2b4..5bed1ce 100644
--- a/src/query.c
+++ b/src/query.c
@@ -53,7 +53,7 @@ lilv_lang_matches(const char* a, const char* b)
}
static LilvNodes*
-lilv_nodes_from_range_i18n(LilvWorld* world, SerdRange* range, SerdField field)
+lilv_nodes_from_range_i18n(LilvWorld* world, SerdCursor* range, SerdField field)
{
(void)world;
@@ -87,7 +87,7 @@ lilv_nodes_from_range_i18n(LilvWorld* world, SerdRange* range, SerdField field)
zix_tree_insert((ZixTree*)values, serd_node_copy(value), NULL);
}
}
- serd_range_free(range);
+ serd_cursor_free(range);
free(syslang);
if (lilv_nodes_size(values) > 0) {
@@ -116,10 +116,10 @@ lilv_nodes_from_range_i18n(LilvWorld* world, SerdRange* range, SerdField field)
}
LilvNodes*
-lilv_nodes_from_range(LilvWorld* world, SerdRange* range, SerdField field)
+lilv_nodes_from_range(LilvWorld* world, SerdCursor* range, SerdField field)
{
- if (serd_range_empty(range)) {
- serd_range_free(range);
+ if (serd_cursor_is_end(range)) {
+ serd_cursor_free(range);
return NULL;
} else if (world->opt.filter_language) {
return lilv_nodes_from_range_i18n(world, range, field);
@@ -132,7 +132,7 @@ lilv_nodes_from_range(LilvWorld* world, SerdRange* range, SerdField field)
zix_tree_insert((ZixTree*)values, node, NULL);
}
}
- serd_range_free(range);
+ serd_cursor_free(range);
return values;
}
}
diff --git a/src/state.c b/src/state.c
index 80119a0..078e962 100644
--- a/src/state.c
+++ b/src/state.c
@@ -641,14 +641,14 @@ new_state_from_model(LilvWorld* world,
state->uri = serd_node_copy(node);
// Get the plugin URI this state applies to
- SerdIter* i = serd_model_find(model, node, world->uris.lv2_appliesTo, 0, 0);
+ SerdCursor* i = serd_model_find(model, node, world->uris.lv2_appliesTo, 0, 0);
if (i) {
- const SerdStatement* s = serd_iter_get(i);
+ const SerdStatement* s = serd_cursor_get(i);
const SerdNode* object = serd_statement_object(s);
const SerdNode* graph = serd_statement_graph(s);
state->plugin_uri = serd_node_copy(object);
set_state_dir_from_model(state, graph);
- serd_iter_free(i);
+ serd_cursor_free(i);
} else if (serd_model_ask(
model, node, world->uris.rdf_a, world->uris.lv2_Plugin, 0)) {
// Loading plugin description as state (default state)
@@ -660,13 +660,13 @@ new_state_from_model(LilvWorld* world,
// Get the state label
i = serd_model_find(model, node, world->uris.rdfs_label, NULL, NULL);
- if (i) {
- const SerdStatement* s = serd_iter_get(i);
+ if (!serd_cursor_is_end(i)) {
+ const SerdStatement* s = serd_cursor_get(i);
const SerdNode* object = serd_statement_object(s);
const SerdNode* graph = serd_statement_graph(s);
state->label = lilv_strdup(serd_node_string(object));
set_state_dir_from_model(state, graph);
- serd_iter_free(i);
+ serd_cursor_free(i);
}
SerdEnv* env = serd_env_new(SERD_EMPTY_STRING());
@@ -674,7 +674,7 @@ new_state_from_model(LilvWorld* world,
SerdBuffer buffer = {NULL, 0};
// Get metadata
- SerdRange* meta = serd_model_range(model, node, 0, 0, 0);
+ SerdCursor* meta = serd_model_find(model, node, 0, 0, 0);
FOREACH_MATCH (s, meta) {
const SerdNode* p = serd_statement_predicate(s);
const SerdNode* o = serd_statement_object(s);
@@ -689,10 +689,10 @@ new_state_from_model(LilvWorld* world,
model, env, map, s, loader, state->atom_Path, &state->metadata);
}
}
- serd_range_free(meta);
+ serd_cursor_free(meta);
// Get port values
- SerdRange* ports = serd_model_range(model, node, world->uris.lv2_port, 0, 0);
+ SerdCursor* ports = serd_model_find(model, node, world->uris.lv2_port, 0, 0);
FOREACH_MATCH (s, ports) {
const SerdNode* port = serd_statement_object(s);
@@ -717,18 +717,18 @@ new_state_from_model(LilvWorld* world,
}
}
}
- serd_range_free(ports);
+ serd_cursor_free(ports);
// Get properties
const SerdNode* state_node =
serd_model_get(model, node, world->uris.state_state, NULL, NULL);
if (state_node) {
- SerdRange* props = serd_model_range(model, state_node, 0, 0, 0);
+ SerdCursor* props = serd_model_find(model, state_node, 0, 0, 0);
FOREACH_MATCH (s, props) {
add_object_to_properties(
model, env, map, s, loader, state->atom_Path, &state->props);
}
- serd_range_free(props);
+ serd_cursor_free(props);
}
serd_free(buffer.buf);
@@ -772,9 +772,9 @@ lilv_state_new_from_file(LilvWorld* world,
char* abs_path = lilv_path_absolute(path);
SerdNode* node =
- serd_new_file_uri(SERD_MEASURE_STRING(abs_path), SERD_EMPTY_STRING());
+ serd_new_file_uri(SERD_STRING(abs_path), SERD_EMPTY_STRING());
SerdEnv* env = serd_env_new(serd_node_string_view(node));
- SerdModel* model = serd_model_new(world->world, SERD_INDEX_SPO);
+ SerdModel* model = serd_model_new(world->world, SERD_ORDER_SPO, 0u);
SerdSink* inserter = serd_inserter_new(model, NULL);
SerdReader* reader = serd_reader_new(
world->world, SERD_TURTLE, 0, env, inserter, LILV_READER_STACK_SIZE);
@@ -807,8 +807,7 @@ lilv_state_new_from_file(LilvWorld* world,
static void
set_prefixes(SerdEnv* env)
{
-#define SET_PSET(e, p, u) \
- serd_env_set_prefix(e, SERD_STATIC_STRING(p), SERD_STATIC_STRING(u))
+#define SET_PSET(e, p, u) serd_env_set_prefix(e, SERD_STRING(p), SERD_STRING(u))
SET_PSET(env, "atom", LV2_ATOM_PREFIX);
SET_PSET(env, "lv2", LV2_CORE_PREFIX);
@@ -826,19 +825,20 @@ lilv_state_new_from_string(LilvWorld* world, LV2_URID_Map* map, const char* str)
return NULL;
}
- SerdEnv* env = serd_env_new(SERD_EMPTY_STRING());
- SerdModel* model =
- serd_model_new(world->world, SERD_INDEX_SPO | SERD_INDEX_OPS);
+ SerdEnv* env = serd_env_new(SERD_EMPTY_STRING());
+ SerdModel* model = serd_model_new(world->world, SERD_ORDER_SPO, 0u);
SerdSink* inserter = serd_inserter_new(model, NULL);
SerdReader* reader = serd_reader_new(
world->world, SERD_TURTLE, 0, env, inserter, LILV_READER_STACK_SIZE);
+ serd_model_add_index(model, SERD_ORDER_OPS);
+
SerdByteSource* source = serd_byte_source_new_string(str, NULL);
set_prefixes(env);
serd_reader_start(reader, source);
serd_reader_read_document(reader);
- SerdNode* o = serd_new_uri(SERD_STATIC_STRING(LV2_PRESETS__Preset));
+ SerdNode* o = serd_new_uri(SERD_STRING(LV2_PRESETS__Preset));
const SerdNode* s = serd_model_get(model, NULL, world->uris.rdf_a, o, NULL);
LilvState* state = new_state_from_model(world, map, model, s, NULL);
@@ -875,7 +875,7 @@ static SerdWriter*
ttl_file_writer(SerdWorld* world, FILE* fd, const SerdNode* node, SerdEnv** env)
{
SerdByteSink* const sink =
- serd_byte_sink_new_function((SerdWriteFunc)fwrite, fd, 1);
+ serd_byte_sink_new_function((SerdWriteFunc)fwrite, NULL, fd, 1);
SerdWriter* const writer = ttl_writer(world, sink, node, env);
@@ -892,12 +892,12 @@ ttl_file_writer(SerdWorld* world, FILE* fd, const SerdNode* node, SerdEnv** env)
static void
remove_manifest_entry(SerdModel* model, const char* subject)
{
- SerdNode* const s = serd_new_uri(SERD_MEASURE_STRING(subject));
- SerdRange* const r = serd_model_range(model, s, NULL, NULL, NULL);
+ SerdNode* const s = serd_new_uri(SERD_STRING(subject));
+ SerdCursor* const r = serd_model_find(model, s, NULL, NULL, NULL);
- serd_model_erase_range(model, r);
+ serd_model_erase_statements(model, r);
- serd_range_free(r);
+ serd_cursor_free(r);
serd_node_free(s);
}
@@ -919,9 +919,9 @@ write_manifest(LilvWorld* world,
}
SerdWriter* writer = ttl_file_writer(world->world, wfd, file_uri, &env);
- SerdRange* all = serd_model_all(model, SERD_ORDER_SPO);
+ SerdCursor* all = serd_model_begin_ordered(model, SERD_ORDER_SPO);
serd_write_range(all, serd_writer_sink(writer), 0);
- serd_range_free(all);
+ serd_cursor_free(all);
serd_writer_free(writer);
fclose(wfd);
serd_free(path);
@@ -937,16 +937,18 @@ add_state_to_manifest(LilvWorld* lworld,
{
static const SerdStringView empty = {"", 0};
- const SerdStringView manifest_path_view = SERD_MEASURE_STRING(manifest_path);
- const SerdStringView state_path_view = SERD_MEASURE_STRING(state_path);
+ const SerdStringView manifest_path_view = SERD_STRING(manifest_path);
+ const SerdStringView state_path_view = SERD_STRING(state_path);
SerdWorld* world = lworld->world;
SerdNode* manifest = serd_new_file_uri(manifest_path_view, empty);
SerdNode* file = serd_new_file_uri(state_path_view, empty);
SerdEnv* env = serd_env_new(serd_node_string_view(manifest));
- SerdModel* model = serd_model_new(world, SERD_INDEX_SPO | SERD_INDEX_OPS);
+ SerdModel* model = serd_model_new(world, SERD_ORDER_SPO, 0u);
SerdSink* inserter = serd_inserter_new(model, NULL);
+ serd_model_add_index(model, SERD_ORDER_OPS);
+
FILE* const rfd = fopen(manifest_path, "r");
if (rfd) {
// Read manifest into model
@@ -982,7 +984,7 @@ add_state_to_manifest(LilvWorld* lworld,
remove_manifest_entry(model, state_uri);
// Add manifest entry for this state to model
- SerdNode* s = serd_new_uri(SERD_MEASURE_STRING(state_uri));
+ SerdNode* s = serd_new_uri(SERD_STRING(state_uri));
// <state> a pset:Preset
serd_model_add(model, s, lworld->uris.rdf_a, lworld->uris.pset_Preset, NULL);
@@ -1049,7 +1051,7 @@ write_property_array(const LilvState* state,
Property* prop = &array->props[i];
const char* key = unmap->unmap(unmap->handle, prop->key);
- SerdNode* p = serd_new_uri(SERD_MEASURE_STRING(key));
+ SerdNode* p = serd_new_uri(SERD_STRING(key));
if (prop->type == state->atom_Path && !dir) {
const char* path = (const char*)prop->value;
const char* abs_path = lilv_state_rel2abs(state, path);
@@ -1087,7 +1089,7 @@ lilv_state_write(LilvWorld* world,
const SerdSink* sink = serd_writer_sink(writer);
const SerdNode* plugin_uri = state->plugin_uri;
SerdNode* subject =
- serd_new_uri(uri ? SERD_MEASURE_STRING(uri) : SERD_EMPTY_STRING());
+ serd_new_uri(uri ? SERD_STRING(uri) : SERD_EMPTY_STRING());
SerdStatus st = SERD_SUCCESS;
@@ -1105,7 +1107,7 @@ lilv_state_write(LilvWorld* world,
// <subject> rdfs:label label
if (state->label) {
- SerdNode* label = serd_new_string(SERD_MEASURE_STRING(state->label));
+ SerdNode* label = serd_new_string(SERD_STRING(state->label));
if ((st = serd_sink_write(
sink, 0, subject, world->uris.rdfs_label, label, NULL))) {
return st;
@@ -1123,7 +1125,7 @@ lilv_state_write(LilvWorld* world,
// Write port values (with pretty numbers)
for (uint32_t i = 0; i < state->n_values; ++i) {
PortValue* const value = &state->values[i];
- SerdNode* port = serd_new_blank(SERD_MEASURE_STRING(value->symbol));
+ SerdNode* port = serd_new_token(SERD_BLANK, SERD_STRING(value->symbol));
// <> lv2:port _:symbol
if ((st = serd_sink_write(
@@ -1132,7 +1134,7 @@ lilv_state_write(LilvWorld* world,
}
// _:symbol lv2:symbol "symbol"
- SerdNode* symbol = serd_new_string(SERD_MEASURE_STRING(value->symbol));
+ SerdNode* symbol = serd_new_string(SERD_STRING(value->symbol));
if ((st = serd_sink_write(
sink, 0, port, world->uris.lv2_symbol, symbol, NULL))) {
return st;
@@ -1157,7 +1159,7 @@ lilv_state_write(LilvWorld* world,
// <> state:state _:body
- SerdNode* body = serd_new_blank(SERD_STATIC_STRING("body"));
+ SerdNode* body = serd_new_token(SERD_BLANK, SERD_STRING("body"));
if (state->props.n > 0) {
if ((st = serd_sink_write(
sink, SERD_ANON_O, subject, world->uris.state_state, body, NULL))) {
@@ -1253,11 +1255,9 @@ lilv_state_save(LilvWorld* world,
lilv_state_make_links(state, abs_dir);
// Write state to Turtle file
- SerdNode* file =
- serd_new_file_uri(SERD_MEASURE_STRING(path), SERD_EMPTY_STRING());
- SerdNode* node =
- uri ? serd_new_uri(SERD_MEASURE_STRING(uri)) : serd_node_copy(file);
- SerdEnv* env = NULL;
+ SerdNode* file = serd_new_file_uri(SERD_STRING(path), SERD_EMPTY_STRING());
+ SerdNode* node = uri ? serd_new_uri(SERD_STRING(uri)) : serd_node_copy(file);
+ SerdEnv* env = NULL;
SerdWriter* ttl = ttl_file_writer(world->world, fd, file, &env);
SerdStatus st = lilv_state_write(
world, map, unmap, state, env, ttl, serd_node_string(node), dir);
@@ -1296,9 +1296,11 @@ lilv_state_to_string(LilvWorld* world,
return NULL;
}
- SerdBuffer buffer = {NULL, 0};
- SerdEnv* env = NULL;
- SerdNode* base = serd_new_uri(SERD_MEASURE_STRING(base_uri));
+ SerdBuffer buffer = {NULL, 0};
+ SerdEnv* env = NULL;
+ SerdNode* base =
+ serd_new_uri(base_uri ? SERD_STRING(base_uri) : SERD_EMPTY_STRING());
+
SerdByteSink* sink = serd_byte_sink_new_buffer(&buffer);
SerdWriter* writer = ttl_writer(world->world, sink, base, &env);
@@ -1345,7 +1347,7 @@ lilv_state_delete(LilvWorld* world, const LilvState* state)
LilvNode* manifest = lilv_world_get_manifest_node(world, bundle);
char* manifest_path = get_canonical_path(manifest);
const bool has_manifest = lilv_path_exists(manifest_path);
- SerdModel* model = serd_model_new(world->world, SERD_INDEX_SPO);
+ SerdModel* model = serd_model_new(world->world, SERD_ORDER_SPO, 0u);
if (has_manifest) {
// Read manifest into temporary local model
diff --git a/src/world.c b/src/world.c
index 31fa906..8d84e36 100644
--- a/src/world.c
+++ b/src/world.c
@@ -50,12 +50,17 @@ lilv_world_new(void)
goto fail;
}
- world->model = serd_model_new(
- world->world, SERD_INDEX_SPO | SERD_INDEX_OPS | SERD_INDEX_GRAPHS);
+ world->model =
+ serd_model_new(world->world, SERD_ORDER_SPO, SERD_STORE_GRAPHS);
if (!world->model) {
goto fail;
}
+ // TODO: All necessary?
+ serd_model_add_index(world->model, SERD_ORDER_OPS);
+ serd_model_add_index(world->model, SERD_ORDER_GSPO);
+ serd_model_add_index(world->model, SERD_ORDER_GOPS);
+
world->specs = NULL;
world->plugin_classes = lilv_plugin_classes_new();
world->plugins = lilv_plugins_new();
@@ -69,7 +74,7 @@ lilv_world_new(void)
#define NS_DYNMAN "http://lv2plug.in/ns/ext/dynmanifest#"
#define NS_OWL "http://www.w3.org/2002/07/owl#"
-#define NEW_URI(uri) serd_new_uri(SERD_STATIC_STRING(uri))
+#define NEW_URI(uri) serd_new_uri(SERD_STRING(uri))
world->uris.dc_replaces = NEW_URI(NS_DCTERMS "replaces");
world->uris.dman_DynManifest = NEW_URI(NS_DYNMAN "DynManifest");
@@ -258,12 +263,13 @@ lilv_world_filter_model(LilvWorld* world,
const SerdNode* object,
const SerdNode* graph)
{
- SerdModel* results = serd_model_new(world->world, SERD_INDEX_SPO);
- SerdRange* r = serd_model_range(model, subject, predicate, object, graph);
- for (; !serd_range_empty(r); serd_range_next(r)) {
- serd_model_insert(results, serd_range_front(r));
+ SerdModel* results = serd_model_new(world->world, SERD_ORDER_SPO, 0u);
+ SerdCursor* r = serd_model_find(model, subject, predicate, object, graph);
+ for (; !serd_cursor_is_end(r); serd_cursor_advance(r)) {
+ serd_model_insert(results, serd_cursor_get(r));
}
- serd_range_free(r);
+
+ serd_cursor_free(r);
return results;
}
@@ -275,7 +281,7 @@ lilv_world_find_nodes_internal(LilvWorld* world,
{
return lilv_nodes_from_range(
world,
- serd_model_range(world->model, subject, predicate, object, NULL),
+ serd_model_find(world->model, subject, predicate, object, NULL),
(object == NULL) ? SERD_OBJECT : SERD_SUBJECT);
}
@@ -353,9 +359,8 @@ lilv_world_add_spec(LilvWorld* world,
spec->data_uris = lilv_nodes_new();
// Add all data files (rdfs:seeAlso)
- FOREACH_PAT(
- s, world->model, specification_node, world->uris.rdfs_seeAlso, NULL, NULL)
- {
+ FOREACH_PAT (
+ s, world->model, specification_node, world->uris.rdfs_seeAlso, NULL, NULL) {
const SerdNode* file_node = serd_statement_object(s);
zix_tree_insert((ZixTree*)spec->data_uris, serd_node_copy(file_node), NULL);
}
@@ -420,8 +425,8 @@ lilv_world_add_plugin(LilvWorld* world,
#endif
// Add all plugin data files (rdfs:seeAlso)
- FOREACH_PAT(s, world->model, plugin_uri, world->uris.rdfs_seeAlso, NULL, NULL)
- {
+ FOREACH_PAT (
+ s, world->model, plugin_uri, world->uris.rdfs_seeAlso, NULL, NULL) {
const SerdNode* file_node = serd_statement_object(s);
zix_tree_insert(
(ZixTree*)plugin->data_uris, serd_node_copy(file_node), NULL);
@@ -459,33 +464,33 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
LV2_Dyn_Manifest_Handle handle = NULL;
// ?dman a dynman:DynManifest bundle_node
- SerdModel* model = lilv_world_filter_model(world,
+ SerdModel* model = lilv_world_filter_model(world,
world->model,
NULL,
world->uris.rdf_a,
world->uris.dman_DynManifest,
bundle_node);
- SerdIter* iter = serd_begin(model);
- for (; !serd_iter_end(iter); serd_iter_next(iter)) {
- const SerdNode* dmanifest = serd_iter_get_node(iter, SERD_SUBJECT);
+ SerdCursor* iter = serd_begin(model);
+ for (; !serd_cursor_end(iter); serd_cursor_next(iter)) {
+ const SerdNode* dmanifest = serd_cursor_get_node(iter, SERD_SUBJECT);
// ?dman lv2:binary ?binary
- SerdIter* binaries = serd_model_find(
+ SerdCursor* binaries = serd_model_find(
world->model, dmanifest, world->uris.lv2_binary, NULL, bundle_node);
- if (serd_iter_end(binaries)) {
- serd_iter_free(binaries);
+ if (serd_cursor_end(binaries)) {
+ serd_cursor_free(binaries);
LILV_ERRORF("Dynamic manifest in <%s> has no binaries, ignored\n",
serd_node_string(bundle_node));
continue;
}
// Get binary path
- const SerdNode* const binary = serd_iter_get_node(binaries, SERD_OBJECT);
- const char* const lib_uri = serd_node_string(binary);
+ const SerdNode* const binary = serd_cursor_get_node(binaries, SERD_OBJECT);
+ const char* const lib_uri = serd_node_string(binary);
char* const lib_path = serd_file_uri_parse(lib_uri, 0);
if (!lib_path) {
LILV_ERROR("No dynamic manifest library path\n");
- serd_iter_free(binaries);
+ serd_cursor_free(binaries);
continue;
}
@@ -495,7 +500,7 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
if (!lib) {
LILV_ERRORF(
"Failed to open dynmanifest library `%s' (%s)\n", lib_path, dlerror());
- serd_iter_free(binaries);
+ serd_cursor_free(binaries);
lilv_free(lib_path);
continue;
}
@@ -506,7 +511,7 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
OpenFunc dmopen = (OpenFunc)lilv_dlfunc(lib, "lv2_dyn_manifest_open");
if (!dmopen || dmopen(&handle, &dman_features)) {
LILV_ERRORF("No `lv2_dyn_manifest_open' in `%s'\n", lib_path);
- serd_iter_free(binaries);
+ serd_cursor_free(binaries);
dlclose(lib);
lilv_free(lib_path);
continue;
@@ -518,7 +523,7 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
(GetSubjectsFunc)lilv_dlfunc(lib, "lv2_dyn_manifest_get_subjects");
if (!get_subjects_func) {
LILV_ERRORF("No `lv2_dyn_manifest_get_subjects' in `%s'\n", lib_path);
- serd_iter_free(binaries);
+ serd_cursor_free(binaries);
dlclose(lib);
lilv_free(lib_path);
continue;
@@ -530,7 +535,7 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
desc->handle = handle;
desc->refs = 0;
- serd_iter_free(binaries);
+ serd_cursor_free(binaries);
// Generate data file
FILE* fd = tmpfile();
@@ -552,13 +557,13 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
fclose(fd);
// ?plugin a lv2:Plugin
- SerdModel* plugins = lilv_world_filter_model(world,
+ SerdModel* plugins = lilv_world_filter_model(world,
world->model,
NULL,
world->uris.rdf_a,
world->uris.lv2_Plugin,
dmanifest);
- SerdIter* p = serd_begin(plugins);
+ SerdCursor* p = serd_begin(plugins);
FOREACH_MATCH (s, p) {
const SerdNode* plug = serd_statement_subject(s);
lilv_world_add_plugin(world, plug, manifest, desc, bundle_node);
@@ -566,11 +571,11 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
if (desc->refs == 0) {
free(desc);
}
- serd_iter_free(p);
+ serd_cursor_free(p);
serd_free(plugins);
lilv_free(lib_path);
}
- serd_iter_free(iter);
+ serd_cursor_free(iter);
serd_free(model);
#else
@@ -623,18 +628,18 @@ load_plugin_model(LilvWorld* world,
const LilvNode* plugin_uri)
{
// Create model and reader for loading into it
- SerdModel* model =
- serd_model_new(world->world, SERD_INDEX_SPO | SERD_INDEX_OPS);
+ SerdModel* model = serd_model_new(world->world, SERD_ORDER_SPO, 0u);
SerdEnv* env = serd_env_new(serd_node_string_view(bundle_uri));
SerdSink* inserter = serd_inserter_new(model, NULL);
SerdReader* reader = serd_reader_new(
world->world, SERD_TURTLE, 0, env, inserter, LILV_READER_STACK_SIZE);
+ serd_model_add_index(model, SERD_ORDER_OPS);
+
// Load manifest
char* manifest_path = lilv_world_get_manifest_path(world, bundle_uri);
SerdByteSource* manifest_source =
serd_byte_source_new_filename(manifest_path, 4096);
- serd_reader_add_blank_prefix(reader, lilv_world_blank_node_prefix(world));
serd_reader_start(reader, manifest_source);
serd_reader_read_document(reader);
serd_reader_finish(reader);
@@ -643,15 +648,14 @@ load_plugin_model(LilvWorld* world,
SerdModel* files = lilv_world_filter_model(
world, model, plugin_uri, world->uris.rdfs_seeAlso, NULL, NULL);
- SerdIter* f = serd_model_begin(files);
- for (; !serd_iter_equals(f, serd_model_end(files)); serd_iter_next(f)) {
- const SerdNode* file = serd_statement_object(serd_iter_get(f));
+ SerdCursor* f = serd_model_begin(files);
+ for (; !serd_cursor_is_end(f); serd_cursor_advance(f)) {
+ const SerdNode* file = serd_statement_object(serd_cursor_get(f));
const char* uri_str = serd_node_string(file);
if (serd_node_type(file) == SERD_URI) {
char* path_str = serd_parse_file_uri(uri_str, NULL);
SerdByteSource* source = serd_byte_source_new_filename(path_str, 4096);
- serd_reader_add_blank_prefix(reader, lilv_world_blank_node_prefix(world));
serd_reader_start(reader, source);
serd_reader_read_document(reader);
serd_reader_finish(reader);
@@ -660,7 +664,7 @@ load_plugin_model(LilvWorld* world,
}
}
- serd_iter_free(f);
+ serd_cursor_free(f);
serd_model_free(files);
serd_reader_free(reader);
serd_env_free(env);
@@ -704,7 +708,7 @@ lilv_world_load_bundle(LilvWorld* world, const LilvNode* bundle_uri)
}
// ?plugin a lv2:Plugin
- SerdRange* plug_results = serd_model_range(
+ SerdCursor* plug_results = serd_model_find(
world->model, NULL, world->uris.rdf_a, world->uris.lv2_Plugin, bundle_uri);
// Find any loaded plugins that will be replaced with a newer version
@@ -749,7 +753,7 @@ lilv_world_load_bundle(LilvWorld* world, const LilvNode* bundle_uri)
serd_node_string(plug),
serd_node_string(last_bundle));
lilv_node_free(plugin_uri);
- serd_range_free(plug_results);
+ serd_cursor_free(plug_results);
lilv_world_drop_graph(world, bundle_uri);
lilv_node_free(manifest);
lilv_nodes_free(unload_uris);
@@ -758,7 +762,7 @@ lilv_world_load_bundle(LilvWorld* world, const LilvNode* bundle_uri)
lilv_node_free(plugin_uri);
}
- serd_range_free(plug_results);
+ serd_cursor_free(plug_results);
// Unload any old conflicting plugins
LilvNodes* unload_bundles = lilv_nodes_new();
@@ -782,14 +786,14 @@ lilv_world_load_bundle(LilvWorld* world, const LilvNode* bundle_uri)
lilv_nodes_free(unload_bundles);
// Re-search for plugin results now that old plugins are gone
- plug_results = serd_model_range(
+ plug_results = serd_model_find(
world->model, NULL, world->uris.rdf_a, world->uris.lv2_Plugin, bundle_uri);
FOREACH_MATCH (s, plug_results) {
const SerdNode* plug = serd_statement_subject(s);
lilv_world_add_plugin(world, plug, manifest, NULL, bundle_uri);
}
- serd_range_free(plug_results);
+ serd_cursor_free(plug_results);
lilv_world_load_dyn_manifest(world, bundle_uri, manifest);
@@ -798,8 +802,7 @@ lilv_world_load_bundle(LilvWorld* world, const LilvNode* bundle_uri)
const SerdNode* spec_preds[] = {
world->uris.lv2_Specification, world->uris.owl_Ontology, NULL};
for (const SerdNode** p = spec_preds; *p; ++p) {
- FOREACH_PAT(s, world->model, NULL, world->uris.rdf_a, *p, bundle_uri)
- {
+ FOREACH_PAT (s, world->model, NULL, world->uris.rdf_a, *p, bundle_uri) {
const SerdNode* spec = serd_statement_subject(s);
lilv_world_add_spec(world, spec, bundle_uri);
}
@@ -811,8 +814,8 @@ lilv_world_load_bundle(LilvWorld* world, const LilvNode* bundle_uri)
static int
lilv_world_drop_graph(LilvWorld* world, const SerdNode* graph)
{
- SerdRange* r = serd_model_range(world->model, NULL, NULL, NULL, graph);
- const SerdStatus st = serd_model_erase_range(world->model, r);
+ SerdCursor* r = serd_model_find(world->model, NULL, NULL, NULL, graph);
+ const SerdStatus st = serd_model_erase_statements(world->model, r);
if (st) {
LILV_ERRORF("Error dropping graph <%s> (%s)\n",
@@ -821,7 +824,7 @@ lilv_world_drop_graph(LilvWorld* world, const SerdNode* graph)
return st;
}
- serd_range_free(r);
+ serd_cursor_free(r);
return 0;
}
@@ -895,8 +898,7 @@ load_dir_entry(const char* dir, const char* name, void* data)
}
char* path = lilv_strjoin(dir, "/", name, "/", NULL);
- SerdNode* suri =
- serd_new_file_uri(SERD_MEASURE_STRING(path), SERD_EMPTY_STRING());
+ SerdNode* suri = serd_new_file_uri(SERD_STRING(path), SERD_EMPTY_STRING());
LilvNode* node = lilv_new_uri(world, serd_node_string(suri));
lilv_world_load_bundle(world, node);
@@ -972,9 +974,8 @@ lilv_world_load_plugin_classes(LilvWorld* world)
is e.g. how a host would build a menu), they won't be seen anyway...
*/
- FOREACH_PAT(
- s, world->model, NULL, world->uris.rdf_a, world->uris.rdfs_Class, NULL)
- {
+ FOREACH_PAT (
+ s, world->model, NULL, world->uris.rdf_a, world->uris.rdfs_Class, NULL) {
const SerdNode* class_node = serd_statement_subject(s);
const SerdNode* parent = serd_model_get(
@@ -1057,7 +1058,6 @@ lilv_world_load_file(LilvWorld* world, SerdReader* reader, const LilvNode* uri)
SerdByteSource* const source =
serd_byte_source_new_filename(filename, PAGE_SIZE);
- serd_reader_add_blank_prefix(reader, lilv_world_blank_node_prefix(world));
if ((st = serd_reader_start(reader, source)) ||
(st = serd_reader_read_document(reader)) ||
(st = serd_reader_finish(reader))) {
@@ -1081,10 +1081,11 @@ lilv_world_load_resource(LilvWorld* world, const LilvNode* resource)
SerdModel* files = lilv_world_filter_model(
world, world->model, resource, world->uris.rdfs_seeAlso, NULL, NULL);
- SerdIter* f = serd_model_begin(files);
- int n_read = 0;
- for (; !serd_iter_equals(f, serd_model_end(files)); serd_iter_next(f)) {
- const SerdNode* file = serd_statement_object(serd_iter_get(f));
+ SerdCursor* f = serd_model_begin(files);
+ int n_read = 0;
+ for (; !serd_cursor_equals(f, serd_model_end(files));
+ serd_cursor_advance(f)) {
+ const SerdNode* file = serd_statement_object(serd_cursor_get(f));
const char* file_str = serd_node_string(file);
LilvNode* file_node = serd_node_copy(file);
if (serd_node_type(file) != SERD_URI) {
@@ -1094,7 +1095,7 @@ lilv_world_load_resource(LilvWorld* world, const LilvNode* resource)
}
lilv_node_free(file_node);
}
- serd_iter_free(f);
+ serd_cursor_free(f);
serd_model_free(files);
return n_read;
@@ -1111,10 +1112,10 @@ lilv_world_unload_resource(LilvWorld* world, const LilvNode* resource)
SerdModel* files = lilv_world_filter_model(
world, world->model, resource, world->uris.rdfs_seeAlso, NULL, NULL);
- SerdIter* f = serd_model_begin(files);
- int n_dropped = 0;
- for (; !serd_iter_equals(f, serd_model_end(files)); serd_iter_next(f)) {
- const SerdNode* file = serd_statement_object(serd_iter_get(f));
+ SerdCursor* f = serd_model_begin(files);
+ int n_dropped = 0;
+ for (; !serd_cursor_is_end(f); serd_cursor_advance(f)) {
+ const SerdNode* file = serd_statement_object(serd_cursor_get(f));
LilvNode* file_node = serd_node_copy(file);
if (serd_node_type(file) != SERD_URI) {
LILV_ERRORF("rdfs:seeAlso node `%s' is not a URI\n",
@@ -1125,7 +1126,7 @@ lilv_world_unload_resource(LilvWorld* world, const LilvNode* resource)
}
lilv_node_free(file_node);
}
- serd_iter_free(f);
+ serd_cursor_free(f);
serd_model_free(files);
return n_dropped;