Changeset 130 for trunk/src/xml
- Timestamp:
- 09/02/09 14:15:46 (16 years ago)
- Location:
- trunk/src/xml/rdf
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/xml/rdf/importer.lisp ¶
r129 r130 105 105 (UUID (get-ns-attribute elem "UUID" :ns-uri *rdf2tm-ns*))) 106 106 (parse-properties-of-node elem (or about nodeID ID UUID)) 107 ;TODO: create associaitons and roles 107 ;TODO: create associations and roles -> and iterate in import-dom 108 ; over those elements 108 109 (let ((literals (append (get-literals-of-node elem fn-xml-lang) 109 110 (get-literals-of-node-content … … 127 128 :subject-locators subject-locators))) 128 129 (make-isidorus-names elem this tm-id start-revision 129 :owner-xml-base fn-xml-base) 130 ;TODO: create topic occurrences 130 :owner-xml-base fn-xml-base 131 :document-id document-id) 132 (make-isidorus-occurrences elem this tm-id start-revision 133 :owner-xml-base fn-xml-base 134 :document-id document-id) 131 135 (make-literals this literals tm-id start-revision 132 136 :document-id document-id) … … 144 148 145 149 150 (defun make-isidorus-occurrences (owner-elem owner-topic tm-id start-revision 151 &key (owner-xml-base nil) 152 (document-id *document-id*)) 153 "Creates all occurrences of resource nodes that are in a 154 property isidorus:occurrence and have the type isidorus:Occurrence." 155 (declare (dom:element owner-elem)) 156 (declare (string tm-id)) 157 (declare (TopicC owner-topic)) 158 (let ((content (child-nodes-or-text owner-elem :trim t)) 159 (root (elt (dom:child-nodes (dom:owner-document owner-elem)) 0)) 160 (err-pref "From make-isidorus-occurrence(): ")) 161 (when (and (not (stringp content)) 162 (> (length content) 0)) 163 (loop for property across content 164 when (isidorus-type-p property tm-id 'occurrence 165 :parent-xml-base owner-xml-base) 166 collect 167 (let ((xml-base (get-xml-base property 168 :old-base owner-xml-base))) 169 (let ((nodes 170 (let ((nodeID (nodeID-of-property-or-child property))) 171 (if nodeID 172 (get-all-isidorus-nodes-by-id 173 nodeID root *tm2rdf-occurrence-type-uri*) 174 (list (self-or-child-node 175 property *tm2rdf-occurrence-type-uri* 176 :xml-base xml-base)))))) 177 (let ((item-identities 178 (remove-if #'null 179 (loop for node in nodes 180 append (make-isidorus-identifiers 181 (getf node :elem) start-revision)))) 182 (occurrence-type (make-x-type 183 nodes tm-id start-revision 184 *tm2rdf-occurrencetype-property* 185 :document-id document-id)) 186 (value-and-datatype (make-value nodes tm-id)) 187 (occurrence-scopes (make-scopes nodes tm-id start-revision 188 :document-id document-id))) 189 (unless occurrence-type 190 (error "~aoccurrencetype is missing!" 191 err-pref)) 192 (make-construct 'OccurrenceC 193 :start-revision start-revision 194 :topic owner-topic 195 :themes occurrence-scopes 196 :item-identifiers item-identities 197 :instance-of occurrence-type 198 :charvalue (getf value-and-datatype :value) 199 :datatype (getf value-and-datatype 200 :datatype))))))))) 201 146 202 147 203 (defun make-isidorus-names (owner-elem owner-topic tm-id start-revision 148 204 &key (owner-xml-base nil) 149 205 (document-id *document-id*)) 150 "Creates all names of a resource nodethat are in a property isidorus:name206 "Creates all names of resource nodes that are in a property isidorus:name 151 207 and have the type isidorus:Name." 152 208 (declare (dom:element owner-elem)) … … 154 210 (declare (TopicC owner-topic)) 155 211 (let ((content (child-nodes-or-text owner-elem :trim t)) 156 (root (elt (dom:child-nodes (dom:owner-document owner-elem)) 0))) 212 (root (elt (dom:child-nodes (dom:owner-document owner-elem)) 0)) 213 (err-pref "From make-isidorus-name(): ")) 157 214 (when (and (not (stringp content)) 158 215 (> (length content) 0)) … … 164 221 :old-base owner-xml-base))) 165 222 (let ((nodes 166 (let ((nodeID ( get-ns-attribute property "nodeID")))223 (let ((nodeID (nodeID-of-property-or-child property))) 167 224 (if nodeID 168 225 (get-all-isidorus-nodes-by-id … … 176 233 append (make-isidorus-identifiers 177 234 (getf node :elem) start-revision)))) 178 (name-type (make-name-type nodes tm-id start-revision 179 :document-id document-id)) 235 (name-type (make-x-type nodes tm-id start-revision 236 *tm2rdf-nametype-property* 237 :document-id document-id)) 180 238 (name-value (getf (make-value nodes tm-id) :value)) 181 239 (name-scopes (make-scopes nodes tm-id start-revision 182 240 :document-id document-id))) 241 (unless name-type 242 (error "~anametype is missing!" 243 err-pref)) 183 244 (let ((this 184 245 (make-construct 'NameC … … 201 262 (when name-nodes 202 263 (elt (dom:child-nodes 203 (dom:owner-document (getf (first name-nodes) :elem))) 0)))) 264 (dom:owner-document (getf (first name-nodes) :elem))) 0))) 265 (err-pref "From make-isidorus-variant(): ")) 204 266 (remove-if 205 267 #'null … … 238 300 :document-id document-id) 239 301 (themes owner-name))) ;XTM 2.0: 4.12 240 (value-and-type (make-value nodes tm-id))) 302 (value-and-type (make-value nodes tm-id))) 303 (unless variant-scopes 304 (error "~ascope is missing!" 305 err-pref)) 241 306 (make-construct 'VariantC 242 307 :start-revision start-revision … … 337 402 338 403 339 (defun make- name-type (node-list tm-id start-revision404 (defun make-x-type (node-list tm-id start-revision uri-of-property 340 405 &key (document-id *document-id*)) 341 406 "Creates a topic stub that is the type of the name represented by the … … 349 414 (prop-name (get-node-name property))) 350 415 (string= (concatenate-uri prop-ns prop-name) 351 *tm2rdf-nametype-property*))416 uri-of-property)) 352 417 return property)) 353 418 return (let ((content (child-nodes-or-text (getf node :elem) … … 357 422 (prop-name (get-node-name property))) 358 423 (string= (concatenate-uri prop-ns prop-name) 359 *tm2rdf-nametype-property*))424 uri-of-property)) 360 425 return (list 361 426 :elem property … … 369 434 (getf property :xml-base)))) 370 435 (unless type-uri 371 (error "From make- name-type(): type-uri is missing!"))436 (error "From make-x-type(): type-uri is missing!")) 372 437 (with-tm (start-revision document-id tm-id) 373 438 (make-topic-stub (getf type-uri :psi) nil … … 431 496 :owner-xml-base xml-base 432 497 :document-id document-id) 433 ;TDOD: create topic occurrences 498 (make-isidorus-occurrences 499 elem this tm-id start-revision 500 :owner-xml-base xml-base :document-id document-id) 434 501 (make-literals this literals tm-id start-revision 435 502 :document-id document-id) -
TabularUnified trunk/src/xml/rdf/isidorus_constructs_tools.lisp ¶
r129 r130 319 319 (list :elem property-node 320 320 :xml-base xml-base)))) 321 322 323 (defun nodeID-of-property-or-child (elem) 324 "Returns either the nodeID of the given element or if tere isn't one 325 the nodeID of the element's first child node. If there is no nodeID 326 at all, nil is returned." 327 (declare (dom:element elem)) 328 (let ((elem-nodeID (get-ns-attribute elem "nodeID"))) 329 (if elem-nodeID 330 elem-nodeID 331 (let ((elem-content (child-nodes-or-text elem :trim t))) 332 (when (and (> (length elem-content) 0) 333 (not (stringp elem-content))) 334 (get-ns-attribute (elt elem-content 0) "nodeID")))))) 335
Note: See TracChangeset
for help on using the changeset viewer.