X-Git-Url: https://dreyeck.freedombox.rocks/gitweb/topic-maps.git/blobdiff_plain/963f2a09444100d37e49cccbd6634879bd6742b5..4d7adecb3c2d5df90579aa37dfa41128988cb56c:/src/tmdm/merging.lisp diff --git a/src/tmdm/merging.lisp b/src/tmdm/merging.lisp index 0fcb878..b34766d 100644 --- a/src/tmdm/merging.lisp +++ b/src/tmdm/merging.lisp @@ -132,7 +132,20 @@ (check-variant-merge-constraints map) (loop for before = (length (map-information-items map)) do (loop for pair = (equal-pair (%topic-map-topics map) #'equal-topics-p) - while pair do (merge-two-topics map (first pair) (second pair))) + while pair do + ;; A staged import may contain equal owners/types AND equal Reifier + ;; Topics whose Names/Occurrences/etc. have not merged yet. First perform + ;; available nonconflicting Topic merges; their ordinary item merging can + ;; resolve those Reified references. Do not let collection order invent a + ;; conflict. If none can proceed, MERGE-TWO-TOPICS still signals TMDM 6.2's + ;; conflict; no equality or conflict rule is relaxed. + (let ((ready (equal-pair (%topic-map-topics map) + (lambda (a b) + (and (equal-topics-p a b) + (let ((left (topic-reified a)) (right (topic-reified b))) + (not (and left right (not (eq left right)))))))))) + (let ((next (or ready pair))) + (merge-two-topics map (first next) (second next))))) (normalize-names map) (normalize-occurrences map) (normalize-associations map) when (= before (length (map-information-items map))) return map))