]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - reports/slice-21o/development-preflight-original.lisp
Verify CTM/XTM semantic equivalence through TMDM and CXTM (Slice 22F)
[topic-maps.git] / reports / slice-21o / development-preflight-original.lisp
1 (require :asdf)
2 (assert (string= "2.5.4" (lisp-implementation-version)))
3 (setf *compile-verbose* nil *load-verbose* nil)
4 (asdf:load-asd #P"/Users/rgb/workspace/topic-maps/topic-maps.asd")
5 (asdf:load-system "topic-maps/xtm/tests")
6 (in-package :topic-maps.xtm.tests)
7 (dolist (both '(nil t))
8 (let* ((map (make-topic-map)) (p (intern-topic map :item-identifier "urn:p")) (q (intern-topic map :item-identifier "urn:q"))
9 (s (intern-topic map :item-identifier "urn:scope")) (n (add-default-name p "N")) (m (add-default-name q "N"))
10 (a (add-variant n "V" :scope (list s))) (b (add-variant m "V" :scope (list s)))
11 (r (intern-topic map :item-identifier "urn:r")) (u (intern-topic map :item-identifier "urn:u")))
12 (assert (eq a (canonical-variant a))) (assert (eq a (set-item-reifier a r)))
13 (assert (eq r (item-reifier a))) (assert (eq a (topic-reified r)))
14 (assert (eq a (add-variant n "V" :scope (list s))))
15 (add-item-identifier a "urn:a") (add-item-identifier b "urn:b")
16 (when both (set-item-reifier b u))
17 (merge-topics p q)
18 (let ((current (canonical-variant a)))
19 (assert (eq current (canonical-variant b))) (assert (not (eq current a)))
20 (assert (eq (canonical-topic-name n) (variant-parent current)))
21 (assert (eq (canonical-topic-name n) (canonical-topic-name m)))
22 (assert (same-identifiers-p '("urn:a" "urn:b") (item-identifiers current)))
23 (assert (eq (canonical-topic r) (item-reifier current))) (assert (eq current (topic-reified r)))
24 (when both (assert (eq (canonical-topic r) (canonical-topic u))) (assert (eq current (topic-reified u))))
25 (assert (topic-maps.tmdm::validate-map-reification map))
26 (format t "VARIANT-REIFIER-API-NORMALIZATION: ~A existing Reifier(s), identifiers and old handles preserved~%" (if both 2 1)))))
27 (let* ((map (make-topic-map)) (p (intern-topic map :item-identifier "urn:p")) (s (intern-topic map :item-identifier "urn:s"))
28 (n (add-default-name p "N")) (a (add-variant n "A" :scope (list s))) (b (add-variant n "B" :scope (list s)))
29 (r (intern-topic map :item-identifier "urn:r")) (u (intern-topic map :item-identifier "urn:u")))
30 (set-item-reifier a r) (set-item-reifier b u)
31 (dolist (operation (list (lambda () (set-item-reifier b r)) (lambda () (merge-topics r u))))
32 (let* ((before (map-reifier-state map)) (c (condition-from operation)))
33 (assert (eq 'reification-error (type-of c))) (assert (eq :reifier-conflict (reification-error-code c)))
34 (assert (equal before (map-reifier-state map)))
35 (format t "VARIANT-REIFIER-API-CONDITION: ~A ~A; atomic~%" (type-of c) (reification-error-code c))))
36 (add-item-identifier a "urn:variant")
37 (let* ((before (map-reifier-state map)) (c (condition-from (lambda () (intern-topic map :item-identifier "urn:variant")))))
38 (assert (typep c 'item-identifier-error)) (assert (eq :duplicate-item-identifier (item-identifier-error-code c)))
39 (assert (equal before (map-reifier-state map)))
40 (format t "VARIANT-REIFIER-API-CONDITION: ~A ~A; atomic~%" (type-of c) (item-identifier-error-code c))))
41 (format t "VARIANT-REIFIER-API-PREFLIGHT-PASS: normalize, assign II, resolve Reifier by II, set on current Variant, retain canonical result~%")