]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - reports/slice-20j/controls.lisp
Add XTM Variant reification and qualify Slice 21O originals
[topic-maps.git] / reports / slice-20j / controls.lisp
1 ;; Explorative inputs only; original sources, Case Records and reader stay unchanged.
2 (in-package :cl-user)
3 (defvar *rows* nil)
4 (defun control (label text &optional original)
5 (let* ((doc (if original (concatenate 'string "https://ctm-tests.example.invalid/cd165b150176c1d6842b37be9cc9051b40d4996b/" original)
6 "https://example.invalid/slice20i/control.ctm"))
7 (baseline (when original (merge-pathnames (concatenate 'string "vendor/cxtm/ctm/baseline/" (file-namestring original) ".cxtm") "/Users/rgb/workspace/topic-maps/"))))
8 (multiple-value-bind (map condition)
9 (topic-maps.registered-original.tests::captured-read
10 (lambda () (topic-maps.ctm:deserialize-string text :document-iri doc :source-name label)))
11 (let* ((held (when map (topic-maps.import.tests::handles map)))
12 (state (when map (topic-maps.import.tests::state map held)))
13 (actual (when map (topic-maps.cxtm:canonicalize-octets map :base-locator doc)))
14 (expected (when baseline (topic-maps.registered-original.tests::binary baseline))))
15 (push (topic-maps.test-foundation::fields
16 "label" label "originalControlOnly" original "sourceText" text "documentIRI" doc
17 "condition" (topic-maps.registered-original.tests::condition-data condition)
18 "model" (when map (topic-maps.template.tests::observe map))
19 "associations" (when map (coerce (loop for a in (topic-maps.tmdm:topic-map-associations map) collect
20 (topic-maps.test-foundation::fields
21 "typeSI" (coerce (topic-maps.tmdm:topic-subject-identifiers (topic-maps.tmdm:association-type a)) 'vector)
22 "roles" (coerce (loop for r in (topic-maps.tmdm:association-roles a) collect
23 (topic-maps.test-foundation::fields
24 "typeSI" (coerce (topic-maps.tmdm:topic-subject-identifiers (topic-maps.tmdm:association-role-type r)) 'vector)
25 "playerSI" (coerce (topic-maps.tmdm:topic-subject-identifiers (topic-maps.tmdm:association-role-player r)) 'vector))) 'vector))) 'vector))
26 "referencesCurrent" (if (and map (topic-maps.reference.tests::references-current-p map)) :true :false)
27 "canonicalizationPreservesMap" (if (and map (equal state (topic-maps.import.tests::state map held))) :true :false)
28 "actualCXTM" (when actual (topic-maps.ctm::decode-utf8 actual)) "actualBytes" (when actual (length actual))
29 "expectedBytes" (when expected (length expected))
30 "byteExact" (if (and actual expected (equalp actual expected)) :true :false)) *rows*)))))
31 (control "expanded-ambiguous5" "topic <http://www.example.org/something/>; =<http://www.example.org/something/>; ^<http://www.example.org/something/>." "ctm/in/template-ambiguous-parameter5.ctm")
32 (control "expanded-ambiguous6" "%prefix ex <http://www.example.org/> topic ex:something; =ex:something; ^ex:something; occ: ex:something." "ctm/in/template-ambiguous-parameter6.ctm")
33 (control "expanded-subject-identifier2" "topic <http://psi.example.org/fake>." "ctm/in/template-subject-identifier2.ctm")
34 (control "head-variable-IRI" "def t($v) $v. end t(<http://www.example.org/entity>)")
35 (control "head-variable-item-identifier" "def t($v) $v. end t(^<http://www.example.org/entity>)")
36 (control "head-variable-subject-locator" "def t($v) $v. end t(=<http://www.example.org/entity>)")
37 (control "IRI-variable-in-explicit-identities-type-player-and-literal" "def t($v) $v. holder =$v; ^$v; occ: $v. $v($v : $v) end t(<http://www.example.org/entity>)")
38 (control "unmarked-tail-even-without-invocation" "def t($v) topic $v. end")
39 (control "item-identifier-cannot-be-literal" "def t($v) topic occ: $v. end t(^<http://www.example.org/entity>)")
40 (control "subject-locator-cannot-be-literal" "def t($v) topic occ: $v. end t(=<http://www.example.org/entity>)")
41 (control "second-item-identifier-in-IRI-slot" "def t($a,$b) topic1 ^$a. topic2 ^$b. end t(<http://www.example.org/>,^<http://www.example.org/>)")
42 (control "second-subject-locator-in-IRI-slot" "def t($a,$b) topic1 =$a. topic2 =$b. end t(<http://www.example.org/>,=<http://www.example.org/>)")
43 (with-open-file (out (concatenate 'string (uiop:getenv "TOPIC_MAPS_20J_OUTPUT") "/controls.json") :direction :output :if-exists :supersede)
44 (topic-maps.test-foundation::emit-json-value (coerce (nreverse *rows*) 'vector) out) (terpri out))