Changeset 145 for trunk/src/xml
- Timestamp:
- 11/22/09 18:16:47 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/xml/xtm/importer_xtm2.0.lisp ¶
r92 r145 9 9 10 10 (in-package :xml-importer) 11 12 (defun set-reifier (reifiable-elem reifiable-construct) 13 "Sets the reifier-topic of the passed elem to the passed construct." 14 (declare (dom:element reifiable-elem)) 15 (declare (ReifiableConstructC reifiable-construct)) 16 (let ((reifier-uri (get-attribute reifiable-elem "reifier"))) 17 (when (and (stringp reifier-uri) 18 (> (length reifier-uri) 0)) 19 (add-reifier reifiable-construct reifier-uri)) 20 reifiable-construct)) 21 11 22 12 23 (defun from-identifier-elem (classsymbol elem start-revision) … … 128 139 (loop for variant-elem across (xpath-child-elems-by-qname name-elem *xtm2.0-ns* "variant") 129 140 do (from-variant-elem variant-elem name start-revision :xtm-id xtm-id)) 130 name)))141 (set-reifier name-elem name)))) 131 142 132 143 … … 181 192 (error "VariantC: one of resourceRef and resourceData must be set")) 182 193 183 (make-construct 'VariantC 184 :start-revision start-revision 185 :item-identifiers item-identifiers 186 :themes themes 187 :charvalue (getf variant-value :data) 188 :datatype (getf variant-value :type) 189 :name name))) 194 (let ((variant (make-construct 'VariantC 195 :start-revision start-revision 196 :item-identifiers item-identifiers 197 :themes themes 198 :charvalue (getf variant-value :data) 199 :datatype (getf variant-value :type) 200 :name name))) 201 (set-reifier variant-elem variant)))) 190 202 191 203 … … 212 224 (unless occurrence-value 213 225 (error "OccurrenceC: one of resourceRef and resourceData must be set")) 214 (make-construct 'OccurrenceC 215 :start-revision start-revision 216 :topic top 217 :themes themes 218 :item-identifiers item-identifiers 219 :instance-of instance-of 220 :charvalue (getf occurrence-value :data) 221 :datatype (getf occurrence-value :type)))) 226 (let ((occurrence (make-construct 'OccurrenceC 227 :start-revision start-revision 228 :topic top 229 :themes themes 230 :item-identifiers item-identifiers 231 :instance-of instance-of 232 :charvalue (getf occurrence-value :data) 233 :datatype (getf occurrence-value :type)))) 234 (set-reifier occ-elem occurrence)))) 222 235 223 236 … … 323 336 role-elem 324 337 *xtm2.0-ns* 325 "topicRef")) :xtm-id xtm-id))) 338 "topicRef")) :xtm-id xtm-id)) 339 (reifier-uri 340 (let ((value (get-attribute role-elem "reifier"))) 341 (if (and (stringp value) 342 (> (length value) 0)) 343 value 344 nil)))) 326 345 ; (unless (and player instance-of) 327 346 ; (error "Role in association not complete")) … … 332 351 *xtm2.0-ns* 333 352 "topicRef")))) 334 (list :instance-of instance-of :player player :item-identifiers item-identifiers)))) 353 (list :reifier-uri reifier-uri 354 :instance-of instance-of 355 :player player 356 :item-identifiers item-identifiers)))) 335 357 336 358 … … 340 362 (xtm-id *current-xtm*)) 341 363 "Constructs an AssociationC object from an association element 342 association = element association { reifiable, type, scope?, role+ }"364 association = element association { reifiable, type, scope?, role+ }" 343 365 (declare (dom:element assoc-elem)) 344 366 (declare (integer start-revision)) … … 367 389 *xtm2.0-ns* "role")))) 368 390 (setf roles (set-standard-role-types roles)); sets standard role types if there are missing some of them 369 370 (add-to-topicmap tm 371 (make-construct 'AssociationC 372 :start-revision start-revision 373 :item-identifiers item-identifiers 374 :instance-of instance-of 375 :themes themes 376 :roles roles))))) 391 (let ((assoc (add-to-topicmap 392 tm 393 (make-construct 'AssociationC 394 :start-revision start-revision 395 :item-identifiers item-identifiers 396 :instance-of instance-of 397 :themes themes 398 :roles roles)))) 399 (map 'list #'(lambda(assoc-role) 400 (map 'list #'(lambda(list-role) 401 (when (and (eql (instance-of assoc-role) 402 (getf list-role :instance-of)) 403 (eql (player assoc-role) 404 (getf list-role :player)) 405 (getf list-role :reifier-uri)) 406 (add-reifier assoc-role (getf list-role :reifier-uri)))) 407 roles)) 408 (roles assoc)) 409 (set-reifier assoc-elem assoc))))) 377 410 378 411
Note: See TracChangeset
for help on using the changeset viewer.