tracker r2561 - branches/turtle/src/libtracker-data



Author: pvanhoof
Date: Tue Nov 25 13:30:09 2008
New Revision: 2561
URL: http://svn.gnome.org/viewvc/tracker?rev=2561&view=rev

Log:
Fixing writing a turtle file

Modified:
   branches/turtle/src/libtracker-data/tracker-turtle.c

Modified: branches/turtle/src/libtracker-data/tracker-turtle.c
==============================================================================
--- branches/turtle/src/libtracker-data/tracker-turtle.c	(original)
+++ branches/turtle/src/libtracker-data/tracker-turtle.c	Tue Nov 25 13:30:09 2008
@@ -213,14 +213,15 @@
 	if (!turtle->file) 
 		turtle->file = fopen (turtle_file, "w");
 
+	/*
 	turtle->serializer = raptor_new_serializer ("turtle");
-
 	uri_string = raptor_uri_filename_to_uri_string (turtle_file);
 	turtle->uri = raptor_new_uri (uri_string);
 	raptor_serialize_start_to_file_handle (turtle->serializer, 
-					       turtle->uri, turtle->file);
+					       NULL, turtle->file);
+
+	g_free (uri_string);*/
 
-	g_free (uri_string);
 	return turtle;
 #else 
 	return NULL;
@@ -235,20 +236,38 @@
 			   const gchar  *value)
 {
 #ifdef HAVE_RAPTOR
-	gchar            *about_uri;
-	raptor_statement  statement;
+
+	gchar            *about_uri = NULL;
+
+	/* raptor_statement  statement;
 
 	if (g_str_has_prefix (uri, "file://")) {
 		about_uri = g_strdup_printf ("<%s>", uri);
 	} else {
 		about_uri = g_strdup_printf ("<file://%s>", uri);
+	} */
+
+	if (!g_str_has_prefix (uri, "file://")) {
+		about_uri = g_strdup_printf ("file://%s", uri);
 	}
 
-	g_debug ("turtle <%s, %s, %s>",
-		 about_uri,
+	g_debug ("in ttl: <%s> <%s> %s%s%s ;\n",
+		 about_uri?about_uri:uri,
 		 tracker_field_get_name (property),
-		 value);
+		 value?"\"":"<",
+		 value?value:":",
+		 value?"\"":">");
+
+	fprintf (turtle->file, "<%s> <%s> %s%s%s ;\n",
+		 about_uri?about_uri:uri,
+		 tracker_field_get_name (property),
+		 value?"\"":"<",
+		 value?value:":",
+		 value?"\"":">");
+
+	g_free (about_uri);
 
+	/*
 	statement.subject = about_uri;
 	statement.subject_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
 	statement.predicate = tracker_field_get_name (property);
@@ -260,6 +279,7 @@
 				    &statement);
 
 	g_free (about_uri);
+	*/
 
 #endif
 }
@@ -269,11 +289,11 @@
 tracker_turtle_close (TurtleFile *turtle)
 {
 #ifdef HAVE_RAPTOR
-	raptor_free_uri (turtle->uri);
+	/*raptor_free_uri (turtle->uri);
 	raptor_serialize_end (turtle->serializer);
-	raptor_free_serializer(turtle->serializer);
+	raptor_free_serializer(turtle->serializer);*/
 	fclose (turtle->file);
-	raptor_finish ();
+	/*raptor_finish ();*/
 	g_free (turtle);
 #endif
 }



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