[tracker/anonymous-file-nodes: 3/4] Make tracker-extract use WHERE clauses to find out the file urn.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/anonymous-file-nodes: 3/4] Make tracker-extract use WHERE clauses to find out the file urn.
- Date: Thu, 21 Jan 2010 14:32:59 +0000 (UTC)
commit 60a10c1d49dd45895f6f3592114f2583f26058e9
Author: Carlos Garnacho <carlos lanedo com>
Date: Thu Jan 21 15:27:25 2010 +0100
Make tracker-extract use WHERE clauses to find out the file urn.
src/tracker-extract/tracker-extract-abw.c | 2 +-
src/tracker-extract/tracker-extract-gstreamer.c | 2 +-
src/tracker-extract/tracker-extract-html.c | 2 +-
src/tracker-extract/tracker-extract-imagemagick.c | 2 +-
src/tracker-extract/tracker-extract-jpeg.c | 2 +-
src/tracker-extract/tracker-extract-libxine.c | 2 +-
src/tracker-extract/tracker-extract-mp3.c | 2 +-
src/tracker-extract/tracker-extract-mplayer.c | 6 ++--
src/tracker-extract/tracker-extract-msoffice.c | 2 +-
src/tracker-extract/tracker-extract-oasis.c | 2 +-
src/tracker-extract/tracker-extract-pdf.c | 2 +-
src/tracker-extract/tracker-extract-playlist.c | 2 +-
src/tracker-extract/tracker-extract-png.c | 2 +-
src/tracker-extract/tracker-extract-ps.c | 2 +-
src/tracker-extract/tracker-extract-text.c | 2 +-
src/tracker-extract/tracker-extract-tiff.c | 2 +-
src/tracker-extract/tracker-extract-totem.c | 2 +-
src/tracker-extract/tracker-extract-vorbis.c | 2 +-
src/tracker-extract/tracker-extract.c | 26 ++++++++++++++++-----
19 files changed, 40 insertions(+), 26 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-abw.c b/src/tracker-extract/tracker-extract-abw.c
index 90452dc..97c0545 100644
--- a/src/tracker-extract/tracker-extract-abw.c
+++ b/src/tracker-extract/tracker-extract-abw.c
@@ -72,7 +72,7 @@ extract_abw (const gchar *uri,
line = NULL;
length = 0;
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:Document");
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 213d44f..b5b6bb9 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -541,7 +541,7 @@ extract_metadata (MetadataExtractor *extractor,
}
}
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
if (extractor->mime == EXTRACT_MIME_AUDIO) {
diff --git a/src/tracker-extract/tracker-extract-html.c b/src/tracker-extract/tracker-extract-html.c
index c8dceaf..16c941a 100644
--- a/src/tracker-extract/tracker-extract-html.c
+++ b/src/tracker-extract/tracker-extract-html.c
@@ -237,7 +237,7 @@ extract_html (const gchar *uri,
NULL /* xmlStructuredErrorFunc */
};
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:Document");
diff --git a/src/tracker-extract/tracker-extract-imagemagick.c b/src/tracker-extract/tracker-extract-imagemagick.c
index d065dec..3fdf0fa 100644
--- a/src/tracker-extract/tracker-extract-imagemagick.c
+++ b/src/tracker-extract/tracker-extract-imagemagick.c
@@ -83,7 +83,7 @@ extract_imagemagick (const gchar *uri,
argv[5] = NULL;
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_predicate (metadata, "nfo:Image");
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index a2dc6a7..6f59f51 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -179,7 +179,7 @@ extract_jpeg (const gchar *uri,
MergeData md = { 0 };
gchar *comment = NULL;
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:Image");
tracker_sparql_builder_predicate (metadata, "a");
diff --git a/src/tracker-extract/tracker-extract-libxine.c b/src/tracker-extract/tracker-extract-libxine.c
index 47d5abc..5e1225a 100644
--- a/src/tracker-extract/tracker-extract-libxine.c
+++ b/src/tracker-extract/tracker-extract-libxine.c
@@ -128,7 +128,7 @@ tracker_extract_xine (const gchar *uri, TrackerSparqlBuilder *metadata)
g_free (canonical_uri);
}
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
if (has_video) {
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 37f0654..db372ac 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -2008,7 +2008,7 @@ extract_mp3 (const gchar *uri,
g_free (md.album);
}
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nmm:MusicPiece");
tracker_sparql_builder_object (metadata, "nfo:Audio");
diff --git a/src/tracker-extract/tracker-extract-mplayer.c b/src/tracker-extract/tracker-extract-mplayer.c
index 3290a35..45b000f 100644
--- a/src/tracker-extract/tracker-extract-mplayer.c
+++ b/src/tracker-extract/tracker-extract-mplayer.c
@@ -252,7 +252,7 @@ extract_mplayer (const gchar *uri,
g_pattern_spec_free (pattern_ID_LENGTH);
if (has_video) {
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nmm:Video");
@@ -271,7 +271,7 @@ extract_mplayer (const gchar *uri,
g_free (duration);
}
} else if (has_audio) {
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nmm:MusicPiece");
tracker_sparql_builder_object (metadata, "nfo:Audio");
@@ -291,7 +291,7 @@ extract_mplayer (const gchar *uri,
g_free (duration);
}
} else {
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:FileDataObject");
}
diff --git a/src/tracker-extract/tracker-extract-msoffice.c b/src/tracker-extract/tracker-extract-msoffice.c
index c795cf7..4e371c1 100644
--- a/src/tracker-extract/tracker-extract-msoffice.c
+++ b/src/tracker-extract/tracker-extract-msoffice.c
@@ -894,7 +894,7 @@ extract_summary (TrackerSparqlBuilder *metadata,
gchar *content;
gboolean is_encrypted = FALSE;
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:PaginatedTextDocument");
diff --git a/src/tracker-extract/tracker-extract-oasis.c b/src/tracker-extract/tracker-extract-oasis.c
index 1241912..150f929 100644
--- a/src/tracker-extract/tracker-extract-oasis.c
+++ b/src/tracker-extract/tracker-extract-oasis.c
@@ -127,7 +127,7 @@ extract_oasis (const gchar *uri,
/* Question: shouldn't we g_unlink meta.xml then? */
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:PaginatedTextDocument");
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index 3b9cfc5..cd1b896 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -199,7 +199,7 @@ extract_pdf (const gchar *uri,
return;
}
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:PaginatedTextDocument");
diff --git a/src/tracker-extract/tracker-extract-playlist.c b/src/tracker-extract/tracker-extract-playlist.c
index 92ea002..20e4eb9 100644
--- a/src/tracker-extract/tracker-extract-playlist.c
+++ b/src/tracker-extract/tracker-extract-playlist.c
@@ -139,7 +139,7 @@ extract_playlist (const gchar *uri,
g_signal_connect (G_OBJECT (pl), "entry-parsed",
G_CALLBACK (entry_parsed), &data);
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:MediaList");
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index 54986e6..e3a15b1 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -535,7 +535,7 @@ extract_png (const gchar *uri,
png_read_end (png_ptr, end_ptr);
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:Image");
tracker_sparql_builder_object (metadata, "nmm:Photo");
diff --git a/src/tracker-extract/tracker-extract-ps.c b/src/tracker-extract/tracker-extract-ps.c
index 1a8d2e5..0427d70 100644
--- a/src/tracker-extract/tracker-extract-ps.c
+++ b/src/tracker-extract/tracker-extract-ps.c
@@ -224,7 +224,7 @@ extract_ps (const gchar *uri,
line = NULL;
length = 0;
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:PaginatedTextDocument");
diff --git a/src/tracker-extract/tracker-extract-text.c b/src/tracker-extract/tracker-extract-text.c
index 8e222ea..737c01a 100644
--- a/src/tracker-extract/tracker-extract-text.c
+++ b/src/tracker-extract/tracker-extract-text.c
@@ -282,7 +282,7 @@ extract_text (const gchar *uri,
content = get_file_content (uri);
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:PlainTextDocument");
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index 51a3fdd..175af9a 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -296,7 +296,7 @@ extract_tiff (const gchar *uri, TrackerSparqlBuilder *metadata)
return;
}
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nfo:Image");
tracker_sparql_builder_object (metadata, "nmm:Photo");
diff --git a/src/tracker-extract/tracker-extract-totem.c b/src/tracker-extract/tracker-extract-totem.c
index 54207ca..c9b38de 100644
--- a/src/tracker-extract/tracker-extract-totem.c
+++ b/src/tracker-extract/tracker-extract-totem.c
@@ -146,7 +146,7 @@ extract_totem (const gchar *uri,
tracker_sparql_builder_object_unvalidated (metadata, album);
}
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
if (has_video) {
diff --git a/src/tracker-extract/tracker-extract-vorbis.c b/src/tracker-extract/tracker-extract-vorbis.c
index c3b4b6f..f958e65 100644
--- a/src/tracker-extract/tracker-extract-vorbis.c
+++ b/src/tracker-extract/tracker-extract-vorbis.c
@@ -176,7 +176,7 @@ extract_vorbis (const char *uri,
g_free (vorbis_data.album);
}
- tracker_sparql_builder_subject_iri (metadata, uri);
+ tracker_sparql_builder_subject_variable (metadata, "urn");
tracker_sparql_builder_predicate (metadata, "a");
tracker_sparql_builder_object (metadata, "nmm:MusicPiece");
tracker_sparql_builder_object (metadata, "nfo:Audio");
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index 4cea8bf..a1d305d 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -242,7 +242,7 @@ get_file_metadata (TrackerExtract *extract,
/* Create hash table to send back */
statements = tracker_sparql_builder_new_update ();
- tracker_sparql_builder_insert_open (statements, uri);
+ tracker_sparql_builder_insert_open (statements, NULL);
#ifdef HAVE_LIBSTREAMANALYZER
if (!priv->force_internal_extractors) {
@@ -432,10 +432,16 @@ tracker_extract_get_metadata_by_cmdline (TrackerExtract *object,
statements = get_file_metadata (object, request_id, NULL, uri, mime);
if (statements) {
- tracker_dbus_request_info (request_id,
- NULL,
- "%s",
- tracker_sparql_builder_get_result (statements));
+ tracker_sparql_builder_where_open (statements);
+
+ tracker_sparql_builder_subject_variable (statements, "urn");
+ tracker_sparql_builder_predicate (statements, "nie:url");
+ tracker_sparql_builder_object_string (statements, uri);
+
+ tracker_sparql_builder_where_close (statements);
+
+ tracker_dbus_request_info (request_id, NULL, "%s",
+ tracker_sparql_builder_get_result (statements));
g_object_unref (statements);
}
@@ -503,10 +509,18 @@ tracker_extract_get_metadata (TrackerExtract *object,
sparql = get_file_metadata (object, request_id, context, uri, mime);
if (sparql) {
+ tracker_sparql_builder_where_open (sparql);
+
+ tracker_sparql_builder_subject_variable (sparql, "urn");
+ tracker_sparql_builder_predicate (sparql, "nie:url");
+ tracker_sparql_builder_object_string (sparql, uri);
+
+ tracker_sparql_builder_where_close (sparql);
+
tracker_dbus_request_success (request_id, context);
if (tracker_sparql_builder_get_length (sparql) > 0) {
- /* tracker_info ("%s", tracker_sparql_builder_get_result (sparql)); */
+ /* tracker_info ("%s", statement); */
dbus_g_method_return (context, tracker_sparql_builder_get_result (sparql));
} else {
dbus_g_method_return (context, "");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]