Changeset 103
- Timestamp:
- 08/03/09 17:08:11 (16 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/unit_tests/rdf_importer_test.lisp ¶
r100 r103 20 20 *rdf2tm-ns* 21 21 *xml-ns* 22 *xml-string*) 22 *xml-string* 23 *instance-psi* 24 *type-psi* 25 *type-instance-psi* 26 *subtype-psi* 27 *supertype-psi* 28 *supertype-subtype-psi* 29 *xml-string* 30 *rdf2tm-object* 31 *rdf2tm-subject* 32 *rdf-subject* 33 *rdf-object* 34 *rdf-predicate*) 23 35 (:import-from :xml-tools 24 36 xpath-child-elems-by-qname … … 37 49 :test-get-super-classes-of-node-content 38 50 :test-get-associations-of-node-content 39 :test-parse-properties-of-node)) 51 :test-parse-properties-of-node 52 :test-import-node-1 53 :test-import-node-reification)) 40 54 41 55 (declaim (optimize (debug 3) (speed 0) (safety 3) (space 0) (compilation-speed 0))) … … 48 62 49 63 (in-suite rdf-importer-test) 64 65 66 (defun rdf-init-db (&key (db-dir "data_base") (start-revision (get-revision))) 67 "Empties the data base files and initializes isidorus for rdf." 68 (when elephant:*store-controller* 69 (elephant:close-store)) 70 (clean-out-db db-dir) 71 (elephant:open-store (xml-importer:get-store-spec db-dir)) 72 (xml-importer:init-isidorus start-revision) 73 (rdf-importer:init-rdf-module start-revision)) 50 74 51 75 … … 968 992 (is (= (length rdf-importer::*_n-map*) 0)))))) 969 993 994 995 (test test-import-node-1 996 "Tests the function import-node non-recursively." 997 (let ((db-dir "data_base") 998 (tm-id "http://test-tm/") 999 (revision-1 100) 1000 (revision-2 200) 1001 (revision-3 300) 1002 (document-id "doc-id") 1003 (doc-1 1004 (concatenate 'string "<rdf:RDF xmlns:rdf=\"" *rdf-ns* "\" " 1005 "xmlns:arcs=\"http://test/arcs/\" " 1006 "xmlns:rdfs=\"" *rdfs-ns* "\">" 1007 "<rdf:Description rdf:about=\"first-node\">" 1008 "<rdf:type rdf:resource=\"first-type\" />" 1009 "</rdf:Description>" 1010 "<rdf:Description rdf:type=\"second-type\" " 1011 "rdf:nodeID=\"second-node\">" 1012 "<rdfs:subClassOf>" 1013 "<rdf:Description rdf:ID=\"third-node\" />" 1014 "</rdfs:subClassOf>" 1015 "</rdf:Description>" 1016 "<rdf:Description arcs:arc1=\"arc-1\">" 1017 "<arcs:arc2 rdf:datatype=\"dt\">arc-2</arcs:arc2>" 1018 "</rdf:Description>" 1019 "<rdf:Description rdf:about=\"fourth-node\">" 1020 "<arcs:arc3 rdf:parseType=\"Literal\"><root>" 1021 "<content type=\"anyContent\">content</content>" 1022 "</root></arcs:arc3>" 1023 "</rdf:Description>" 1024 "<rdf:Description rdf:ID=\"fifth-node\">" 1025 "<arcs:arc4 rdf:parseType=\"Resource\">" 1026 "<arcs:arc5 rdf:resource=\"arc-5\" />" 1027 "</arcs:arc4>" 1028 "</rdf:Description>" 1029 "</rdf:RDF>"))) 1030 (let ((dom-1 (cxml:parse doc-1 (cxml-dom:make-dom-builder)))) 1031 (is-true dom-1) 1032 (is (= (length (dom:child-nodes dom-1)) 1)) 1033 (let ((rdf-node (elt (dom:child-nodes dom-1) 0))) 1034 (is (= (length (dom:child-nodes rdf-node)) 5)) 1035 (let ((node (elt (dom:child-nodes rdf-node) 0))) 1036 (rdf-init-db :db-dir db-dir :start-revision revision-1) 1037 (rdf-importer::import-node node tm-id revision-2 1038 :document-id document-id) 1039 (is (= (length (elephant:get-instances-by-class 'd:TopicC)) 20)) 1040 (let ((first-node (get-item-by-id "http://test-tm/first-node" 1041 :xtm-id document-id)) 1042 (first-type (get-item-by-id "http://test-tm/first-type" 1043 :xtm-id document-id))) 1044 (is-true first-node) 1045 (is (= (length (d::versions first-node)) 1)) 1046 (is (= (d::start-revision (first (d::versions first-node))) 1047 revision-2)) 1048 (is (= (d::end-revision (first (d::versions first-node))) 0)) 1049 (is-true first-type) 1050 (is (= (length (d:player-in-roles first-node)) 1)) 1051 (is (= (length (d:player-in-roles first-type)) 1)) 1052 (let ((instance-role 1053 (first (d:player-in-roles first-node))) 1054 (type-role 1055 (first (d:player-in-roles first-type))) 1056 (type-assoc 1057 (d:parent (first (d:player-in-roles first-node))))) 1058 (is (= (length (d::versions type-assoc)) 1)) 1059 (is (= (d::start-revision (first (d::versions type-assoc))) 1060 revision-2)) 1061 (is (eql (d:instance-of instance-role) 1062 (d:get-item-by-psi *instance-psi*))) 1063 (is (eql (d:instance-of type-role) 1064 (d:get-item-by-psi *type-psi*))) 1065 (is (eql (d:instance-of type-assoc) 1066 (d:get-item-by-psi *type-instance-psi*))) 1067 (is (= (length (d:roles type-assoc)) 2)) 1068 (is (= (length (d:psis first-node)) 1)) 1069 (is (= (length (d:psis first-type)) 1)) 1070 (is (string= (d:uri (first (d:psis first-node))) 1071 "http://test-tm/first-node")) 1072 (is (string= (d:uri (first (d:psis first-type))) 1073 "http://test-tm/first-type")) 1074 (is (= (length (elephant:get-instances-by-class 'd:OccurrenceC)))) 1075 (is (= (length (elephant:get-instances-by-class 'd:NameC)))) 1076 (is (= (length (elephant:get-instances-by-class 'd:VariantC))))) 1077 (dotimes (iter (length (dom:child-nodes rdf-node))) 1078 (rdf-importer::import-node (elt (dom:child-nodes rdf-node) iter) 1079 tm-id revision-3 1080 :document-id document-id)) 1081 (let ((first-node (get-item-by-id "http://test-tm/first-node" 1082 :xtm-id document-id)) 1083 (first-type (get-item-by-id "http://test-tm/first-type" 1084 :xtm-id document-id)) 1085 (second-node (get-item-by-id "second-node" 1086 :xtm-id document-id)) 1087 (second-type (get-item-by-id "http://test-tm/second-type" 1088 :xtm-id document-id)) 1089 (third-node (get-item-by-id "http://test-tm#third-node" 1090 :xtm-id document-id))) 1091 (is-true second-node) 1092 (is-false (d:psis second-node)) 1093 (is-false (d:occurrences second-node)) 1094 (is-false (d:names second-node)) 1095 (is-true first-node) 1096 (is (= (length (d::versions first-node)) 2)) 1097 (is-true (find-if #'(lambda(x) 1098 (and (= (d::start-revision x) revision-2) 1099 (= (d::end-revision x) revision-3))) 1100 (d::versions first-node))) 1101 (is-true (find-if #'(lambda(x) 1102 (and (= (d::start-revision x) revision-3) 1103 (= (d::end-revision x) 0))) 1104 (d::versions first-node))) 1105 (let ((instance-role 1106 (first (d:player-in-roles first-node))) 1107 (type-role 1108 (first (d:player-in-roles first-type))) 1109 (type-assoc 1110 (d:parent (first (d:player-in-roles first-node)))) 1111 (type-topic (get-item-by-psi *type-psi*)) 1112 (instance-topic (get-item-by-psi *instance-psi*)) 1113 (type-instance-topic (get-item-by-psi *type-instance-psi*)) 1114 (supertype-topic (get-item-by-psi *supertype-psi*)) 1115 (subtype-topic (get-item-by-psi *subtype-psi*)) 1116 (supertype-subtype-topic 1117 (get-item-by-psi *supertype-subtype-psi*)) 1118 (arc2-occurrence (elephant:get-instance-by-value 1119 'd:OccurrenceC 'd:charvalue "arc-2")) 1120 (arc3-occurrence 1121 (elephant:get-instance-by-value 1122 'd:OccurrenceC 'd:charvalue 1123 "<root><content type=\"anyContent\">content</content></root>")) 1124 (fifth-node (d:get-item-by-id "http://test-tm#fifth-node" 1125 :xtm-id document-id))) 1126 (is (eql (d:instance-of instance-role) 1127 (d:get-item-by-psi *instance-psi*))) 1128 (is (eql (d:instance-of type-role) 1129 (d:get-item-by-psi *type-psi*))) 1130 (is (eql (d:instance-of type-assoc) 1131 (d:get-item-by-psi *type-instance-psi*))) 1132 (is (= (length (d:roles type-assoc)) 2)) 1133 (is (= (length (d:psis first-node)) 1)) 1134 (is (= (length (d:psis first-type)) 1)) 1135 (is (= (length (d::versions type-assoc)) 1)) 1136 (is (= (length (d:player-in-roles second-node)) 2)) 1137 (is-true (find-if 1138 #'(lambda(x) 1139 (and (eql (d:instance-of x) instance-topic) 1140 (eql (d:instance-of (d:parent x) ) 1141 type-instance-topic))) 1142 (d:player-in-roles second-node))) 1143 (is-true (find-if 1144 #'(lambda(x) 1145 (and (eql (d:instance-of x) subtype-topic) 1146 (eql (d:instance-of (d:parent x) ) 1147 supertype-subtype-topic))) 1148 (d:player-in-roles second-node))) 1149 (is-true (find-if 1150 #'(lambda(x) 1151 (and (eql (d:instance-of x) type-topic) 1152 (eql (d:instance-of (d:parent x) ) 1153 type-instance-topic))) 1154 (d:player-in-roles second-type))) 1155 (is-true (find-if 1156 #'(lambda(x) 1157 (and (eql (d:instance-of x) supertype-topic) 1158 (eql (d:instance-of (d:parent x) ) 1159 supertype-subtype-topic))) 1160 (d:player-in-roles third-node))) 1161 (is-true arc2-occurrence) 1162 (is (string= (d:datatype arc2-occurrence) "http://test-tm/dt")) 1163 (is-false (d:psis (d:topic arc2-occurrence))) 1164 (is (= (length (d::versions (d:topic arc2-occurrence))) 1)) 1165 (is (= (d::start-revision 1166 (first (d::versions (d:topic arc2-occurrence)))) 1167 revision-3)) 1168 (is (= (d::end-revision 1169 (first (d::versions (d:topic arc2-occurrence)))) 0)) 1170 (is-true arc3-occurrence) 1171 (is (= (length (d:psis (d:topic arc3-occurrence))))) 1172 (is (string= (d:uri (first (d:psis (d:topic arc3-occurrence)))) 1173 "http://test-tm/fourth-node")) 1174 (is (string= (d:datatype arc3-occurrence) 1175 *xml-string*)) 1176 (is-true fifth-node) 1177 (is (= (length (d:psis fifth-node)) 1)) 1178 (is (string= (d:uri (first (d:psis fifth-node))) 1179 "http://test-tm#fifth-node")) 1180 (is-false (d:occurrences fifth-node)) 1181 (is-false (d:names fifth-node)) 1182 (is (= (length (d:player-in-roles fifth-node)))) 1183 (let ((assoc (d:parent (first (d:player-in-roles 1184 fifth-node))))) 1185 (is-true assoc) 1186 (let ((object-role 1187 (find-if 1188 #'(lambda(role) 1189 (eql (d:instance-of role) 1190 (d:get-item-by-psi *rdf2tm-object*))) 1191 (d:roles assoc))) 1192 (subject-role 1193 (find-if 1194 #'(lambda(role) 1195 (eql (d:instance-of role) 1196 (d:get-item-by-psi *rdf2tm-subject*))) 1197 (d:roles assoc)))) 1198 (is-true object-role) 1199 (is-true subject-role) 1200 (is (eql (d:player subject-role) fifth-node)) 1201 (is-false (d:psis (d:player object-role)))))))))))) 1202 (elephant:close-store)) 1203 970 1204 1205 (test test-import-node-reification 1206 1207 ) 1208 971 1209 972 1210 … … 980 1218 (it.bese.fiveam:run! 'test-get-super-classes-of-node-content) 981 1219 (it.bese.fiveam:run! 'test-get-associations-of-node-content) 982 (it.bese.fiveam:run! 'test-parse-properties-of-node)) 1220 (it.bese.fiveam:run! 'test-parse-properties-of-node) 1221 (it.bese.fiveam:run! 'test-import-node-1) 1222 (it.bese.fiveam:run! 'test-import-node-reification)) -
TabularUnified trunk/src/xml/rdf/importer.lisp ¶
r102 r103 9 9 10 10 11 (defvar *document-id* nil)11 (defvar *document-id* "isidorus-rdf-document") 12 12 13 13 … … 38 38 (setf *document-id* document-id) 39 39 (tm-id-p tm-id "rdf-importer") 40 (unless elephant:*store-controller* 41 (elephant:open-store 42 (get-store-spec repository-path))) 43 (let ((rdf-dom 44 (dom:document-element (cxml:parse-file 45 (truename rdf-xml-path) 46 (cxml-dom:make-dom-builder))))) 47 (import-dom rdf-dom start-revision :tm-id tm-id :document-id document-id)) 48 (setf *_n-map* nil)) 40 (with-writer-lock 41 (unless elephant:*store-controller* 42 (elephant:open-store 43 (get-store-spec repository-path))) 44 (let ((rdf-dom 45 (dom:document-element (cxml:parse-file 46 (truename rdf-xml-path) 47 (cxml-dom:make-dom-builder))))) 48 (import-dom rdf-dom start-revision :tm-id tm-id :document-id document-id)) 49 (setf *_n-map* nil))) 49 50 50 51 … … 109 110 xml-base xml-lang))) 110 111 (associations (get-associations-of-node-content elem tm-id xml-base)) 111 (types (append (list 112 (list :topicid (get-type-of-node-name elem) 113 :psi (get-type-of-node-name elem) 114 :ID nil)) 115 (get-types-of-node-content elem tm-id fn-xml-base))) 112 (types (remove-if 113 #'null 114 (append (list 115 (unless (string= (get-type-of-node-name elem) 116 (concatenate 'string *rdf-ns* 117 "Description")) 118 (list :topicid (get-type-of-node-name elem) 119 :psi (get-type-of-node-name elem) 120 :ID nil))) 121 (get-types-of-node-content elem tm-id fn-xml-base)))) 116 122 (super-classes 117 123 (get-super-classes-of-node-content elem tm-id xml-base))) 118 124 (with-tm (start-revision document-id tm-id) 119 (let ((topic-stub 120 (make-topic-stub 121 about ID nodeID UUID start-revision xml-importer::tm 122 :document-id document-id))) 123 (map 'list #'(lambda(literal) 124 (make-occurrence topic-stub literal start-revision 125 tm-id :document-id document-id)) 126 literals) 127 (map 'list #'(lambda(assoc) 128 (make-association topic-stub assoc xml-importer::tm 129 start-revision 130 :document-id document-id)) 131 associations) 132 (map 'list 133 #'(lambda(type) 134 (let ((type-topic 135 (make-topic-stub (getf type :psi) 136 (getf type :topicid) 137 nil nil start-revision 138 xml-importer::tm 139 :document-id document-id)) 140 (ID (getf type :ID))) 141 (make-instance-of-association topic-stub type-topic 142 ID start-revision 143 xml-importer::tm 144 :document-id document-id))) 145 types) 146 147 ;TODO: 148 ;*import standard topics from isidorus' rdf2tm namespace 149 ; (must be explicitly called by the user) 150 ;*get-topic by topic id 151 ;*make psis 152 ;*if the topic does not exist create one with topic id 153 ;*add psis 154 ;*make instance-of associations + reification 155 ;make super-sub-class associations + reification 156 ;*make occurrences + reification 157 ;*make associations + reification 158 159 160 ;TODO: start recursion ... 161 (remove-node-properties-from-*_n-map* elem) 162 (or super-classes) ;TODO: remove 163 ))))) 164 125 (elephant:ensure-transaction (:txn-nosync t) 126 (let ((topic-stub 127 (make-topic-stub 128 about ID nodeID UUID start-revision xml-importer::tm 129 :document-id document-id))) 130 (map 'list #'(lambda(literal) 131 (make-occurrence topic-stub literal start-revision 132 tm-id :document-id document-id)) 133 literals) 134 (map 'list #'(lambda(assoc) 135 (make-association topic-stub assoc xml-importer::tm 136 start-revision 137 :document-id document-id)) 138 associations) 139 (map 'list 140 #'(lambda(type) 141 (let ((type-topic 142 (make-topic-stub (getf type :psi) 143 nil 144 (getf type :topicid) 145 nil start-revision 146 xml-importer::tm 147 :document-id document-id)) 148 (ID (getf type :ID))) 149 (make-instance-of-association topic-stub type-topic 150 ID start-revision 151 xml-importer::tm 152 :document-id document-id))) 153 types) 154 (map 'list 155 #'(lambda(class) 156 (let ((class-topic 157 (make-topic-stub (getf class :psi) 158 nil 159 (getf class :topicid) 160 nil start-revision 161 xml-importer::tm 162 :document-id document-id)) 163 (ID (getf class :ID))) 164 (make-supertype-subtype-association 165 topic-stub class-topic ID start-revision 166 xml-importer::tm :document-id document-id))) 167 super-classes) 168 169 ;TODO: start recursion ... 170 (remove-node-properties-from-*_n-map* elem))))))) 171 172 173 (defun make-supertype-subtype-association (sub-top super-top reifier-id 174 start-revision tm 175 &key (document-id *document-id*)) 176 "Creates an supertype-subtype association." 177 (declare (TopicC sub-top super-top)) 178 (declare (TopicMapC tm)) 179 (let ((assoc-type (get-item-by-psi *supertype-subtype-psi*)) 180 (role-type-1 (get-item-by-psi *supertype-psi*)) 181 (role-type-2 (get-item-by-psi *subtype-psi*)) 182 (err-pref "From make-supertype-subtype-association(): ")) 183 (unless assoc-type 184 (error "~athe association type ~a is missing!" 185 err-pref *supertype-subtype-psi*)) 186 (unless (or role-type-1 role-type-2) 187 (error "~aone of the role types ~a ~a is missing!" 188 err-pref *supertype-psi* *subtype-psi*)) 189 (elephant:ensure-transaction (:txn-nosync t) 190 (let ((a-roles (list (list :instance-of role-type-1 191 :player super-top) 192 (list :instance-of role-type-2 193 :player sub-top)))) 194 (when reifier-id 195 (make-reification reifier-id sub-top super-top 196 assoc-type start-revision tm 197 :document-id document-id)) 198 (add-to-topicmap 199 tm 200 (make-construct 'AssociationC 201 :start-revision start-revision 202 :instance-of assoc-type 203 :roles a-roles)))))) 165 204 166 205 … … 176 215 (get-item-by-psi *type-psi*)) 177 216 (roletype-2 178 (get-item-by-psi *instance-psi*))) 179 (let ((a-roles (list (list :instance-of roletype-1 180 :player type-top) 181 (list :instance-of roletype-2 182 :player instance-top)))) 183 (when reifier-id 184 (make-reification reifier-id instance-top type-top 185 assoc-type start-revision tm 186 :document-id document-id)) 187 (add-to-topicmap 188 tm 189 (make-construct 'AssociationC 190 :start-revision start-revision 191 :instance-of assoc-type 192 :roles a-roles))))) 217 (get-item-by-psi *instance-psi*)) 218 (err-pref "From make-instance-of-association(): ")) 219 (unless assoc-type 220 (error "~athe association type ~a is missing!" 221 err-pref *type-instance-psi*)) 222 (unless (or roletype-1 roletype-2) 223 (error "~aone of the role types ~a ~a is missing!" 224 err-pref *type-psi* *instance-psi*)) 225 (elephant:ensure-transaction (:txn-nosync t) 226 (let ((a-roles (list (list :instance-of roletype-1 227 :player type-top) 228 (list :instance-of roletype-2 229 :player instance-top)))) 230 (when reifier-id 231 (make-reification reifier-id instance-top type-top 232 assoc-type start-revision tm 233 :document-id document-id)) 234 (add-to-topicmap 235 tm 236 (make-construct 'AssociationC 237 :start-revision start-revision 238 :instance-of assoc-type 239 :roles a-roles)))))) 193 240 194 241 … … 201 248 (let ((topic-id (or about ID nodeID UUID)) 202 249 (psi-uri (or about ID))) 203 (let ((top (get-item-by-id topic-id :xtm-id document-id 204 :revision start-revision))) 250 (let ((top 251 ;seems like there is a bug in get-item-by-id: 252 ;this functions returns an emtpy topic although there is no one 253 ;witha corresponding topic id and/or version and/or xtm-id 254 (let ((inner-top 255 (get-item-by-id topic-id :xtm-id document-id 256 :revision start-revision))) 257 (when (and inner-top 258 (find-if #'(lambda(x) 259 (= (d::start-revision x) start-revision)) 260 (d::versions inner-top))) 261 inner-top)))) 205 262 (if top 206 263 top … … 246 303 (player-psi (getf association :psi)) 247 304 (ID (getf association :ID))) 248 (let ((player-1 (make-topic-stub player-psi player-id nil nil start-revision 249 tm :document-id document-id)) 250 (role-type-1 (get-item-by-psi *rdf2tm-object*)) 251 (role-type-2 (get-item-by-psi *rdf2tm-subject*)) 252 (type-top (make-topic-stub type nil nil nil start-revision 253 tm :document-id document-id))) 254 (let ((roles (list (list :instance-of role-type-1 255 :player player-1) 256 (list :instance-of role-type-2 257 :player top)))) 258 (when ID 259 (make-reification ID top type-top player-1 start-revision 260 tm :document-id document-id)) 261 (add-to-topicmap tm (make-construct 'AssociationC 262 :start-revision start-revision 263 :instance-of type-top 264 :roles roles)))))) 265 305 (elephant:ensure-transaction (:txn-nosync t) 306 (let ((player-1 (make-topic-stub player-psi nil player-id nil 307 start-revision 308 tm :document-id document-id)) 309 (role-type-1 (get-item-by-psi *rdf2tm-object*)) 310 (role-type-2 (get-item-by-psi *rdf2tm-subject*)) 311 (type-top (make-topic-stub type nil nil nil start-revision 312 tm :document-id document-id))) 313 (let ((roles (list (list :instance-of role-type-1 314 :player player-1) 315 (list :instance-of role-type-2 316 :player top)))) 317 (when ID 318 (make-reification ID top type-top player-1 start-revision 319 tm :document-id document-id)) 320 (add-to-topicmap tm (make-construct 'AssociationC 321 :start-revision start-revision 322 :instance-of type-top 323 :roles roles))))))) 324 266 325 267 326 (defun make-association-with-nodes (subject-topic object-topic … … 276 335 (list :instance-of role-type-2 277 336 :player object-topic)))) 278 (add-to-topicmap tm (make-construct 'AssociationC 279 :start-revision start-revision 280 :instance-of associationtype-topic 281 :roles roles))))) 337 (elephant:ensure-transaction (:txn-nosync t) 338 (add-to-topicmap tm (make-construct 'AssociationC 339 :start-revision start-revision 340 :instance-of associationtype-topic 341 :roles roles)))))) 282 342 283 343 … … 295 355 (object-arc (make-topic-stub *rdf-object* nil nil nil start-revision 296 356 tm :document-id document-id)) 297 (subject-arc (make-topic-stub *rdf- object* nil nil nil start-revision357 (subject-arc (make-topic-stub *rdf-subject* nil nil nil start-revision 298 358 tm :document-id document-id)) 299 359 (statement (make-topic-stub *rdf-statement* nil nil nil start-revision 300 360 tm :document-id document-id))) 301 (make-instance-of-association reifier statement nil start-revision tm 302 :document-id document-id) 303 (make-association-with-nodes reifier subject subject-arc tm start-revision) 304 (make-association-with-nodes reifier predicate-arc predicate 305 tm start-revision) 306 (if (typep object 'TopicC) 307 (make-association-with-nodes reifier object object-arc 308 tm start-revision) 309 (make-construct 'OccurrenceC 310 :start-revision start-revision 311 :topic reifier 312 :themes (themes object) 313 :instance-of (instance-of object) 314 :charvalue (charvalue object) 315 :datatype (datatype object))))) 361 (elephant:ensure-transaction (:txn-nosync t) 362 (make-instance-of-association reifier statement nil start-revision tm 363 :document-id document-id) 364 (make-association-with-nodes reifier subject subject-arc tm 365 start-revision) 366 (make-association-with-nodes reifier predicate predicate-arc 367 tm start-revision) 368 (if (typep object 'TopicC) 369 (make-association-with-nodes reifier object object-arc 370 tm start-revision) 371 (make-construct 'OccurrenceC 372 :start-revision start-revision 373 :topic reifier 374 :themes (themes object) 375 :instance-of (instance-of object) 376 :charvalue (charvalue object) 377 :datatype (datatype object)))))) 316 378 317 379 … … 328 390 (datatype (getf literal :datatype)) 329 391 (ID (getf literal :ID))) 330 (let ((type-top (make-topic-stub type nil nil nil start-revision 331 xml-importer::tm 332 :document-id document-id)) 333 (lang-top (make-lang-topic lang tm-id start-revision 334 xml-importer::tm 335 :document-id document-id))) 336 (let ((occurrence 337 (make-construct 'OccurrenceC 338 :start-revision start-revision 339 :topic top 340 :themes (when lang-top 341 (list lang-top)) 342 :instance-of type-top 343 :charvalue value 344 :datatype datatype))) 345 (when ID 346 (make-reification ID top type-top occurrence start-revision 347 xml-importer::tm :document-id document-id)) 348 occurrence))))) 392 (elephant:ensure-transaction (:txn-nosync t) 393 (let ((type-top (make-topic-stub type nil nil nil start-revision 394 xml-importer::tm 395 :document-id document-id)) 396 (lang-top (make-lang-topic lang tm-id start-revision 397 xml-importer::tm 398 :document-id document-id))) 399 (let ((occurrence 400 (make-construct 'OccurrenceC 401 :start-revision start-revision 402 :topic top 403 :themes (when lang-top 404 (list lang-top)) 405 :instance-of type-top 406 :charvalue value 407 :datatype datatype))) 408 (when ID 409 (make-reification ID top type-top occurrence start-revision 410 xml-importer::tm :document-id document-id)) 411 occurrence)))))) 349 412 350 413 -
TabularUnified trunk/src/xml/rdf/rdf_core_psis.xtm ¶
r101 r103 18 18 </topic> 19 19 20 20 <topic id="object"> 21 21 <subjectIdentifier href="http://isidorus/rdf2tm_mapping#object"/> 22 22 <name> … … 25 25 </topic> 26 26 27 <topic id="supertype-subtype"> 28 <subjectIdentifier href="http://psi.topicmaps.org/iso13250/model/supertype-subtype"/> 29 <name> 30 <value>supertype-subtype</value> 31 </name> 32 </topic> 33 34 <topic id="superclass"> 35 <subjectIdentifier href="http://psi.topicmaps.org/iso13250/model/supertype"/> 36 <name> 37 <value>supertype</value> 38 </name> 39 </topic> 40 41 <topic id="subtype"> 42 <subjectIdentifier href="http://psi.topicmaps.org/iso13250/model/subtype"/> 43 <name> 44 <value>subtype</value> 45 </name> 46 </topic> 47 27 48 </topicMap> -
TabularUnified trunk/src/xml/rdf/rdf_tools.lisp ¶
r101 r103 25 25 *rdf-predicate* 26 26 *rdf2tm-object* 27 *rdf2tm-subject*) 27 *rdf2tm-subject* 28 *supertype-psi* 29 *subtype-psi* 30 *supertype-subtype-psi*) 28 31 (:import-from :xml-constants 29 32 *rdf_core_psis.xtm*) … … 60 63 (:import-from :exceptions 61 64 missing-reference-error 62 duplicate-identifier-error)) 65 duplicate-identifier-error) 66 (:export :setup-rdf-module 67 :rdf-importer 68 :init-rdf-module 69 :*rdf-core-xtm*)) 63 70 64 71 (in-package :rdf-importer) -
TabularUnified trunk/src/xml/xtm/tools.lisp ¶
r100 r103 72 72 with the given base and tm-id." 73 73 (declare (string id tm-id)) 74 (when (= (length id) 0) 75 (error "From absolutize-id(): id must be set to a string with length > 0!")) 74 76 (let ((prep-id (if (and (> (length id) 0) 75 77 (eql (elt id 0) #\#)) … … 110 112 (when (> (length tm-id) 0) 111 113 (string-right-trim "/" tm-id)))) 112 (concatenate 'string prep-tm-id "/" prep-fragment))))))) 114 (let ((separator 115 (if (eql (elt prep-fragment 0) #\#) 116 "" 117 "/"))) 118 (concatenate 'string prep-tm-id separator prep-fragment)))))))) 113 119 114 120
Note: See TracChangeset
for help on using the changeset viewer.