[tracker/wip/extract-graphs] tracker-extract, flac: Do all inserts in miner-fs's graph
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/extract-graphs] tracker-extract, flac: Do all inserts in miner-fs's graph
- Date: Tue, 6 Sep 2011 08:19:48 +0000 (UTC)
commit 3a819b85e1a0e11505ecf067247bceda2e46e7fe
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Sep 6 10:18:55 2011 +0200
tracker-extract, flac: Do all inserts in miner-fs's graph
src/tracker-extract/tracker-extract-flac.c | 45 ++++++++++++++++++++++++++-
1 files changed, 43 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-flac.c b/src/tracker-extract/tracker-extract-flac.c
index ae2c67a..043e70e 100644
--- a/src/tracker-extract/tracker-extract-flac.c
+++ b/src/tracker-extract/tracker-extract-flac.c
@@ -162,7 +162,9 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
const gchar *creator;
GFile *file;
goffset size;
+ const gchar *graph;
+ graph = tracker_extract_info_get_graph (info);
preupdate = tracker_extract_info_get_preupdate_builder (info);
metadata = tracker_extract_info_get_metadata_builder (info);
@@ -217,18 +219,30 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
artist_uri = tracker_sparql_escape_uri_printf ("urn:artist:%s", creator);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
+
tracker_sparql_builder_subject_iri (preupdate, artist_uri);
tracker_sparql_builder_predicate (preupdate, "a");
tracker_sparql_builder_object (preupdate, "nmm:Artist");
tracker_sparql_builder_predicate (preupdate, "nmm:artistName");
tracker_sparql_builder_object_unvalidated (preupdate, creator);
+
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
+
}
if (fd.album) {
album_uri = tracker_sparql_escape_uri_printf ("urn:album:%s", fd.album);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
tracker_sparql_builder_subject_iri (preupdate, album_uri);
tracker_sparql_builder_predicate (preupdate, "a");
@@ -239,6 +253,9 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_predicate (preupdate, "nmm:albumTitle");
tracker_sparql_builder_object_unvalidated (preupdate, fd.album);
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
if (fd.trackcount) {
@@ -255,11 +272,17 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_where_close (preupdate);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
tracker_sparql_builder_subject_iri (preupdate, album_uri);
tracker_sparql_builder_predicate (preupdate, "nmm:albumTrackCount");
tracker_sparql_builder_object_unvalidated (preupdate, fd.trackcount);
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
}
@@ -269,7 +292,6 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_predicate (preupdate, "nmm:albumGain");
tracker_sparql_builder_object_variable (preupdate, "unknown");
tracker_sparql_builder_delete_close (preupdate);
-
tracker_sparql_builder_where_open (preupdate);
tracker_sparql_builder_subject_iri (preupdate, album_uri);
tracker_sparql_builder_predicate (preupdate, "nmm:albumGain");
@@ -277,11 +299,17 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_where_close (preupdate);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
tracker_sparql_builder_subject_iri (preupdate, album_uri);
tracker_sparql_builder_predicate (preupdate, "nmm:albumGain");
tracker_sparql_builder_object_double (preupdate, atof (fd.albumgain));
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
}
@@ -291,7 +319,6 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_predicate (preupdate, "nmm:albumPeakGain");
tracker_sparql_builder_object_variable (preupdate, "unknown");
tracker_sparql_builder_delete_close (preupdate);
-
tracker_sparql_builder_where_open (preupdate);
tracker_sparql_builder_subject_iri (preupdate, album_uri);
tracker_sparql_builder_predicate (preupdate, "nmm:albumPeakGain");
@@ -299,11 +326,17 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_where_close (preupdate);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
tracker_sparql_builder_subject_iri (preupdate, album_uri);
tracker_sparql_builder_predicate (preupdate, "nmm:albumPeakGain");
tracker_sparql_builder_object_double (preupdate, atof (fd.albumpeakgain));
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate, graph);
+ }
tracker_sparql_builder_insert_close (preupdate);
}
}
@@ -350,6 +383,10 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_where_close (preupdate);
tracker_sparql_builder_insert_open (preupdate, NULL);
+ if (graph) {
+ tracker_sparql_builder_graph_open (preupdate, graph);
+ }
+
tracker_sparql_builder_subject_iri (preupdate, album_disc_uri);
tracker_sparql_builder_predicate (preupdate, "a");
tracker_sparql_builder_object (preupdate, "nmm:MusicAlbumDisc");
@@ -357,6 +394,10 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
tracker_sparql_builder_object_int64 (preupdate, fd.discno ? atoi (fd.discno) : 1);
tracker_sparql_builder_predicate (preupdate, "nmm:albumDiscAlbum");
tracker_sparql_builder_object_iri (preupdate, album_uri);
+
+ if (graph) {
+ tracker_sparql_builder_graph_close (preupdate);
+ }
tracker_sparql_builder_insert_close (preupdate);
tracker_sparql_builder_predicate (metadata, "nmm:musicAlbumDisc");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]