Author: lgiessmann Date: Wed Aug 17 02:49:33 2011 New Revision: 743
Log: trunk: xtm-exporter: fixed a bug that occurs when exporting empty stopres
Modified: trunk/src/rest_interface/admin-interface.lisp trunk/src/xml/xtm/exporter.lisp
Modified: trunk/src/rest_interface/admin-interface.lisp ============================================================================== --- trunk/src/rest_interface/admin-interface.lisp Wed Aug 17 02:10:46 2011 (r742) +++ trunk/src/rest_interface/admin-interface.lisp Wed Aug 17 02:49:33 2011 (r743) @@ -38,7 +38,6 @@ (when elephant:*store-controller* (xtm-exporter:export-as-xtm (concat "backup_" (make-date-string (get-universal-time)) ".xtm") - :tm-id "http://isidor.us/backup-tm" :revision 0)) (shutdown-json-engine) (shutdown-atom-engine)
Modified: trunk/src/xml/xtm/exporter.lisp ============================================================================== --- trunk/src/xml/xtm/exporter.lisp Wed Aug 17 02:10:46 2011 (r742) +++ trunk/src/xml/xtm/exporter.lisp Wed Aug 17 02:49:33 2011 (r743) @@ -14,30 +14,42 @@ "gets all instances of AssociationC - which does not realize an instanceOf relationship in the db" (let ((instance-topic - (identified-construct - (elephant:get-instance-by-value 'PersistentIdC 'uri *instance-psi*))) + (get-item-by-psi *instance-psi* :revision 0)) (type-topic - (identified-construct - (elephant:get-instance-by-value 'PersistentIdC 'uri *type-psi*)))) - (loop for item in (d:get-all-associations revision) - when (and (= (length (roles item :revision revision)) 2) - (not (and (or (eq instance-topic - (instance-of (first (roles item - :revision revision)) - :revision revision)) - (eq instance-topic - (instance-of (second (roles item - :revision revision)) - :revision revision))) - (or (eq type-topic - (instance-of (first (roles item - :revision revision)) - :revision revision)) - (eq type-topic - (instance-of (second (roles item - :revision revision)) - :revision revision)))))) - collect item))) + (get-item-by-psi *type-psi* :revision 0))) + (cond ((and (not (and instance-topic type-topic)) + (elephant:get-instances-by-class 'TopicMapC)) + (error (make-condition + 'missing-reference-error + :message + (format nil "Could not resolvethe topics: ~a and ~a~%" + *instance-psi* *type-psi*)))) + ((not (and instance-topic type-topic)) + nil) + (t + (loop for item in (d:get-all-associations revision) + when (and + (= (length (roles item :revision revision)) 2) + (not + (and + (or + (eq instance-topic + (instance-of (first (roles item + :revision revision)) + :revision revision)) + (eq instance-topic + (instance-of (second (roles item + :revision revision)) + :revision revision))) + (or (eq type-topic + (instance-of (first (roles item + :revision revision)) + :revision revision)) + (eq type-topic + (instance-of (second (roles item + :revision revision)) + :revision revision)))))) + collect item)))))
(defmacro with-xtm2.0 ((tm revision) &body body)