Comparing Redland and its C++ Wrapper
The Redland Wrapper is a C++ layer around the underlying C libraries that libOmexMeta depends on. Its not perfect, not is it a comprehensive Redland Library wrapper, but for our intents and purposed it works.
Here is a demonstration of how to create a new Triple using the Redland API and the Redland Wrapper.
#include "librdf.h"
int main(){
librdf_world *world = librdf_new_world();
librdf_storage *storage = librdf_new_storage(world, "memory", "SemsimMemoryStore", nullptr);
librdf_model *model = librdf_new_model(world, storage, nullptr);
librdf_statement *statement = librdf_new_statement_from_nodes(
world,
librdf_new_node_from_uri_string(
world, (const unsigned char *) "https://subject.com"),
librdf_new_node_from_uri_string(
world,
(const unsigned char *) "https://predicate.com"),
librdf_new_node_from_uri_string(
world,
(const unsigned char *) "https://resource.com")
);
librdf_model_add_statement(model, statement);
librdf_free_statement(statement);
librdf_free_storage(storage);
librdf_free_model(model);
librdf_free_world(world);
return 0;
}
#include "redland/RedlandAPI.h"
int main(){
LibrdfStorage storage;
LibrdfModel model(storage.get());
LibrdfStatement statement = LibrdfStatement::fromRawNodePtrs(
LibrdfNode::fromUriString("https//subject.com").get(),
LibrdfNode::fromUriString("https//predicate.com").get(),
LibrdfNode::fromUriString("https//resource.com").get()
);
model.addStatement(statement);
statement.freeStatement();
model.freeModel();
storage.freeStorage();
return 0;
}