]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - reports/slice-21l/api-preflight.lisp
Add XTM Variant reification and qualify Slice 21O originals
[topic-maps.git] / reports / slice-21l / api-preflight.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 (defun preflight-state (map)
8 (list (variant-state map) (item-reifier map)
9 (loop for topic in (topic-map-topics map) collect
10 (list topic (canonical-topic topic) (topic-reified topic) (topic-maps.tmdm::%topic-forward topic)))))
11 (let* ((map (make-topic-map)) (r (intern-topic map :item-identifier "urn:reifier"))
12 (owner (intern-topic map :subject-identifier "urn:owner")) (name (add-default-name owner "N")))
13 (assert (eq map (set-item-reifier map r)))
14 (assert (eq r (item-reifier map))) (assert (eq map (topic-reified r)))
15 (assert (eq map (set-item-reifier map r)))
16 (let* ((before (preflight-state map))
17 (c (condition-from (lambda () (set-item-reifier name r)))))
18 (assert (eq 'reification-error (type-of c)))
19 (assert (eq :reifier-conflict (reification-error-code c)))
20 (assert (equal before (preflight-state map)))
21 (format t "MAP-REIFIER-API-CONDITION: ~A ~A; rejected assignment atomic~%" (type-of c) (reification-error-code c)))
22 (add-item-identifier name "urn:name")
23 (let* ((before (preflight-state map))
24 (c (condition-from (lambda () (intern-topic map :item-identifier "urn:name")))))
25 (assert (typep c 'item-identifier-error))
26 (assert (eq :duplicate-item-identifier (item-identifier-error-code c)))
27 (assert (equal before (preflight-state map)))
28 (format t "MAP-REIFIER-API-CONDITION: ~A ~A; rejected creation atomic~%" (type-of c) (item-identifier-error-code c)))
29 (let ((other (intern-topic map :item-identifier "urn:other")))
30 (add-topic-identifier other :item-identifier "urn:reifier")
31 (assert (eq (canonical-topic r) (canonical-topic other)))
32 (assert (eq (canonical-topic r) (item-reifier map)))
33 (assert (eq map (topic-reified other))))
34 (assert (topic-maps.tmdm::validate-map-reification map)))
35 (let* ((map (make-topic-map)) (si (intern-topic map :subject-identifier "urn:si-only")))
36 (assert (null (item-identifiers si)))
37 (assert (eq si (intern-topic map :item-identifier "urn:si-only")))
38 (assert (equal '("urn:si-only") (item-identifiers si))))
39 (format t "MAP-REIFIER-API-PREFLIGHT-PASS: native inverse, II creation, canonical merging and conflict atomicity~%")