Top |
Functions
Description
TrackerResource keeps track of a set of properties for a given resource. The resulting data can be serialized in several ways.
Functions
tracker_resource_new ()
TrackerResource *
tracker_resource_new (const char *identifier
);
Creates a TrackerResource instance.
Since: 1.10
tracker_resource_set_boolean ()
void tracker_resource_set_boolean (TrackerResource *self
,const char *property_uri
,gboolean value
);
Sets a single-valued boolean object.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_set_double ()
void tracker_resource_set_double (TrackerResource *self
,const char *property_uri
,double value
);
Sets a single-valued double object.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_set_gvalue ()
void tracker_resource_set_gvalue (TrackerResource *self
,const char *property_uri
,const GValue *value
);
State that the only value for the given property is 'value'. Any existing values for 'property' will be removed.
When serialising to SPARQL, any properties that were set with this function will get a corresponding DELETE statement to remove any existing values in the database.
You can pass any kind of GValue for value
, but serialization functions will
normally only be able to serialize URIs/relationships and fundamental value
types (string, int, etc.).
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to set |
|
value |
an initialised GValue |
Since: 1.10
tracker_resource_set_identifier ()
void tracker_resource_set_identifier (TrackerResource *self
,const char *identifier
);
Changes the identifier of a TrackerResource. The identifier should be a URI or compact URI, but this is not necessarily enforced. Invalid identifiers may cause errors when serializing the resource or trying to insert the results in a database.
If the identifier is set to NULL, a SPARQL blank node identifier such as "_:123" is assigned to the resource.
Since: 1.10
tracker_resource_set_int ()
void tracker_resource_set_int (TrackerResource *self
,const char *property_uri
,int value
);
Sets a single-valued integer object.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_set_int64 ()
void tracker_resource_set_int64 (TrackerResource *self
,const char *property_uri
,gint64 value
);
Sets a single-valued integer object.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_set_relation ()
void tracker_resource_set_relation (TrackerResource *self
,const char *property_uri
,TrackerResource *resource
);
Sets a single-valued resource object as a TrackerResource. This
function produces similar RDF to tracker_resource_set_uri()
,
although in this function the URI will depend on the identifier
set on resource
.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
resource |
the property object |
Since: 1.10
tracker_resource_set_take_relation ()
void tracker_resource_set_take_relation (TrackerResource *self
,const char *property_uri
,TrackerResource *resource
);
Sets a single-valued resource object as a TrackerResource. This
function produces similar RDF to tracker_resource_set_uri()
,
although in this function the URI will depend on the identifier
set on resource
. This function takes ownership of resource
.
[skip]
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
resource |
the property object |
Since: 2.0
tracker_resource_set_string ()
void tracker_resource_set_string (TrackerResource *self
,const char *property_uri
,const char *value
);
Sets a single-valued string object.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_set_uri ()
void tracker_resource_set_uri (TrackerResource *self
,const char *property_uri
,const char *value
);
Sets a single-valued resource object as a string URI. This function
produces similar RDF to tracker_resource_set_relation()
, although
it requires that the URI is previously known.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_add_boolean ()
void tracker_resource_add_boolean (TrackerResource *self
,const char *property_uri
,gboolean value
);
Adds a boolean object to a multi-valued property.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_add_double ()
void tracker_resource_add_double (TrackerResource *self
,const char *property_uri
,double value
);
Adds a double object to a multi-valued property.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_add_gvalue ()
void tracker_resource_add_gvalue (TrackerResource *self
,const char *property_uri
,const GValue *value
);
Add 'value' to the list of values for given property.
You can pass any kind of GValue for value
, but serialization functions will
normally only be able to serialize URIs/relationships and fundamental value
types (string, int, etc.).
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to set |
|
value |
an initialised GValue |
Since: 1.10
tracker_resource_add_int ()
void tracker_resource_add_int (TrackerResource *self
,const char *property_uri
,int value
);
Adds an integer object to a multi-valued property.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_add_int64 ()
void tracker_resource_add_int64 (TrackerResource *self
,const char *property_uri
,gint64 value
);
Adds an integer object to a multi-valued property.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_add_relation ()
void tracker_resource_add_relation (TrackerResource *self
,const char *property_uri
,TrackerResource *resource
);
Adds a resource object to a multi-valued property. This
function produces similar RDF to tracker_resource_add_uri()
,
although in this function the URI will depend on the identifier
set on resource
.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
resource |
the property object |
Since: 1.10
tracker_resource_add_take_relation ()
void tracker_resource_add_take_relation (TrackerResource *self
,const char *property_uri
,TrackerResource *resource
);
Adds a resource object to a multi-valued property. This
function produces similar RDF to tracker_resource_add_uri()
,
although in this function the URI will depend on the identifier
set on resource
. This function takes ownership of resource
.
[skip]
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
resource |
the property object |
Since: 2.0
tracker_resource_add_string ()
void tracker_resource_add_string (TrackerResource *self
,const char *property_uri
,const char *value
);
Adds a string object to a multi-valued property.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_add_uri ()
void tracker_resource_add_uri (TrackerResource *self
,const char *property_uri
,const char *value
);
Adds a resource object to a multi-valued property. This function
produces similar RDF to tracker_resource_add_relation()
, although
it requires that the URI is previously known.
Parameters
self |
the TrackerResource |
|
property_uri |
a string identifying the property to modify |
|
value |
the property object |
Since: 1.10
tracker_resource_get_first_boolean ()
gboolean tracker_resource_get_first_boolean (TrackerResource *self
,const char *property_uri
);
Returns the first boolean object previously assigned to a property.
Since: 1.10
tracker_resource_get_first_double ()
double tracker_resource_get_first_double (TrackerResource *self
,const char *property_uri
);
Returns the first double object previously assigned to a property.
Since: 1.10
tracker_resource_get_first_int ()
int tracker_resource_get_first_int (TrackerResource *self
,const char *property_uri
);
Returns the first integer object previously assigned to a property.
Since: 1.10
tracker_resource_get_first_int64 ()
gint64 tracker_resource_get_first_int64 (TrackerResource *self
,const char *property_uri
);
Returns the first integer object previously assigned to a property.
Since: 1.10
tracker_resource_get_first_relation ()
TrackerResource * tracker_resource_get_first_relation (TrackerResource *self
,const char *property_uri
);
Returns the first resource object previously assigned to a property.
Since: 1.10
tracker_resource_get_first_string ()
const char * tracker_resource_get_first_string (TrackerResource *self
,const char *property_uri
);
Returns the first string object previously assigned to a property.
Since: 1.10
tracker_resource_get_first_uri ()
const char * tracker_resource_get_first_uri (TrackerResource *self
,const char *property_uri
);
Returns the first resource object previously assigned to a property.
Since: 1.10
tracker_resource_get_identifier ()
const char *
tracker_resource_get_identifier (TrackerResource *self
);
Returns the identifier of a resource.
If the identifier was set to NULL, the identifier returned will be a unique SPARQL blank node identifier, such as "_:123".
Since: 1.10
tracker_resource_get_values ()
GList * tracker_resource_get_values (TrackerResource *self
,const char *property_uri
);
Returns the list of all known values of the given property.
Returns
a GList of GValue instances, which must be freed by the caller.
[transfer full][element-type GValue]
Since: 1.10
tracker_resource_identifier_compare_func ()
gint tracker_resource_identifier_compare_func (TrackerResource *resource
,const char *identifier
);
tracker_resource_print_sparql_update ()
char * tracker_resource_print_sparql_update (TrackerResource *self
,TrackerNamespaceManager *namespaces
,const char *graph_id
);
Generates a SPARQL command to update a database with the information
stored in resource
.
The namespaces
object is used to expand any compact URI values. In most
cases you should pass NULL
, which means the set of namespaces returned by
tracker_namespace_manager_get_default()
will be used. This defines the
usual prefixes for all of the ontologies that Tracker ships with by default.
Parameters
self |
||
namespaces |
a set of prefixed URLs, or |
[allow-none] |
graph_id |
the URN of the graph the data should be added to,
or |
[allow-none] |
Since: 1.10
tracker_resource_print_turtle ()
char * tracker_resource_print_turtle (TrackerResource *self
,TrackerNamespaceManager *namespaces
);
Serialize all the information in resource
as a Turtle document.
The generated Turtle should correspond to this standard: https://www.w3.org/TR/2014/REC-turtle-20140225/
The namespaces
object is used to expand any compact URI values. In most
cases you should pass NULL
, which means the set of namespaces returned by
tracker_namespace_manager_get_default()
will be used. This defines the
usual prefixes for all of the ontologies that Tracker ships with by default.
Since: 1.10