`TrackerResource` is an in-memory representation of RDF data about a given resource.
This object keeps track of a set of properties for a given resource, and can also link to other `TrackerResource` objects to form trees
or graphs of RDF data. See [method@Resource.set_relation] and [method@Resource.set_uri] on how to link a `TrackerResource` to other RDF
data.
`TrackerResource` may also hold data about literal values, added through the specialized [method@Resource.set_int64], [
method@Resource.set_string], etc family of functions, or the generic [method@Resource.set_gvalue] method.
Since RDF properties may be multi-valued, for every `set` call there exists another `add` call (e.g. [method@Resource.add_int64], [
method@Resource.add_string] and so on). The `set` methods do also reset any previously value the property might hold for the given
resource.
Resources may have an IRI set at creation through [ctor@Resource.new], or set afterwards through [method@Resource.set_identifier].
Resources without a name will represent a blank node, and will be dealt with as such during database insertions.
`TrackerResource` performs no validation on the data being coherent as per any ontology. Errors will be found out at the time of using
the TrackerResource for e.g. database updates.
Once the RDF data is built in memory, the (tree of) `TrackerResource` may be converted to a RDF format through [method@Resource.print_rdf
], or directly inserted into a database through [method@Batch.add_resource] or [method@SparqlConnection.update_resource].
- public void add_boolean (string property_uri, bool value)
Adds a boolean property.
- public void add_datetime (string property_uri, DateTime value)
Adds a date property as a [type@GLib.
- public void add_double (string property_uri, double value)
Adds a numeric property with double precision.
- public void add_gvalue (string property_uri, Value value)
Add value to the list of values for given property.
- public void add_int (string property_uri, int value)
Adds a numeric property with integer precision.
- public void add_int64 (string property_uri, int64 value)
Adds a numeric property with 64-bit integer precision.
- public void add_relation (string property_uri, Resource resource)
Adds a resource property as a `TrackerResource`.
- public void add_string (string property_uri, string value)
Adds a string property.
- public void add_take_relation (string property_uri, owned Resource resource)
Adds a resource property as a `TrackerResource`.
- public void add_uri (string property_uri, string value)
Adds a resource property as an URI string.
- public bool get_first_boolean (string property_uri)
Returns the first boolean object previously assigned to a property.
- public unowned DateTime? get_first_datetime (string property_uri)
Returns the first [type@GLib.
- public double get_first_double (string property_uri)
Returns the first double object previously assigned to a property.
- public int get_first_int (string property_uri)
Returns the first integer object previously assigned to a property.
- public int64 get_first_int64 (string property_uri)
Returns the first integer object previously assigned to a property.
- public unowned Resource? get_first_relation (string property_uri)
Returns the first resource object previously assigned to a property.
- public unowned string? get_first_string (string property_uri)
Returns the first string object previously assigned to a property.
- public unowned string? get_first_uri (string property_uri)
Returns the first resource object previously assigned to a property.
- public unowned string? get_identifier ()
Returns the identifier of a resource.
- public List<unowned string> get_properties ()
Gets the list of properties defined in this
- public bool get_property_overwrite (string property_uri)
Returns whether the prior values for this property would be deleted in
the SPARQL issued by this.
- public List<unowned Value?>? get_values (string property_uri)
Returns the list of all known values of the given property.
- public int identifier_compare_func (string identifier)
A helper function that compares a `TrackerResource` by its identifier
string.
- public string print_jsonld (NamespaceManager? namespaces)
Serialize all the information in resource as a JSON-LD
document.
- public string print_rdf (NamespaceManager namespaces, RdfFormat format, string? graph)
Serialize all the information in resource into the
selected RDF format.
- public string print_sparql_update (NamespaceManager? namespaces, string? graph_id)
Generates a SPARQL command to update a database with the information
stored in resource.
- public string print_turtle (NamespaceManager? namespaces)
Serialize all the information in resource as a Turtle
document.
- public unowned Variant? serialize ()
Serializes a `TrackerResource` to a [type@GLib.
- public void set_boolean (string property_uri, bool value)
Sets a boolean property.
- public void set_datetime (string property_uri, DateTime value)
Sets a date property as a [type@GLib.
- public void set_double (string property_uri, double value)
Sets a numeric property with double precision.
- public void set_gvalue (string property_uri, Value value)
Replace any previously existing value for property_uri
with value.
- public void set_identifier (string? identifier)
Changes the identifier of a `TrackerResource`.
- public void set_int (string property_uri, int value)
Sets a numeric property with integer precision.
- public void set_int64 (string property_uri, int64 value)
Sets a numeric property with 64-bit integer precision.
- public void set_relation (string property_uri, Resource resource)
Sets a resource property as a `TrackerResource`.
- public void set_string (string property_uri, string value)
Sets a string property.
- public void set_take_relation (string property_uri, owned Resource resource)
Sets a resource property as a `TrackerResource`.
- public void set_uri (string property_uri, string value)
Sets a resource property as an URI string.