Commit 8cc026da authored by Sam Thursfield's avatar Sam Thursfield Committed by Sam Thursfield

Use TrackerResource instead of TrackerSparqlBuilder in all extractors

For a long time, all the Tracker extractors have manually constructed a
SPARQL update command using TrackerSparqlBuilder to represent their
output. This commit changes all of them to use the TrackerResource
class instead, which makes the code a lot more concise and readable.

This introduces some API breaks in the internal libtracker-extract
library. This has been a private library since Tracker 0.16 or earlier,
so it's fine.

If the extractors only output SPARQL then they are only useful to
people who are using a SPARQL store. Now we can output a serialization
format like Turtle as well. This will hopefully make the extract modules
useful outside of Tracker itself.

I've tried to preserve the behaviour of the extractors as much as
possible, but there are two things that are now handled differently:

  * nao:Tag resources are given a fixed URI based on the tag label, such
    as <urn:tag:My_Tag>. Previously they were inserted as blank nodes,
    so tracker-store would give them unique IDs like <urn:uuid:1234...>

  * All extractors created nco:Contact resources for content publishers,
    but previously some would assign fixed URIs based on the name
    <urn:contact:James%20Joyce>, while others would insert them as blank
    nodes so they would be assigned unique IDs like <urn:uuid:1234...>.
    Now, all extractors create nco:Contact resources with fixed URIs
    based on the content creator's name.

https://bugzilla.gnome.org/show_bug.cgi?id=767472
parent 032e2a7e
......@@ -22,7 +22,7 @@ For more information see the libtracker-extract reference documentation.
.SH OPTIONS
.TP
.B \-\-verbosity\fR=<\fILEVEL\fR>
.B \-v, \-\-verbosity\fR=<\fILEVEL\fR>
This sets the log verbosity for the extractor process.
The possible \fILEVEL\fR options are:
......@@ -68,6 +68,11 @@ The possible \fILEVEL\fR options are:
\- Show only warnings, criticals, errors or fatal events.
.RE
.TP
.B \-o, \-\-output-format\fR=<\fIFORMAT\fR>
Choose which format to use to output results. Supported formats are
\fIsparql\fR and \fIturtle\fR.
.SH EXAMPLES
.TP
Using command line to extract metadata from a file:
......
......@@ -35,6 +35,11 @@ typedef enum {
TRACKER_SCHED_IDLE_NEVER,
} TrackerSchedIdle;
typedef enum {
TRACKER_SERIALIZATION_FORMAT_SPARQL,
TRACKER_SERIALIZATION_FORMAT_TURTLE,
} TrackerSerializationFormat;
G_END_DECLS
#endif /* __TRACKER_ENUMS_H__ */
......@@ -24,6 +24,7 @@
#error "only <libtracker-extract/tracker-extract.h> must be included directly."
#endif
#include <libtracker-sparql/tracker-resource.h>
#include <libtracker-sparql/tracker-sparql.h>
#include "tracker-module-manager.h"
#include "tracker-extract-info.h"
......@@ -31,61 +32,17 @@
G_BEGIN_DECLS
/**
* SECTION:tracker-data
* @title: How to use libtracker-extract
* @short_description: The essentials by example
* @stability: Stable
* SECTION:tracker-extract
* @title: libtracker-extract
* @stability: Unstable
* @include: libtracker-extract/tracker-extract.h
*
* The libtracker-extract library is the foundation for Tracker
* metadata extraction of embedded data in files.
* The libtracker-extract library is an internal, private library for Tracker
* metadata extraction modules. Third party applications should not link
* against libtracker-extract, because its API may change at any time.
*
* Tracker comes with extractors written for the most common file
* types (like MP3, JPEG, PNG, etc.), however, for more special cases,
* 3rd party applications may want to write their own plugin to
* extract their own file formats. This documentation describes how to
* do that.
*
* <example>
* <title>Basic extractor example</title>
* An example of how to write an extractor to retrieve PNG embedded
* metadata.
* <programlisting>
* G_MODULE_EXPORT gboolean
* tracker_extract_get_metadata (TrackerExtractInfo *info)
* {
* GFile *file;
* TrackerSparqlBuilder *metadata;
* gint height, width;
*
* file = tracker_extract_info_get_file (info);
* metadata = tracker_extract_info_get_metadata_builder (info);
*
* /&ast; Do data extraction. &ast;/
* height = ...
* width = ...
*
* /&ast; Insert data into TrackerSparqlBuilder object. &ast;/
* tracker_sparql_builder_predicate (metadata, "a");
* tracker_sparql_builder_object (metadata, "nfo:Image");
* tracker_sparql_builder_object (metadata, "nmm:Photo");
*
* tracker_sparql_builder_predicate (metadata, "nfo:width");
* tracker_sparql_builder_object_int64 (metadata, width);
*
* tracker_sparql_builder_predicate (metadata, "nfo:height");
* tracker_sparql_builder_object_int64 (metadata, height);
*
* /&ast; Were we successful or not? &ast;/
* return TRUE;
* }
* </programlisting>
* </example>
*
* NOTE: This example has changed subtly since 0.10. For details see
* tracker_extract_get_metadata().
*
* Since: 0.12
* If you want to insert metadata into the Tracker store from a 3rd party
* application, look at the TrackerDecorator class from libtracker-miner.
*/
gboolean tracker_extract_module_init (TrackerModuleThreadAwareness *thread_awareness_ret,
......
......@@ -39,15 +39,10 @@
struct _TrackerExtractInfo
{
TrackerSparqlBuilder *preupdate;
TrackerSparqlBuilder *postupdate;
TrackerSparqlBuilder *metadata;
gchar *where_clause;
TrackerResource *resource;
GFile *file;
gchar *mimetype;
gchar *graph;
gchar *urn;
#ifdef HAVE_LIBMEDIAART
MediaArtProcess *media_art_process;
......@@ -73,9 +68,7 @@ G_DEFINE_BOXED_TYPE (TrackerExtractInfo, tracker_extract_info,
**/
TrackerExtractInfo *
tracker_extract_info_new (GFile *file,
const gchar *mimetype,
const gchar *graph,
const gchar *urn)
const gchar *mimetype)
{
TrackerExtractInfo *info;
......@@ -84,14 +77,8 @@ tracker_extract_info_new (GFile *file,
info = g_slice_new0 (TrackerExtractInfo);
info->file = g_object_ref (file);
info->mimetype = g_strdup (mimetype);
info->graph = g_strdup (graph);
info->urn = g_strdup (urn);
info->preupdate = tracker_sparql_builder_new_update ();
info->postupdate = tracker_sparql_builder_new_update ();
info->metadata = tracker_sparql_builder_new_embedded_insert ();
info->where_clause = NULL;
info->resource = NULL;
#ifdef HAVE_LIBMEDIAART
info->media_art_process = NULL;
......@@ -139,13 +126,9 @@ tracker_extract_info_unref (TrackerExtractInfo *info)
if (g_atomic_int_dec_and_test (&info->ref_count)) {
g_object_unref (info->file);
g_free (info->mimetype);
g_free (info->graph);
g_free (info->urn);
g_object_unref (info->preupdate);
g_object_unref (info->postupdate);
g_object_unref (info->metadata);
g_free (info->where_clause);
if (info->resource)
g_object_unref (info->resource);
#ifdef HAVE_LIBMEDIAART
if (info->media_art_process)
......@@ -195,131 +178,60 @@ tracker_extract_info_get_mimetype (TrackerExtractInfo *info)
return info->mimetype;
}
/**
* tracker_extract_info_get_graph:
* @info: a #TrackerExtractInfo
*
* Returns the SPARQL graph that will be used when
* inserting metadata.
*
* Returns: (transfer none): The SPARQL graph the extract
* operation belongs to.
*
* Since: 0.12
**/
const gchar *
tracker_extract_info_get_graph (TrackerExtractInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
return info->graph;
}
/**
* tracker_extract_info_get_preupdate_builder:
* tracker_extract_info_get_resource:
* @info: a #TrackerExtractInfo
*
* Returns a #TrackerSparqlBuilder containing any
* separate updates that could apply to the file,
* such as author/band information in audio files,
* and so on.
* Returns the #TrackerResource representing metadata about the file
* associated with this #TrackerExtractInfo, or %NULL if
* tracker_extract_info_set_metadata() was not yet called.
*
* Returns: (transfer none): miscellaneous metadata
* Returns: (transfer none): a #TrackerResource instance
*
* Since: 0.12
**/
TrackerSparqlBuilder *
tracker_extract_info_get_preupdate_builder (TrackerExtractInfo *info)
* Since: 1.10
*/
TrackerResource *
tracker_extract_info_get_resource (TrackerExtractInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
return info->preupdate;
return info->resource;
}
/**
* tracker_extract_info_get_postupdate_builder:
* tracker_extract_info_set_resource:
* @info: a #TrackerExtractInfo
* @resource: a #TrackerResource
*
* Returns a #TrackerSparqlBuilder containing separate
* updates for resources that are contained within the file
* and need to refer to it.
* Adds the #TrackerResource with results from the extraction to this
* #TrackerExtractInfo.
*
* Returns: (transfer none): #TrackerSparqlBuilder for
* resources that need inserting after the file resource.
* Information about the file itself should be represented by properties of
* @resource itself. It's expected this resource will have nfo:FileDataObject
* as one of its types. This @resource can have related resources attached to
* it.
*
* Since: 0.12.4
**/
TrackerSparqlBuilder *
tracker_extract_info_get_postupdate_builder (TrackerExtractInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
return info->postupdate;
}
/**
* tracker_extract_info_get_metadata_builder:
* @info: a #TrackerExtractInfo
* In most cases, a file contains a single logical resource. Most MP3 files
* contain one song, for example. In this case you set all properties on the
* one @resource.
*
* Returns a #TrackerSparqlBuilder containing the
* file metadata.
* In more complex cases, a single physical resource (i.e. a file) contains multiple
* logical resources: for example, an MBOX file holding multiple emails, or
* an audio file containing an entire CD. In this case you should treat each
* logical resource as its own #TrackerResource. Only properties of the file
* itself should be set on @resource. You then relate each logical
* #TrackerResource to the main @resource using the nie:isStoredAs property.
*
* Returns: (transfer none): the file metadata
* FIXME: you need a way to delete the logical resources when re-extracting a
* file -- still need to decide on API for that.
*
* Since: 0.12
**/
TrackerSparqlBuilder *
tracker_extract_info_get_metadata_builder (TrackerExtractInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
return info->metadata;
}
/**
* tracker_extract_info_get_where_clause:
* @info: a #TrackerExtractInfo
*
* Returns the where clause that will apply to the
* other metadata contained in @info.
*
* Returns: (transfer none): The where clause
*
* Since: 0.12
**/
const gchar *
tracker_extract_info_get_where_clause (TrackerExtractInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
return info->where_clause;
}
/**
* tracker_extract_info_set_where_clause:
* @info: a #TrackerExtractInfo
* @where: Where clause for the file update.
*
* Sets the where clause for the returned metadata.
*
* Since: 0.12
* Since: 1.10
**/
void
tracker_extract_info_set_where_clause (TrackerExtractInfo *info,
const gchar *where)
{
g_return_if_fail (info != NULL);
g_free (info->where_clause);
info->where_clause = g_strdup (where);
}
const gchar *
tracker_extract_info_get_urn (TrackerExtractInfo *info)
tracker_extract_info_set_resource (TrackerExtractInfo *info,
TrackerResource *resource)
{
g_return_val_if_fail (info != NULL, NULL);
return info->urn;
g_object_ref (resource);
info->resource = resource;
}
#ifdef HAVE_LIBMEDIAART
......
......@@ -40,21 +40,15 @@ typedef struct _TrackerExtractInfo TrackerExtractInfo;
GType tracker_extract_info_get_type (void) G_GNUC_CONST;
TrackerExtractInfo * tracker_extract_info_new (GFile *file,
const gchar *mimetype,
const gchar *graph,
const gchar *urn);
const gchar *mimetype);
TrackerExtractInfo * tracker_extract_info_ref (TrackerExtractInfo *info);
void tracker_extract_info_unref (TrackerExtractInfo *info);
GFile * tracker_extract_info_get_file (TrackerExtractInfo *info);
const gchar * tracker_extract_info_get_mimetype (TrackerExtractInfo *info);
const gchar * tracker_extract_info_get_graph (TrackerExtractInfo *info);
const gchar * tracker_extract_info_get_urn (TrackerExtractInfo *info);
TrackerSparqlBuilder *tracker_extract_info_get_preupdate_builder (TrackerExtractInfo *info);
TrackerSparqlBuilder *tracker_extract_info_get_postupdate_builder (TrackerExtractInfo *info);
TrackerSparqlBuilder *tracker_extract_info_get_metadata_builder (TrackerExtractInfo *info);
const gchar * tracker_extract_info_get_where_clause (TrackerExtractInfo *info);
void tracker_extract_info_set_where_clause (TrackerExtractInfo *info,
const gchar *where);
TrackerResource * tracker_extract_info_get_resource (TrackerExtractInfo *info);
void tracker_extract_info_set_resource (TrackerExtractInfo *info,
TrackerResource *resource);
#ifdef HAVE_LIBMEDIAART
......
......@@ -87,6 +87,9 @@ get_date_from_file_mtime (const gchar *uri)
* (before the "." and extension of the file) as the title. If the
* title has any "_" characters, they are also converted into spaces.
*
* This function only operates if Tracker was compiled with
* --enable-guarantee-metadata enabled at configure-time.
*
* Returns: %TRUE on success and content was added to @metadata, otherwise %FALSE.
*
* Since: 0.10
......@@ -160,6 +163,9 @@ tracker_guarantee_title_from_file (TrackerSparqlBuilder *metadata,
* When parsing @uri, stat() is called on the file to create a
* date based on the file's mtime.
*
* This function only operates if Tracker was compiled with
* --enable-guarantee-metadata enabled at configure-time.
*
* Returns: %TRUE on success and content was added to @metadata, otherwise %FALSE.
*
* Since: 0.10
......@@ -205,3 +211,140 @@ tracker_guarantee_date_from_file_mtime (TrackerSparqlBuilder *metadata,
return success;
}
/**
* tracker_guarantee_resource_title_from_file:
* @resource: the relevant #TrackerResource
* @key: the property URI to set
* @current_value: the current data to check before looking at @uri.
* @uri: a string representing a URI to use
* @p_new_value: pointer to a string which receives the new title, or
* %NULL
*
* Checks @current_value to make sure it is usable (i.e. not %NULL or an
* empty string). If it is not usable, then @uri is parsed to guarantee a
* metadata value for @key.
*
* Parses the file pointed to by @uri and uses the basename
* (before the "." and extension of the file) as the title. If the
* title has any "_" characters, they are also converted into spaces.
*
* This function only operates if Tracker was compiled with
* --enable-guarantee-metadata enabled at configure-time.
*
* Returns: %TRUE on success and content was added to @metadata, otherwise %FALSE.
*
* Since: 1.10
**/
gboolean
tracker_guarantee_resource_title_from_file (TrackerResource *resource,
const gchar *key,
const gchar *current_value,
const gchar *uri,
gchar **p_new_value)
{
gboolean success = TRUE;
#ifdef GUARANTEE_METADATA
g_return_val_if_fail (metadata != NULL, FALSE);
g_return_val_if_fail (key != NULL, FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
if (current_value && *current_value != '\0') {
tracker_resource_set_string (resource, key, current_value);
if (p_new_value != NULL) {
*p_new_value = g_strdup (current_value);
}
} else {
gchar *value;
value = get_title_from_file (uri);
if (value && value[0] != '\0') {
tracker_resource_set_string (resource, key, value);
} else {
success = FALSE;
}
if (p_new_value != NULL) {
*p_new_value = value;
} else {
g_free (value);
}
}
#else /* GUARANTEE_METADATA */
if (current_value && *current_value != '\0') {
tracker_resource_set_string (resource, key, current_value);
if (p_new_value != NULL) {
*p_new_value = g_strdup (current_value);
}
} else {
success = FALSE;
}
#endif /* GUARANTEE_METADATA */
return success;
}
/**
* tracker_guarantee_resource_date_from_file_mtime:
* @resource: the relevant #TrackerResource
* @key: the property URI to set
* @current_value: the current data to check before looking at @uri
* @uri: a string representing a URI to use
*
* Checks @current_value to make sure it is sane (i.e. not %NULL or an
* empty string). If it is, then @uri is parsed to guarantee a
* metadata value for @key.
*
* When parsing @uri, stat() is called on the file to create a
* date based on the file's mtime.
*
* This function only operates if Tracker was compiled with
* --enable-guarantee-metadata enabled at configure-time.
*
* Returns: %TRUE on success and content was added to @metadata, otherwise %FALSE.
*
* Since: 1.10
**/
gboolean
tracker_guarantee_resource_date_from_file_mtime (TrackerResource *resource,
const gchar *key,
const gchar *current_value,
const gchar *uri)
{
gboolean success = TRUE;
#ifdef GUARANTEE_METADATA
g_return_val_if_fail (resource != NULL, FALSE);
g_return_val_if_fail (key != NULL, FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
if (current_value && *current_value != '\0') {
tracker_resource_set_string (resource, key, current_value);
} else {
gchar *value;
value = get_date_from_file_mtime (uri);
if (value && *value != '\0') {
tracker_resource_set_string (resource, key, value);
} else {
success = FALSE;
}
g_free (value);
}
#else /* GUARANTEE_METADATA */
if (current_value && *current_value != '\0') {
tracker_resource_set_string (resource, key, current_value);
} else {
success = FALSE;
}
#endif /* GUARANTEE_METADATA */
return success;
}
......@@ -40,6 +40,16 @@ gboolean tracker_guarantee_date_from_file_mtime (TrackerSparqlBuilder *metadata,
const gchar *current_value,
const gchar *uri);
gboolean tracker_guarantee_resource_title_from_file (TrackerResource *resource,
const gchar *key,
const gchar *current_value,
const gchar *uri,
gchar **p_new_value);
gboolean tracker_guarantee_resource_date_from_file_mtime (TrackerResource *resource,
const gchar *key,
const gchar *current_value,
const gchar *uri);
G_END_DECLS
#endif /* __LIBTRACKER_EXTRACT_GUARANTEE_H__ */
......@@ -264,6 +264,7 @@ tracker_extract_new_music_album_disc (const char *album_title,
disc_uri = tracker_sparql_escape_uri_printf ("urn:album-disc:%s:Disc%d", album_title, disc_number);
album_disc = tracker_resource_new (disc_uri);
tracker_resource_set_uri (album_disc, "rdf:type", "nmm:MusicAlbumDisc");
tracker_resource_set_int (album_disc, "nmm:setNumber", disc_number > 0 ? disc_number : 1);
tracker_resource_add_relation (album_disc, "nmm:albumDiscAlbum", album);
......
This diff is collapsed.
......@@ -171,16 +171,11 @@ TrackerXmpData *tracker_xmp_new (const gchar *buffer,
gsize len,
const gchar *uri);
void tracker_xmp_free (TrackerXmpData *data);
gboolean tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
TrackerSparqlBuilder *metadata,
const gchar *graph,
GString *where,
const gchar *uri,
TrackerXmpData *data);
gboolean tracker_xmp_apply_regions (TrackerSparqlBuilder *preupdate,
TrackerSparqlBuilder *metadata,
const gchar *graph,
TrackerXmpData *data);
gboolean tracker_xmp_apply_to_resource (TrackerResource *resource,
TrackerXmpData *data);
gboolean tracker_xmp_apply_regions_to_resource (TrackerResource *resource,
TrackerXmpData *data);
#ifndef TRACKER_DISABLE_DEPRECATED
......@@ -188,6 +183,7 @@ gboolean tracker_xmp_read (const gchar *buffer,
size_t len,
const gchar *uri,
TrackerXmpData *data) G_GNUC_DEPRECATED;
#endif /* TRACKER_DISABLE_DEPRECATED */
G_END_DECLS
......
This diff is collapsed.
......@@ -47,8 +47,7 @@ typedef enum {
} AbwParserTag;
struct AbwParserData {
TrackerSparqlBuilder *metadata;
TrackerSparqlBuilder *preupdate;
TrackerResource *resource;
GString *content;
gchar *uri;
......@@ -109,8 +108,7 @@ abw_parser_text (GMarkupParseContext *context,
str, data->uri);
} else {
data->has_title = TRUE;
tracker_sparql_builder_predicate (data->metadata, "nie:title");
tracker_sparql_builder_object_unvalidated (data->metadata, str);
tracker_resource_set_string (data->resource, "nie:title", str);
}
break;
case ABW_PARSER_TAG_SUBJECT:
......@@ -119,29 +117,24 @@ abw_parser_text (GMarkupParseContext *context,
str, data->uri);
} else {
data->has_subject = TRUE;
tracker_sparql_builder_predicate (data->metadata, "nie:subject");
tracker_sparql_builder_object_unvalidated (data->metadata, str);
tracker_resource_set_string (data->resource, "nie:subject", str);
}
break;
case ABW_PARSER_TAG_CREATOR:
tracker_sparql_builder_predicate (data->metadata, "nco:creator");
case ABW_PARSER_TAG_CREATOR: {
TrackerResource *creator;
creator = tracker_extract_new_contact (str);
tracker_resource_set_relation (data->resource, "nco:creator", creator);
g_object_unref (creator);
tracker_sparql_builder_object_blank_open (data->metadata);
tracker_sparql_builder_predicate (data->metadata, "a");
tracker_sparql_builder_object (data->metadata, "nco:Contact");
tracker_sparql_builder_predicate (data->metadata, "nco:fullname");
tracker_sparql_builder_object_unvalidated (data->metadata, str);
tracker_sparql_builder_object_blank_close (data->metadata);
break;
}
case ABW_PARSER_TAG_DESCRIPTION:
if (data->has_comment) {
g_warning ("Avoiding additional comment (%s) in Abiword document '%s'",
str, data->uri);
} else {
data->has_comment = TRUE;
tracker_sparql_builder_predicate (data->metadata, "nie:comment");
tracker_sparql_builder_object_unvalidated (data->metadata, str);
tracker_resource_set_string (data->resource, "nie:comment", str);
}
break;
case ABW_PARSER_TAG_GENERATOR:
......@@ -150,8 +143,7 @@ abw_parser_text (GMarkupParseContext *context,
str, data->uri);
} else {
data->has_generator = TRUE;
tracker_sparql_builder_predicate (data->metadata, "nie:generator");
tracker_sparql_builder_object_unvalidated (data->metadata, str);
tracker_resource_set_string (data->resource, "nie:generator", str);
}
break;
case ABW_PARSER_TAG_KEYWORDS:
......@@ -160,8 +152,7 @@ abw_parser_text (GMarkupParseContext *context,
for (keyword = strtok_r (str, ",; ", &lasts); keyword;
keyword = strtok_r (NULL, ",; ", &lasts)) {
tracker_sparql_builder_predicate (data->metadata, "nie:keyword");
tracker_sparql_builder_object_unvalidated (data->metadata, keyword);
tracker_resource_add_string (data->resource, "nie:keyword", keyword);
}
}
break;
......@@ -191,7 +182,6 @@ static GMarkupParser parser = {
G_MODULE_EXPORT gboolean
tracker_extract_get_metadata (TrackerExtractInfo *info)
{
TrackerSparqlBuilder *preupdate, *metadata;
int fd;
gchar *filename, *contents;
gboolean retval = FALSE;
......@@ -199,9 +189,6 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
gsize len;
struct stat st;
preupdate = tracker_extract_info_get_preupdate_builder (info);
metadata = tracker_extract_info_get_metadata_builder (info);
f = tracker_extract_info_get_file (info);
filename = g_file_get_path (f);
......@@ -248,11 +235,9 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
AbwParserData data = { 0 };
data.uri = g_file_get_uri (f);
data.metadata = metadata;
data.preupdate = preupdate;
data.resource = tracker_resource_new (NULL);
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:Document");
tracker_resource_add_uri (data.resource, "rdf:type", "nfo:Document");
context = g_markup_parse_context_new (&parser, 0, &data, NULL);
g_markup_parse_context_parse (context, contents, len, &error);
......@@ -262,8 +247,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
g_error_free (error);
} else {
if (data.content) {
tracker_sparql_builder_predicate (metadata, "nie:plainTextContent");
tracker_sparql_builder_object_unvalidated (metadata, data.content->str);
tracker_resource_set_string (data.resource, "nie:plainTextContent", data.content->str);
g_string_free (data.content, TRUE);
}
......@@ -272,8 +256,10 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
g_markup_parse_context_free (context);
g_free (data.uri);
}
tracker_extract_info_set_resource (info, data.resource);
g_object_unref (data.resource);
}