[isidorus-cvs] r163 - in trunk/src: unit_tests xml/rdf

Lukas Giessmann lgiessmann at common-lisp.net
Sun Dec 6 19:45:24 UTC 2009


Author: lgiessmann
Date: Sun Dec  6 14:45:23 2009
New Revision: 163

Log:
fixed some addressing-problems by exporting reifier-topics

Modified:
   trunk/src/unit_tests/reification_test.lisp
   trunk/src/xml/rdf/exporter.lisp

Modified: trunk/src/unit_tests/reification_test.lisp
==============================================================================
--- trunk/src/unit_tests/reification_test.lisp	(original)
+++ trunk/src/unit_tests/reification_test.lisp	Sun Dec  6 14:45:23 2009
@@ -40,7 +40,8 @@
    :test-rdf-importer-reification
    :test-rdf-importer-reification-2
    :test-rdf-importer-reification-3
-   :test-rdf-importer-reification-4))
+   :test-rdf-importer-reification-4
+   :test-rdf-reification-exporter))
 
 
 (in-package :reification-test)
@@ -521,6 +522,8 @@
 			      when (string= (dom:get-attribute ii "href") "http://simpsons.tv/married-husband-role")
 			      return t)
 		      return t)))))
+    (handler-case (delete-file output-file)
+      (error () )) ;do nothing
     (elephant:close-store)))
 
 
@@ -738,6 +741,27 @@
   (elephant:close-store))
 
 
+(test test-rdf-reification-exporter
+  "Tests the reification in the rdf-exporter."
+  (let
+      ((dir "data_base")
+       (output-file "__out__.rdf")
+       (tm-id "http://simpsons.tv"))
+    (handler-case (delete-file output-file)
+      (error () )) ;do nothing
+    (rdf-importer:rdf-importer *reification.rdf*
+       :tm-id tm-id
+       :document-id "reification-xtm")
+      (rdf-exporter:export-rdf output-file :tm-id tm-id)
+      (let ((document
+	     (dom:document-element
+	      (cxml:parse-file output-file (cxml-dom:make-dom-builder)))))
+	))
+  (handler-case (delete-file output-file)
+    (error () )) ;do nothing
+  (elephant:close-store))
+
+
 
 ;;TODO: check rdf exporter
 ;;TODO: check merge-reifier-topics (--> versioning)
@@ -756,4 +780,5 @@
   (it.bese.fiveam:run! 'test-rdf-importer-reification)
   (it.bese.fiveam:run! 'test-rdf-importer-reification-2)
   (it.bese.fiveam:run! 'test-rdf-importer-reification-3)
-  (it.bese.fiveam:run! 'test-rdf-importer-reification-4))
\ No newline at end of file
+  (it.bese.fiveam:run! 'test-rdf-importer-reification-4)
+  (it.bese.fiveam:run! 'test-rdf-reification-exporter))
\ No newline at end of file

Modified: trunk/src/xml/rdf/exporter.lisp
==============================================================================
--- trunk/src/xml/rdf/exporter.lisp	(original)
+++ trunk/src/xml/rdf/exporter.lisp	Sun Dec  6 14:45:23 2009
@@ -214,10 +214,12 @@
   (declare (TopicC topic))
   (if (psis topic)
       (cxml:attribute "rdf:resource"
-		      (let ((psi (get-reifier-psi topic)))
-			(if psi
-			    (concatenate 'string "#" (get-reifier-uri topic))
-			    (uri (first (psis topic))))))
+		      (if (reified topic)
+			  (let ((psi (get-reifier-psi topic)))
+			    (if psi
+				(concatenate 'string "#" (get-reifier-uri topic))
+				(uri (first (psis topic)))))
+			  (uri (first (psis topic)))))
       (cxml:attribute "rdf:nodeID" (make-object-id topic))))
 
 
@@ -351,8 +353,7 @@
 		    (occurrences construct)))
 	   (or (used-as-type construct)
 	       (used-as-theme construct)
-	       (xml-lang-p construct)
-	       (reified construct)))
+	       (xml-lang-p construct)))
       nil ;; do not export this topic explicitly, since it has been exported as
           ;; rdf:resource, property or any other reference
       (cxml:with-element "rdf:Description"
@@ -366,7 +367,7 @@
 	      (if (reified construct)
 		  (let ((reifier-uri (get-reifier-uri construct)))
 		    (if reifier-uri
-			(concatenate 'string "#" (get-reifier-uri construct))
+			(cxml:attribute "rdf:about" (concatenate 'string "#" (get-reifier-uri construct)))
 			(cxml:attribute "rdf:about" (uri psi))))
 		  (cxml:attribute "rdf:about" (uri psi)))
 	      (cxml:attribute "rdf:nodeID" (make-object-id construct)))
@@ -553,7 +554,7 @@
 	       (psis reifier-topic))
       (let ((reifier-uri (get-reifier-uri reifier-topic)))
 	(when reifier-uri
-	  (cxml:with-element *tm2rdf-reifier-property*
+	  (cxml:with-element "isi:reifier"
 	    (cxml:attribute "rdf:resource" reifier-uri)))))))
 
 
@@ -567,11 +568,11 @@
 	     (when reifier-psi
 	       (uri reifier-psi))))
 	  (err "From get-reifier-uri(): "))
-      (let ((slash-position (find #\/ full-uri :from-end t)))
+      (let ((slash-position (position #\/ full-uri :from-end t)))
 	(let ((hash-position (position #\# full-uri)))
 	  (if (and hash-position
 		   (/= (- (length full-uri) 1) hash-position))
-	      (subseq full-uri (- hash-position 1))
+	      (subseq full-uri (+ hash-position 1))
 	      (if (and slash-position
 		       (/= (- (length full-uri) 1) slash-position))
 		  (subseq full-uri (+ 1 slash-position))




More information about the Isidorus-cvs mailing list