- "TMDM 5.6/6.5, null reifier; replace duplicates and union identifiers."
- (dolist (topic (%topic-map-topics map))
- (loop for pair = (equal-pair (%topic-occurrences topic)
- (lambda (a b) (same-occurrence-properties-p a (%occurrence-value b)
- (%occurrence-datatype b) (%occurrence-type b) (%occurrence-scope b))))
- while pair do
- (let* ((a (first pair)) (b (second pair))
- (c (%make-occurrence (%occurrence-value a) (%occurrence-datatype a) (%occurrence-type a) topic)))
- (setf (%occurrence-scope c) (copy-list (%occurrence-scope a))
- (%occurrence-item-identifiers c)
- (set-union (%occurrence-item-identifiers a) (%occurrence-item-identifiers b) #'string=)
- (%topic-occurrences topic) (replace-pair (%topic-occurrences topic) a b c)
- (%occurrence-forward a) c (%occurrence-forward b) c))))
+ "TMDM 5.6/6.5: rescan live owners after Reifier-induced merges."
+ (loop for entry = (loop for topic in (%topic-map-topics map)
+ for pair = (equal-pair (%topic-occurrences topic)
+ (lambda (a b) (same-occurrence-properties-p a (%occurrence-value b)
+ (%occurrence-datatype b) (%occurrence-type b) (%occurrence-scope b))))
+ when pair return (cons topic pair))
+ while entry do
+ (let* ((topic (first entry)) (a (second entry)) (b (third entry))
+ (c (%make-occurrence (%occurrence-value a) (%occurrence-datatype a) (%occurrence-type a) topic)))
+ (setf (%occurrence-scope c) (copy-list (%occurrence-scope a))
+ (%occurrence-item-identifiers c) (set-union (%occurrence-item-identifiers a) (%occurrence-item-identifiers b) #'string=)
+ (%topic-occurrences topic) (replace-pair (%topic-occurrences topic) a b c)
+ (%occurrence-forward a) c (%occurrence-forward b) c)
+ (merge-item-reifiers c a b)))