Tracker.SparqlConnection¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Tracker.SparqlConnection(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
TrackerSparqlConnection
holds a connection to a RDF triple store.This triple store may be of three types:
Local to the process, created through [ctor`Tracker`.SparqlConnection.new].
A HTTP SPARQL endpoint over the network, created through [ctor`Tracker`.SparqlConnection.remote_new]
A DBus SPARQL endpoint owned by another process in the same machine, created through [ctor`Tracker`.SparqlConnection.bus_new]
When creating a local triple store, it is required to give details about its structure. This is done by passing a location to an ontology, see more on how are ontologies defined. A local database may be stored in a filesystem location, or it may reside in memory.
A
TrackerSparqlConnection
is private to the calling process, it can be exposed to other hosts/processes via a [class`Tracker`.Endpoint], see [ctor`Tracker`.EndpointDBus.new] and [ctor`Tracker`.EndpointHttp.new].When issuing SPARQL queries and updates, it is recommended that these are created through [class`Tracker`.SparqlStatement] to avoid the SPARQL injection class of bugs, see [method`Tracker`.SparqlConnection.query_statement] and [method`Tracker`.SparqlConnection.update_statement]. For SPARQL updates it is also possible to use a “builder” approach to generate RDF data, see [class`Tracker`.Resource]. It is also possible to create [class`Tracker`.SparqlStatement] objects for SPARQL queries and updates from SPARQL strings embedded in a [struct`Gio`.Resource], see [method`Tracker`.SparqlConnection.load_statement_from_gresource].
To get the best performance, it is recommended that SPARQL updates are clustered through [class`Tracker`.Batch].
TrackerSparqlConnection
also offers a number of methods for the simple cases, [method`Tracker`.SparqlConnection.query] may be used when there is a SPARQL query string directly available, and the [method`Tracker`.SparqlConnection.update] family of functions may be used for one-off updates. All functions have asynchronous variants.When a SPARQL query is executed, a [class`Tracker`.SparqlCursor] will be obtained to iterate over the query results.
Depending on the ontology definition,
TrackerSparqlConnection
may emit notifications whenever resources of certain types get insert, modified or deleted from the triple store (see nrl:notify. These notifications can be handled via a [class`Tracker`.Notifier] obtained with [method`Tracker`.SparqlConnection.create_notifier].After done with a connection, it is recommended to call [method`Tracker`.SparqlConnection.close] or [method`Tracker`.SparqlConnection.close_async] explicitly to cleanly close the connection and prevent consistency checks on future runs. The triple store connection will be implicitly closed when the
TrackerSparqlConnection
object is disposed.A
TrackerSparqlConnection
may be used from multiple threads, asynchronous updates are executed sequentially on arrival order, asynchronous queries are dispatched in a thread pool.If you ever have the need to procedurally compose SPARQL query strings, consider the use of [func`Tracker`.sparql_escape_string] for literal strings and the [func`Tracker`.sparql_escape_uri] family of functions for URIs.
- classmethod bus_new(service_name, object_path, dbus_connection)¶
- Parameters:
- Raises:
- Returns:
a new
TrackerSparqlConnection
.- Return type:
service_name (nullable): The name of the D-Bus service to connect to, or
None
if not using a message bus. Connects to a database owned by another process on the local machine via DBus.When using a message bus (session/system), the service_name argument will be used to describe the remote endpoint, either by unique or well-known D-Bus names. If not using a message bus (e.g. peer-to-peer D-Bus connections) the service_name may be
None
.The D-Bus object path of the remote endpoint will be given through object_path,
None
may be used to use the default/org/freedesktop/Tracker3/Endpoint
path.The D-Bus connection used to set up the connection may be given through the dbus_connection argument. Using
None
will resort to the default session bus.
- classmethod bus_new_async(service_name, object_path, dbus_connection, cancellable, callback, *user_data)¶
- Parameters:
service_name (
str
) – The name of the D-Bus service to connect to.object_path (
str
orNone
) – The path to the object, orNone
to use the default.dbus_connection (
Gio.DBusConnection
orNone
) – The [class`Gio`.DBusConnection] to use, orNone
to use the session buscancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]callback (
Gio.AsyncReadyCallback
orNone
) – User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.user_data (
object
orNone
) – User-defined data to be passed to callback
Connects asynchronously to a database owned by another process on the local machine via DBus.
New in version 3.1.
- classmethod bus_new_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – A [type`Gio`.AsyncResult] with the result of the operation- Raises:
- Returns:
a new
TrackerSparqlConnection
.- Return type:
Finishes the operation started with [func`Tracker`.SparqlConnection.bus_new_async].
New in version 3.1.
- classmethod new(flags, store, ontology, cancellable)¶
- Parameters:
flags (
Tracker.SparqlConnectionFlags
) – Connection flags to define the SPARQL connection behaviorstore (
Gio.File
orNone
) – The directory that contains the database as a [iface`Gio`.File], orNone
ontology (
Gio.File
orNone
) – The directory that contains the database schemas as a [iface`Gio`.File], orNone
cancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]
- Raises:
- Returns:
a new
TrackerSparqlConnection
.- Return type:
Creates or opens a process-local database.
This method should only be used for databases owned by the current process. To connect to databases managed by other processes, use [ctor`Tracker`.SparqlConnection.bus_new].
If store is
None
, the database will be created in memory.If defined, the ontology argument must point to a location containing suitable
.ontology
files in Turtle format. These define the structure of the triple store. You can learn more about ontologies, or you can use the stock Nepomuk ontologies by calling [func`Tracker`.sparql_get_ontology_nepomuk].If opening an existing database, it is possible to pass
None
as the ontology location, the ontology will be introspected from the database. Passing aNone
ontology will raise an error if the database does not exist.If a database is opened without the #TRACKER_SPARQL_CONNECTION_FLAG_READONLY flag enabled, and the given ontology holds differences with the current data layout, migration to the new structure will be attempted. This operation may raise an error. In particular, not all migrations are possible without causing data loss and Tracker will refuse to delete data during a migration. The database is always left in a consistent state, either prior or posterior to migration.
Operations on a [class`Tracker`.SparqlConnection] resulting on a [error`Tracker`.SparqlError.CORRUPT] error will have the event recorded persistently through a
.meta.corrupted
file alongside the database files. If the database is opened without the [flags`Tracker`.SparqlConnectionFlags.READONLY] flag and the file is found, this constructor will attempt to repair the database. In that situation, this constructor will either return a valid [class`Tracker`.SparqlConnection] if the database was repaired successfully, or raise a [error`Tracker`.SparqlError.CORRUPT] error if the database remains corrupted.It is considered a developer error to ship ontologies that contain format errors, or that fail at migrations.
It is encouraged to use
resource:///
URI locations for ontology wherever possible, so the triple store structure is tied to the executable binary, and in order to minimize disk seeks duringTrackerSparqlConnection
initialization.
- classmethod new_async(flags, store, ontology, cancellable, callback, *user_data)¶
- Parameters:
flags (
Tracker.SparqlConnectionFlags
) – Connection flags to define the SPARQL connection behaviorstore (
Gio.File
orNone
) – The directory that contains the database as a [iface`Gio`.File], orNone
ontology (
Gio.File
orNone
) – The directory that contains the database schemas as a [iface`Gio`.File], orNone
cancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]callback (
Gio.AsyncReadyCallback
orNone
) – User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.user_data (
object
orNone
) – User-defined data to be passed to callback
Creates or opens a process-local database asynchronously.
See [ctor`Tracker`.SparqlConnection.new] for more information.
- classmethod new_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – A [type`Gio`.AsyncResult] with the result of the operation- Raises:
- Return type:
Finishes the operation started with [func`Tracker`.SparqlConnection.new_async].
- classmethod remote_new(uri_base)¶
- Parameters:
uri_base (
str
) – Base URI of the remote connection- Returns:
a new remote
TrackerSparqlConnection
.- Return type:
Creates a connection to a remote HTTP SPARQL endpoint.
The connection is made using the libsoup HTTP library. The connection will normally use the
https://
orhttp://
protocols.
- close()¶
Closes a SPARQL connection.
No other API calls than
GObject.Object.unref
() should happen after this call.This call is blocking. All pending updates will be flushed, and the store databases will be closed orderly. All ongoing SELECT queries will be cancelled. Notifiers will no longer emit events.
- close_async(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]callback (
Gio.AsyncReadyCallback
orNone
) – User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.user_data (
object
orNone
) – User-defined data to be passed to callback
Closes a SPARQL connection asynchronously.
No other API calls than
GObject.Object.unref
() should happen after this call.
- close_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – A [type`Gio`.AsyncResult] with the result of the operation- Raises:
- Returns:
- Return type:
Finishes the operation started with [method`Tracker`.SparqlConnection.close_async].
- create_batch()¶
- Returns:
(nullable): A new [class`Tracker`.Batch]
- Return type:
Creates a new [class`Tracker`.Batch] to store and execute SPARQL updates.
If the connection is readonly or cannot issue SPARQL updates,
None
will be returned.
- create_notifier()¶
- Returns:
A newly created notifier.
- Return type:
Creates a new [class`Tracker`.Notifier] to receive notifications about changes in self.
See [class`Tracker`.Notifier] documentation for information about how to use this object.
Connections to HTTP endpoints will return
None
.
- deserialize_async(flags, format, default_graph, stream, cancellable, callback, *user_data)¶
- Parameters:
flags (
Tracker.DeserializeFlags
) – Deserialization flagsformat (
Tracker.RdfFormat
) – RDF format of data in streamdefault_graph (
str
) – Default graph that will receive the RDF datastream (
Gio.InputStream
) – Input stream with RDF datacancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]callback (
Gio.AsyncReadyCallback
orNone
) – User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.user_data (
object
orNone
) – User-defined data to be passed to callback
Loads the RDF data contained in stream into the given self.
This is an asynchronous operation, callback will be invoked when the data has been fully inserted to self.
The RDF data will be inserted in the given default_graph if one is provided, or the anonymous graph if default_graph is
None
. Any RDF data that has a graph specified (e.g. using theGRAPH
clause in the Trig format) will be inserted in the specified graph instead of default_graph.The flags argument is reserved for future expansions, currently
Tracker.DeserializeFlags.NONE
must be passed.New in version 3.4.
- deserialize_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – A [type`Gio`.AsyncResult] with the result of the operation- Raises:
- Returns:
True
if all data was inserted successfully.- Return type:
Finishes the operation started with [method`Tracker`.SparqlConnection.deserialize_async].
New in version 3.4.
- get_namespace_manager()¶
- Returns:
a [class`Tracker`.NamespaceManager] with the prefixes of self.
- Return type:
Returns a [class`Tracker`.NamespaceManager] that contains all prefixes in the ontology of self.
- load_statement_from_gresource(resource_path, cancellable)¶
- Parameters:
resource_path (
str
) – The resource path of the file to parse.cancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]
- Raises:
- Returns:
A prepared statement
- Return type:
Prepares a [class`Tracker`.SparqlStatement] for the SPARQL contained as a [struct`Gio`.Resource] file at resource_path.
SPARQL Query files typically have the .rq extension. This will use [method`Tracker`.SparqlConnection.query_statement] or [method`Tracker`.SparqlConnection.update_statement] underneath to indistinctly return SPARQL query or update statements.
New in version 3.3.
- map_connection(handle_name, service_connection)¶
- Parameters:
handle_name (
str
) – Handle name for service_connectionservice_connection (
Tracker.SparqlConnection
) – aTrackerSparqlConnection
to use from self
Maps a
TrackerSparqlConnection
onto another through aprivate:@handle_name
URI.This can be accessed via the SERVICE SPARQL syntax in queries from self. E.g.:
``c tracker_sparql_connection_map_connection (connection,
“other-connection”, other_connection);
``sparql SELECT ?u {
- SERVICE <private:other-connection> {
?u a rdfs:Resource
}
}¶
This is useful to interrelate data from multiple
TrackerSparqlConnection
instances maintained by the same process, without creating a public endpoint for service_connection.self may only be a
TrackerSparqlConnection
created via [ctor`Tracker`.SparqlConnection.new] and [func`Tracker`.SparqlConnection.new_async].New in version 3.3.
- query(sparql, cancellable)¶
- Parameters:
sparql (
str
) – String containing the SPARQL querycancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]
- Raises:
- Returns:
a [class`Tracker`.SparqlCursor] with the results.
- Return type:
Executes a SPARQL query on self.
This method is synchronous and will block until the query is executed. See [method`Tracker`.SparqlConnection.query_async] for an asynchronous variant.
If the query is partially built from user input or other untrusted sources, special care is required about possible SPARQL injection. In order to avoid it entirely, it is recommended to use [class`Tracker`.SparqlStatement]. The function [func`Tracker`.sparql_escape_string] exists as a last resort, but its use is not recommended.
- query_async(sparql, cancellable, callback, *user_data)¶
- Parameters:
sparql (
str
) – String containing the SPARQL querycancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]callback (
Gio.AsyncReadyCallback
orNone
) – User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.user_data (
object
orNone
) – User-defined data to be passed to callback
Executes asynchronously a SPARQL query on self
If the query is partially built from user input or other untrusted sources, special care is required about possible SPARQL injection. In order to avoid it entirely, it is recommended to use [class`Tracker`.SparqlStatement]. The function [func`Tracker`.sparql_escape_string] exists as a last resort, but its use is not recommended.
- query_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – A [type`Gio`.AsyncResult] with the result of the operation- Raises:
- Returns:
a [class`Tracker`.SparqlCursor] with the results.
- Return type:
Finishes the operation started with [method`Tracker`.SparqlConnection.query_async].
- query_statement(sparql, cancellable)¶
- Parameters:
sparql (
str
) – The SPARQL querycancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]
- Raises:
- Returns:
A prepared statement
- Return type:
Prepares the given
SELECT
/ASK
/DESCRIBE
/CONSTRUCT
SPARQL query as a [class`Tracker`.SparqlStatement].This prepared statement can be executed through [method`Tracker`.SparqlStatement.execute] or [method`Tracker`.SparqlStatement.serialize_async] families of functions.
- serialize_async(flags, format, query, cancellable, callback, *user_data)¶
- Parameters:
flags (
Tracker.SerializeFlags
) – Serialization flagsformat (
Tracker.RdfFormat
) – Output RDF formatquery (
str
) – SPARQL querycancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]callback (
Gio.AsyncReadyCallback
orNone
) – User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.user_data (
object
orNone
) – User-defined data to be passed to callback
Serializes a
DESCRIBE
orCONSTRUCT
query into the specified RDF format.This is an asynchronous operation, callback will be invoked when the data is available for reading.
The SPARQL endpoint may not support the specified format, in that case an error will be raised.
The flags argument is reserved for future expansions, currently
Tracker.SerializeFlags.NONE
must be passed.New in version 3.3.
- serialize_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – A [type`Gio`.AsyncResult] with the result of the operation- Raises:
- Returns:
A [class`Gio`.InputStream] to read RDF content.
- Return type:
Finishes the operation started with [method`Tracker`.SparqlConnection.serialize_async].
New in version 3.3.
- update(sparql, cancellable)¶
- Parameters:
sparql (
str
) – String containing the SPARQL update querycancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]
- Raises:
Executes a SPARQL update on self.
This method is synchronous and will block until the update is finished. See [method`Tracker`.SparqlConnection.update_async] for an asynchronous variant.
It is recommented to consider the usage of [class`Tracker`.Batch] to cluster database updates. Frequent isolated SPARQL updates through this method will have a degraded performance in comparison.
If the query is partially built from user input or other untrusted sources, special care is required about possible SPARQL injection. In order to avoid it entirely, it is recommended to use [class`Tracker`.SparqlStatement], or to build the SPARQL input through [class`Tracker`.Resource]. The function [func`Tracker`.sparql_escape_string] exists as a last resort, but its use is not recommended.
- update_array_async(sparql, sparql_length, cancellable, callback, *user_data)¶
- Parameters:
sparql (
str
) – An array of strings containing the SPARQL update queriessparql_length (
int
) – The amount of strings you pass as sparqlcancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]callback (
Gio.AsyncReadyCallback
orNone
) – User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.user_data (
object
orNone
) – User-defined data to be passed to callback
Executes asynchronously an array of SPARQL updates. All updates in the array are handled within a single transaction.
If the query is partially built from user input or other untrusted sources, special care is required about possible SPARQL injection. In order to avoid it entirely, it is recommended to use [class`Tracker`.SparqlStatement], or to build the SPARQL input through [class`Tracker`.Resource]. The function [func`Tracker`.sparql_escape_string] exists as a last resort, but its use is not recommended.
- update_array_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – A [type`Gio`.AsyncResult] with the result of the operation- Raises:
- Returns:
True
if there were no errors.- Return type:
Finishes the operation started with [method`Tracker`.SparqlConnection.update_array_async].
- update_async(sparql, cancellable, callback, *user_data)¶
- Parameters:
sparql (
str
) – String containing the SPARQL update querycancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]callback (
Gio.AsyncReadyCallback
orNone
) – User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.user_data (
object
orNone
) – User-defined data to be passed to callback
Executes asynchronously a SPARQL update.
It is recommented to consider the usage of [class`Tracker`.Batch] to cluster database updates. Frequent isolated SPARQL updates through this method will have a degraded performance in comparison.
If the query is partially built from user input or other untrusted sources, special care is required about possible SPARQL injection. In order to avoid it entirely, it is recommended to use [class`Tracker`.SparqlStatement], or to build the SPARQL input through [class`Tracker`.Resource]. The function [func`Tracker`.sparql_escape_string] exists as a last resort, but its use is not recommended.
- update_blank(sparql, cancellable)¶
- Parameters:
sparql (
str
) – String containing the SPARQL update querycancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]
- Raises:
- Returns:
a [type`GLib`.Variant] with the generated URNs.
- Return type:
Executes a SPARQL update and returns the names of the generated blank nodes.
This method is synchronous and will block until the update is finished. See [method`Tracker`.SparqlConnection.update_blank_async] for an asynchronous variant.
The sparql query should be built with [class`Tracker`.Resource], or its parts correctly escaped using [func`Tracker`.sparql_escape_string], otherwise SPARQL injection is possible.
The format string of the
GVariant
isaaa{ss}
(an array of an array of dictionaries). The first array represents each INSERT that may exist in the SPARQL string. The second array represents each new node for a given WHERE clause. The last array holds a string pair with the blank node name (e.g.foo
for the blank node_:foo
) and the URN that was generated for it. For most updates the first two outer arrays will only contain one item.Deprecated since version 3.5: This function makes the expectation that blank nodes have a durable name that persist. The SPARQL and RDF specs define a much more reduced scope for blank node labels. This function advises a behavior that goes against that reduced scope, and will directly make the returned values meaningless if the
Tracker.SparqlConnectionFlags.ANONYMOUS_BNODES
flag is defined in the connection. Users that want names generated for them, should look for other methods (e.g. IRIs containing UUIDv4 strings).
- update_blank_async(sparql, cancellable, callback, *user_data)¶
- Parameters:
sparql (
str
) – String containing the SPARQL update querycancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]callback (
Gio.AsyncReadyCallback
orNone
) – User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.user_data (
object
orNone
) – User-defined data to be passed to callback
Executes asynchronously a SPARQL update and returns the names of the generated blank nodes.
See the [method`Tracker`.SparqlConnection.update_blank] documentation to learn the differences with [method`Tracker`.SparqlConnection.update].
Deprecated since version 3.5: See [method`Tracker`.SparqlConnection.update_blank].
- update_blank_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – A [type`Gio`.AsyncResult] with the result of the operation- Raises:
- Returns:
a [type`GLib`.Variant] with the generated URNs.
- Return type:
Finishes the operation started with [method`Tracker`.SparqlConnection.update_blank_async].
This method returns the URNs of the generated nodes, if any. See the [method`Tracker`.SparqlConnection.update_blank] documentation for the interpretation of the returned [type`GLib`.Variant].
Deprecated since version 3.5: See [method`Tracker`.SparqlConnection.update_blank].
- update_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – A [type`Gio`.AsyncResult] with the result of the operation- Raises:
Finishes the operation started with [method`Tracker`.SparqlConnection.update_async].
- update_resource(graph, resource, cancellable)¶
- Parameters:
graph (
str
orNone
) – RDF graph where the resource should be inserted/updated, orNone
for the default graphresource (
Tracker.Resource
) – A [class`Tracker`.Resource]cancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]
- Raises:
- Returns:
True
if there were no errors.- Return type:
Inserts a resource as described by resource on the given graph.
This method is synchronous and will block until the update is finished. See [method`Tracker`.SparqlConnection.update_resource_async] for an asynchronous variant.
It is recommented to consider the usage of [class`Tracker`.Batch] to cluster database updates. Frequent isolated SPARQL updates through this method will have a degraded performance in comparison.
New in version 3.1.
- update_resource_async(graph, resource, cancellable, callback, *user_data)¶
- Parameters:
graph (
str
orNone
) – RDF graph where the resource should be inserted/updated, orNone
for the default graphresource (
Tracker.Resource
) – A [class`Tracker`.Resource]cancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]callback (
Gio.AsyncReadyCallback
orNone
) – User-defined [type`Gio`.AsyncReadyCallback] to be called when the asynchronous operation is finished.user_data (
object
orNone
) – User-defined data to be passed to callback
Inserts asynchronously a resource as described by resource on the given graph.
It is recommented to consider the usage of [class`Tracker`.Batch] to cluster database updates. Frequent isolated SPARQL updates through this method will have a degraded performance in comparison.
New in version 3.1.
- update_resource_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – A [type`Gio`.AsyncResult] with the result of the operation- Raises:
- Returns:
True
if there were no errors.- Return type:
Finishes the operation started with [method`Tracker`.SparqlConnection.update_resource_async].
New in version 3.1.
- update_statement(sparql, cancellable)¶
- Parameters:
sparql (
str
) – The SPARQL updatecancellable (
Gio.Cancellable
orNone
) – Optional [type`Gio`.Cancellable]
- Raises:
- Returns:
A prepared statement
- Return type:
Prepares the given
INSERT
/DELETE
SPARQL as a [class`Tracker`.SparqlStatement].This prepared statement can be executed through the [method`Tracker`.SparqlStatement.update] family of functions.
New in version 3.5.