TrackerNamespaceManager should support custom ontologies more easily
The TrackerNamespaceManager API was designed around 2016, when Tracker SPARQL provided a single, global connection that was tied to Nepomuk. Thus it provides a single, global NamespaceManager.
Since Tracker 3.0, a process can have multiple SPARQL connections, each with potentially different ontologies. This causes an inconvenience when using TrackerResource, as the user needs to manually create a namespace manager for the connection before serialising to SPARQL.
ns = tracker_namespace_manager_new(); tracker_namespace_manager_add_prefix(ns, "ex", "http://example.com#"); tracker_resource_print_sparql_update(resource, ns, "graph");
If the user uses the default namespace manager, they will get confusing errors as prefixes in the resulting SPARQL won't be expanded and the database will reject the update.
- improve documentation, testing and examples in this regard
- consider creating a NamespaceManager when loading ontologies, so the user doesn't need to do this themselves. Perhaps also a new
tracker_sparql_connection_save_resource()method that ensures the correct NamespaceManager is used, instead of having the user serialize to SPARQL explicitly (which might also allow more optimised inserts, in future...)