X-Git-Url: https://dreyeck.freedombox.rocks/gitweb/topic-maps.git/blobdiff_plain/c02207856f1927302ea064bc901e07183242f2da..acc9eb65b0cce71409ad84841f082f5ca125c839:/src/xtm/reader.lisp?ds=inline diff --git a/src/xtm/reader.lisp b/src/xtm/reader.lisp index 5cfdde4..55f5892 100644 --- a/src/xtm/reader.lisp +++ b/src/xtm/reader.lisp @@ -177,8 +177,7 @@ constructs' complete subgrammars is made. XML errors have already been checked." ((string= name "occurrence") (attributes node '("reifier") nil) (when (attr node "reifier") - (resolve-iri (attr node "reifier") *document-iri* node) - (reject :unsupported-construct "XTM occurrence reification is not implemented in this subset." node 'xtm-unsupported)) + (resolve-iri (attr node "reifier") *document-iri* node)) (let ((phase 0) (type-seen nil) (scope-seen nil) (resource-seen nil)) (dolist (child (elements node)) (check-namespace child) @@ -210,8 +209,9 @@ constructs' complete subgrammars is made. XML errors have already been checked." (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)) + (when (string= name "role") + (reject :unsupported-construct + "XTM role reification is not implemented in this subset." node 'xtm-unsupported))) (let ((association-p (string= name "association")) (phase 0) (type-seen nil) (scope-seen nil) (participants 0)) (dolist (child (elements node)) @@ -346,7 +346,10 @@ constructs' complete subgrammars is made. XML errors have already been checked." (topic-maps.tmdm:canonical-topic (second pair))))) (topic-maps.tmdm:association-roles association)))) (read-item-identities source role))) - (topic-maps.tmdm:canonical-association association))))) + ;; 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 @@ -410,8 +413,11 @@ by source validation before model construction. Preserve other datatype IRIs." (resource (find-if (lambda (child) (member (node-name child) '("resourceData" "resourceRef") :test #'string=)) children))) (multiple-value-bind (value datatype) (read-resource-value resource) (topic-maps.tmdm:canonical-occurrence - (read-item-identities node - (topic-maps.tmdm:add-occurrence owner type value :datatype datatype :scope scope)))))) + ;; Resolve Reifier by II only after native Occurrence normalization and + ;; II assignment. Reifier merging can normalize again: return its handle. + (read-item-reifier node + (read-item-identities node + (topic-maps.tmdm:add-occurrence owner type value :datatype datatype :scope scope)) map))))) (defun read-topic (node map) (let ((topic (topic-maps.tmdm:intern-topic map :item-identifier (concatenate 'string *document-iri* "#" (collapse-space (attr node "id"))))))