]> dreyeck.freedombox.rocks Git - topic-maps.git/blobdiff - src/xtm/reader.lisp
Document qualified disposition of remaining XTM corpus cases
[topic-maps.git] / src / xtm / reader.lisp
index 4cfa213a0d13e256a0b8341d0bbe701bd3815fd2..56d5785509b78e6f5768b9a41ab80c38d264d4ce 100644 (file)
@@ -208,9 +208,7 @@ constructs' complete subgrammars is made. XML errors have already been checked."
                    ((member name '("association" "role") :test #'string=)
                     (attributes node '("reifier") nil)
                     (when (attr node "reifier")
                    ((member name '("association" "role") :test #'string=)
                     (attributes node '("reifier") nil)
                     (when (attr node "reifier")
-                      (resolve-iri (attr node "reifier") *document-iri* node)
-                      (reject :unsupported-construct
-                        (format nil "XTM ~A reification is not implemented in this subset." name) node 'xtm-unsupported))
+                      (resolve-iri (attr node "reifier") *document-iri* node))
                     (let ((association-p (string= name "association"))
                           (phase 0) (type-seen nil) (scope-seen nil) (participants 0))
                       (dolist (child (elements node))
                     (let ((association-p (string= name "association"))
                           (phase 0) (type-seen nil) (scope-seen nil) (participants 0))
                       (dolist (child (elements node))
@@ -338,14 +336,20 @@ constructs' complete subgrammars is made. XML errors have already been checked."
         ;; Match source metadata to the native Role by its complete signature
         ;; within THIS canonical Parent. Role order/II are not equality keys.
         (loop for pair in (reverse roles) for source in (reverse role-nodes) do
         ;; Match source metadata to the native Role by its complete signature
         ;; within THIS canonical Parent. Role order/II are not equality keys.
         (loop for pair in (reverse roles) for source in (reverse role-nodes) do
+          ;; A preceding Role Reifier may have merged Topics and this Parent.
+          (setf association (topic-maps.tmdm:canonical-association association))
           (let ((role (find-if (lambda (role)
                         (and (eq (topic-maps.tmdm:association-role-type role)
                                  (topic-maps.tmdm:canonical-topic (first pair)))
                              (eq (topic-maps.tmdm:association-role-player role)
                                  (topic-maps.tmdm:canonical-topic (second pair)))))
                       (topic-maps.tmdm:association-roles association))))
           (let ((role (find-if (lambda (role)
                         (and (eq (topic-maps.tmdm:association-role-type role)
                                  (topic-maps.tmdm:canonical-topic (first pair)))
                              (eq (topic-maps.tmdm:association-role-player role)
                                  (topic-maps.tmdm:canonical-topic (second pair)))))
                       (topic-maps.tmdm:association-roles association))))
-            (read-item-identities source role)))
-        (topic-maps.tmdm:canonical-association association)))))
+            (setf role (read-item-identities source role))
+            (read-item-reifier source (topic-maps.tmdm:canonical-association-role role) map)))
+        ;; Role metadata is now on the native canonical Parent. Reifier merging
+        ;; may normalize it again; return the resulting Association handle.
+        (topic-maps.tmdm:canonical-association
+          (read-item-reifier node association map))))))
 (defun read-resource-value (resource)
   "Return value and datatype for a validated resource node (XTM 4.16/4.17).
 This operation neither looks up Topics nor fetches resources. ANYTYPE is rejected
 (defun read-resource-value (resource)
   "Return value and datatype for a validated resource node (XTM 4.16/4.17).
 This operation neither looks up Topics nor fetches resources. ANYTYPE is rejected