Author: lgiessmann Date: Mon Aug 3 15:00:53 2009 New Revision: 104
Log: fixed a bug in the rdf-importer module which affects reification of arcs contains literal content
Modified: trunk/src/unit_tests/rdf_importer_test.lisp trunk/src/xml/rdf/importer.lisp
Modified: trunk/src/unit_tests/rdf_importer_test.lisp ============================================================================== --- trunk/src/unit_tests/rdf_importer_test.lisp (original) +++ trunk/src/unit_tests/rdf_importer_test.lisp Mon Aug 3 15:00:53 2009 @@ -1203,8 +1203,45 @@
(test test-import-node-reification - - ) + "Tests the function import-node non-recursively. Especially the reification + of association- and occurrence-arcs." + (let ((db-dir "data_base") + (tm-id "http://test-tm/") + (revision-1 100) + (document-id "doc-id") + (doc-1 + (concatenate 'string "<rdf:RDF xmlns:rdf="" *rdf-ns* "" " + "xmlns:arcs="http://test/arcs/%5C" " + "xmlns:rdfs="" *rdfs-ns* "">" + "<rdf:Description rdf:about="first-node">" + "<arcs:arc1 rdf:ID="reification-1">" + "<rdf:Description rdf:about="second-node" />" + "</arcs:arc1>" + "</rdf:Description>" + "<rdf:Description rdf:ID="#reification-1">" + "<arcs:arc2 rdf:resource="third-node"/>" + "</rdf:Description>" + "<rdf:Description rdf:nodeID="fourth-node">" + "<arcs:arc3 rdf:ID="reification-2" rdf:datatype="dt">" + "occurrence data" + "</arcs:arc3>" + "</rdf:Description>" + "<rdf:Description rdf:ID="#reification-2">" + "<arcs:arc4 rdf:resource="fifth-node" />" + "</rdf:Description>" + "</rdf:RDF>"))) + (let ((dom-1 (cxml:parse doc-1 (cxml-dom:make-dom-builder)))) + (is-true dom-1) + (is (= (length (dom:child-nodes dom-1)) 1)) + (let ((rdf-node (elt (dom:child-nodes dom-1) 0))) + (is (= (length (dom:child-nodes rdf-node)) 4)) + (rdf-init-db :db-dir db-dir :start-revision revision-1) + (dotimes (iter (length (dom:child-nodes rdf-node))) + (rdf-importer::import-node (elt (dom:child-nodes rdf-node) iter) + tm-id revision-1 + :document-id document-id)) + + ))))
Modified: trunk/src/xml/rdf/importer.lisp ============================================================================== --- trunk/src/xml/rdf/importer.lisp (original) +++ trunk/src/xml/rdf/importer.lisp Mon Aug 3 15:00:53 2009 @@ -315,7 +315,7 @@ (list :instance-of role-type-2 :player top)))) (when ID - (make-reification ID top type-top player-1 start-revision + (make-reification ID top player-1 type-top start-revision tm :document-id document-id)) (add-to-topicmap tm (make-construct 'AssociationC :start-revision start-revision @@ -348,6 +348,7 @@ (declare ((or OccurrenceC TopicC) object)) (declare (TopicC subject predicate)) (declare (TopicMapC tm)) + (let ((reifier (make-topic-stub reifier-id nil nil nil start-revision tm :document-id document-id)) (predicate-arc (make-topic-stub *rdf-predicate* nil nil nil start-revision @@ -365,10 +366,10 @@ start-revision) (make-association-with-nodes reifier predicate predicate-arc tm start-revision) - (if (typep object 'TopicC) + (if (typep object 'd:TopicC) (make-association-with-nodes reifier object object-arc tm start-revision) - (make-construct 'OccurrenceC + (make-construct 'd:OccurrenceC :start-revision start-revision :topic reifier :themes (themes object) @@ -406,7 +407,7 @@ :charvalue value :datatype datatype))) (when ID - (make-reification ID top type-top occurrence start-revision + (make-reification ID top occurrence type-top start-revision xml-importer::tm :document-id document-id)) occurrence))))))