Method

TrackerSparqlConnectionupdate_blank

Declaration [src]

GVariant*
tracker_sparql_connection_update_blank (
  TrackerSparqlConnection* connection,
  const gchar* sparql,
  GCancellable* cancellable,
  GError** error
)

Description [src]

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 tracker_sparql_connection_update_blank_async() for an asynchronous variant.

The sparql query should be built with TrackerResource, or its parts correctly escaped using tracker_sparql_escape_string(), otherwise SPARQL injection is possible.

The format string of the GVariant is aaa{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: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_SPARQL_CONNECTION_FLAGS_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).

Parameters

sparql const gchar*
 

String containing the SPARQL update query.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
cancellable GCancellable*
 

Optional GCancellable

 The argument can be NULL.
 The data is owned by the caller of the function.
error GError **
  The return location for a GError*, or NULL.

Return value

Returns: GVariant*
 

A GVariant with the generated URNs.

 The caller of the method takes ownership of the data, and is responsible for freeing it.