[redland-dev] [patch] rss-1.0 serializer

Shin-ichi Hirata hiratch at hiratch.net
Fri Jul 14 12:13:25 BST 2006


Hi.

In current Raptor, RAPTOR_IDENTIFIER_TYPE_ORDINAL is deprecated, right?

I wrote patch for raptor_serialize_rss.c .
Or should I post a bug report?

And I'm writing Gauche binding of Redland.
http://hiratch.net/archive/Gauche-Redland-0.2.tgz

(Gauche is a Scheme implementation by Shiro Kawai.
See http://practical-scheme.net/)

---
Shin-ichi Hirata (hiratch at hiratch.net)
-------------- next part --------------
--- raptor-svn20060710.orig/src/raptor_serialize_rss.c
+++ raptor-svn20060710/src/raptor_serialize_rss.c
@@ -496,6 +496,7 @@
 {
   raptor_rss_model* rss_model=&rss_serializer->model;
   int i;
+  const char *uri_str;
 
   if(!rss_serializer->seq_uri)
     return;
@@ -505,14 +506,14 @@
     if(!s)
       continue;
 
-    if(raptor_uri_equals((raptor_uri*)s->subject, rss_serializer->seq_uri) &&
-       s->predicate_type == RAPTOR_IDENTIFIER_TYPE_ORDINAL) {
-      int* p=(int*)s->predicate;
+    uri_str = (const char*)raptor_uri_as_string((raptor_uri*)s->predicate);
+    if(!strncmp(uri_str, "http://www.w3.org/1999/02/22-rdf-syntax-ns#_", 44)) {
+      int ordinal = raptor_check_ordinal(uri_str+44);
 
-      RAPTOR_DEBUG3("Found RSS 1.0 item %d with URI <%s>\n", *p,
+      RAPTOR_DEBUG3("Found RSS 1.0 item %d with URI <%s>\n", ordinal,
                     raptor_uri_as_string((raptor_uri*)s->object));
 
-      if(*p > 0) {
+      if(ordinal >= 0) {
         raptor_rss_item* item=(raptor_rss_item*)RAPTOR_CALLOC(raptor_rss_item, 1, sizeof(raptor_rss_item));
         raptor_identifier* identifier=&item->identifier;
 
@@ -522,7 +523,7 @@
         identifier->type=RAPTOR_IDENTIFIER_TYPE_RESOURCE;
         identifier->uri_source=RAPTOR_URI_SOURCE_URI;
 
-        raptor_sequence_set_at(rss_serializer->items, (*p)-1, item);
+        raptor_sequence_set_at(rss_serializer->items, ordinal-1, item);
 
         raptor_sequence_set_at(rss_serializer->triples, i, NULL);
 


More information about the redland-dev mailing list