tracker r2624 - branches/turtle/src/tracker-indexer



Author: pvanhoof
Date: Mon Dec  1 14:19:18 2008
New Revision: 2624
URL: http://svn.gnome.org/viewvc/tracker?rev=2624&view=rev

Log:
2008-12-01  Philip Van Hoof  <philip codeminded be>

	* src/tracker-indexer/tracker-removable-device.c
	* src/tracker-indexer/tracker-removable-device.h
	* src/tracker-indexer/tracker-indexer.c: Added detecting the rdf-type
	while writing out Turtle files to the metadata.ttl of a removable
	device



Modified:
   branches/turtle/src/tracker-indexer/tracker-indexer.c
   branches/turtle/src/tracker-indexer/tracker-removable-device.c
   branches/turtle/src/tracker-indexer/tracker-removable-device.h

Modified: branches/turtle/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/turtle/src/tracker-indexer/tracker-indexer.c	(original)
+++ branches/turtle/src/tracker-indexer/tracker-indexer.c	Mon Dec  1 14:19:18 2008
@@ -1556,11 +1556,13 @@
 		tracker_removable_device_add_move (indexer, 
 						   mount_point, 
 						   path, 
-						   other_path);
+						   other_path,
+						   tracker_service_get_name (service));
 	} else {
 		tracker_removable_device_add_removal (indexer, 
 						      mount_point, 
-						      path);
+						      path,
+						      tracker_service_get_name (service));
 	}
 
 	g_free (mount_point);
@@ -1702,7 +1704,8 @@
 						     NULL)) {
 
 		tracker_removable_device_add_removal (indexer, mount_point, 
-						      service_path);
+						      service_path,
+						      tracker_service_get_name (service));
 	}
 
 	g_free (mount_point);

Modified: branches/turtle/src/tracker-indexer/tracker-removable-device.c
==============================================================================
--- branches/turtle/src/tracker-indexer/tracker-removable-device.c	(original)
+++ branches/turtle/src/tracker-indexer/tracker-removable-device.c	Mon Dec  1 14:19:18 2008
@@ -328,7 +328,7 @@
 } AddMetadataInfo;
 
 static void
-set_metadata (const gchar *key, const gpointer value, gpointer user_data)
+set_metadata (const gchar *key, const gchar *value, gpointer user_data)
 {
 	raptor_statement    *statement;
 	AddMetadataInfo     *item = user_data;
@@ -456,7 +456,8 @@
 void
 tracker_removable_device_add_removal (TrackerIndexer *indexer, 
 				      const gchar *mount_point, 
-				      const gchar *path)
+				      const gchar *path,
+				      const gchar *rdf_type)
 {
 #ifdef HAVE_RAPTOR
 	gchar               *file, *about_uri, *dirname, *muri;
@@ -464,6 +465,7 @@
 	raptor_uri          *suri;
 	raptor_statement    *statement;
 	raptor_serializer   *serializer;
+	AddMetadataInfo     *info;
 
 	file = g_build_filename (mount_point, ".cache", 
 				 "metadata", NULL);
@@ -493,26 +495,15 @@
 	raptor_serialize_start_to_file_handle (serializer, 
 					       suri, target_file);
 
-	statement = g_new0 (raptor_statement, 1);
-
-	statement->subject = (void *) raptor_new_uri (about_uri);
-	statement->subject_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+	info = g_slice_new (AddMetadataInfo);
 
-	statement->predicate = (void *) raptor_new_uri (NULL);
-	statement->predicate_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
-
-	statement->object = (void *) raptor_new_uri (NULL);
-	statement->object_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+	info->serializer = serializer;
+	info->about_uri = about_uri;
 
-	raptor_serialize_statement (serializer, 
-				    statement);
-
-	raptor_free_uri ((raptor_uri *) statement->subject);
-	raptor_free_uri ((raptor_uri *) statement->predicate);
-	g_free ((unsigned char *) statement->object);
-
-	g_free (statement);
+	set_metadata ("rdf:type", rdf_type, info);
+	set_metadata (NULL, NULL, info);
 
+	g_slice_free (AddMetadataInfo, info);
 	g_free (about_uri);
 	raptor_serialize_end (serializer);
 	raptor_free_serializer (serializer);
@@ -527,7 +518,8 @@
 tracker_removable_device_add_move (TrackerIndexer *indexer, 
 				   const gchar *mount_point, 
 				   const gchar *from_path, 
-				   const gchar *to_path)
+				   const gchar *to_path,
+				   const gchar *rdf_type)
 {
 #ifdef HAVE_RAPTOR
 	gchar               *file, *about_uri, *to_uri, *muri;
@@ -535,6 +527,7 @@
 	raptor_uri          *suri;
 	raptor_statement    *statement;
 	raptor_serializer   *serializer;
+	AddMetadataInfo     *info;
 
 	file = g_build_filename (mount_point, ".cache", 
 				 "metadata", NULL);
@@ -570,25 +563,16 @@
 	raptor_serialize_start_to_file_handle (serializer, 
 					       suri, target_file);
 
-	statement = g_new0 (raptor_statement, 1);
-
-	statement->subject = (void *) raptor_new_uri (about_uri);
-	statement->subject_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
-
-	statement->predicate = (void *) raptor_new_uri (NULL);
-	statement->predicate_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+	info = g_slice_new (AddMetadataInfo);
 
-	statement->object = (void *) raptor_new_uri (to_uri);
-	statement->object_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+	info->serializer = serializer;
+	info->about_uri = about_uri;
 
-	raptor_serialize_statement (serializer, 
-				    statement);
+	set_metadata ("rdf:type", rdf_type, info);
+	set_metadata (NULL, to_uri, info);
 
-	raptor_free_uri ((raptor_uri *) statement->subject);
-	raptor_free_uri ((raptor_uri *) statement->predicate);
-	g_free ((unsigned char *) statement->object);
+	g_slice_free (AddMetadataInfo, info);
 
-	g_free (statement);
 
 	g_free (about_uri);
 	g_free (to_uri);

Modified: branches/turtle/src/tracker-indexer/tracker-removable-device.h
==============================================================================
--- branches/turtle/src/tracker-indexer/tracker-removable-device.h	(original)
+++ branches/turtle/src/tracker-indexer/tracker-removable-device.h	Mon Dec  1 14:19:18 2008
@@ -38,11 +38,13 @@
 					       TrackerDataMetadata *metadata);
 void    tracker_removable_device_add_removal  (TrackerIndexer *indexer, 
 					       const gchar *mount_point, 
-					       const gchar *path);
+					       const gchar *path,
+					       const gchar *rdf_type);
 void    tracker_removable_device_add_move     (TrackerIndexer *indexer, 
 					       const gchar *mount_point, 
 					       const gchar *from_path, 
-					       const gchar *to_path);
+					       const gchar *to_path,
+					       const gchar *rdf_type);
 
 
 #endif /* __TRACKER_REMOVABLE_DEVICE_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]