[isidorus-cvs] r9 - in trunk/src: atom model rest_interface

Christoph Ludwig cludwig at common-lisp.net
Sat Jan 31 22:14:18 UTC 2009


Author: cludwig
Date: Sat Jan 31 22:14:17 2009
New Revision: 9

Log:
intermediate stage; need to create feed clients for import

Modified:
   trunk/src/atom/atom.lisp
   trunk/src/atom/read.lisp
   trunk/src/model/changes.lisp
   trunk/src/rest_interface/read.lisp

Modified: trunk/src/atom/atom.lisp
==============================================================================
--- trunk/src/atom/atom.lisp	(original)
+++ trunk/src/atom/atom.lisp	Sat Jan 31 22:14:17 2009
@@ -129,7 +129,9 @@
   (:documentation "Register an entry for a given feed"))
 
 (defmethod register-entry ((feed feed) (entry entry))
-  (push entry (entries feed)))
+  (format t "feed: ~s; entry: ~s" feed entry)
+  (push entry (slot-value feed 'entries))
+  (format t "entries of ~s: ~s" feed (slot-value feed 'entries)))
 
 (defgeneric register-subfeed (feed subfeed)
   (:documentation "Register a subfeed for a given feed"))

Modified: trunk/src/atom/read.lisp
==============================================================================
--- trunk/src/atom/read.lisp	(original)
+++ trunk/src/atom/read.lisp	Sat Jan 31 22:14:17 2009
@@ -1,15 +1,15 @@
 (in-package :atom)
 
-(defmacro parse-feed ((fragment-feed-string) &body make-entry)
+(defmacro parse-feed ((feed-string feed-type) &body make-entry)
   "a convenience macro that captures key parsing elements for
 feeds. As body it takes the action to be performed on each entry in
 the feed (usually a register-entry statement)"
   `(let*
       ((feed-dom
         (dom:document-element
-         (cxml:parse-rod ,fragment-feed-string (cxml-dom:make-dom-builder))))
+         (cxml:parse-rod ,feed-string (cxml-dom:make-dom-builder))))
        (feed 
-        (make-instance 'fragments-feed 
+        (make-instance ,feed-type 
                        :id  (xpath-fn-string 
                                         (xpath-single-child-elem-by-qname
                                           feed-dom
@@ -36,7 +36,7 @@
 
 
 (defun parse-fragments-feed (fragment-feed-string)
-  (parse-feed (fragment-feed-string)
+  (parse-feed (fragment-feed-string 'fragments-feed)
     (register-entry 
      feed 
      (make-instance 'fragment-entry
@@ -51,7 +51,7 @@
                      (xpath-single-child-elem-by-qname entry-elem *egovpt-ns* "TopicSI"))))))
 
 (defun parse-snapshots-feed (fragment-feed-string)
-  (parse-feed (fragment-feed-string)
+  (parse-feed (fragment-feed-string 'snapshots-feed)
     (register-entry 
      feed 
      (make-instance 'snapshot-entry

Modified: trunk/src/model/changes.lisp
==============================================================================
--- trunk/src/model/changes.lisp	(original)
+++ trunk/src/model/changes.lisp	Sat Jan 31 22:14:17 2009
@@ -18,7 +18,7 @@
 engine for this Topic Map"
   (let*
       ((tm (get-item-by-item-identifier tm-id :revision 0))
-       (tops-and-assocs (union (topics tm) (associations tm)))
+       (tops-and-assocs (when tm (union (topics tm) (associations tm))))
        (revision-set nil))
     ;(format t "tops-and-assocs: ~a~&" (mapcan #'versions tops-and-assocs))
     (dolist (vi (mapcan #'versions tops-and-assocs))

Modified: trunk/src/rest_interface/read.lisp
==============================================================================
--- trunk/src/rest_interface/read.lisp	(original)
+++ trunk/src/rest_interface/read.lisp	Sat Jan 31 22:14:17 2009
@@ -90,10 +90,12 @@
  (let
       ((feed (read-snapshots-feed snapshot-feed-url))
        (revision (get-revision)))
+   (format t "~s" (string-max (mapcar #'atom:updated (atom:entries feed))))
    (let*
-       ((entry 
+       ((most-recent-update (string-max (mapcar #'atom:updated (atom:entries feed))))
+	(entry 
 	 (find
-	  (string-max (mapcar #'atom:updated (atom:entries feed)))
+	  most-recent-update
 	  (atom:entries feed) :key #'updated :test #'string=))
         (xtm-id (id entry)))
      ;;that *should* be the algorithm...




More information about the Isidorus-cvs mailing list