]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - tests/xtm-occurrences.lisp
Implement XTM association and role core with original conformance evidence
[topic-maps.git] / tests / xtm-occurrences.lisp
1 (in-package #:topic-maps.xtm.tests)
2
3 (defvar *occurrence-outputs* nil)
4 (defvar *occurrence-controls* nil)
5 (defparameter *occurrence-originals*
6 '("occurrence" "occurrence-datatype-unknown" "occurrence-duplicate"
7 "occurrence-scope" "occurrence-scope-duplicate" "occurrence-scope-duplicate-merged"
8 "occurrence-resourcedata-uri" "occurrence-resourcedata-uri-relative"
9 "occurrence-resourceref" "occurrence-resourceref-relative" "merge-itemid-with-occurrences"))
10 (defun all-occurrences (map)
11 (loop for topic in (topic-map-topics map) append (topic-occurrences topic)))
12 (defun occurrence-current-p (map)
13 (and (mm-current-p map) (variant-reifier-current-p map)
14 (every (lambda (o)
15 (and (eq o (canonical-occurrence o))
16 (eq (occurrence-parent o) (canonical-topic (occurrence-parent o)))
17 (eq (occurrence-type o) (canonical-topic (occurrence-type o)))
18 (member o (topic-occurrences (occurrence-parent o)) :test #'eq)
19 (= (length (occurrence-scope o)) (length (remove-duplicates (occurrence-scope o) :test #'eq)))
20 (every (lambda (theme) (eq theme (canonical-topic theme))) (occurrence-scope o))))
21 (all-occurrences map))))
22 (defun occurrence-model (map)
23 (let ((topics (topic-map-topics map)))
24 (labels ((ref (topic) (1+ (position topic topics :test #'eq))))
25 (mm-fields "existingCharacteristics" (variant-reifier-model-data map)
26 "canonicalOccurrenceReferencesEQ" (if (occurrence-current-p map) :true :false)
27 "occurrenceCount" (length (all-occurrences map))
28 "occurrences" (coerce (loop for o in (all-occurrences map) collect
29 (mm-fields "parent" (ref (occurrence-parent o)) "type" (ref (occurrence-type o))
30 "scope" (coerce (mapcar #'ref (occurrence-scope o)) 'vector)
31 "value" (occurrence-value o) "datatype" (occurrence-datatype o)
32 "itemIdentifiers" (coerce (item-identifiers o) 'vector)
33 "reifier" (when (item-reifier o) (ref (item-reifier o))))) 'vector)))))
34 (defun occurrence-pure (label map)
35 (let* ((before (mm-state map)) (held (topic-maps.tmdm::map-information-items map))
36 (actual (mm-cxtm map)))
37 (check (concatenate 'string "occurrence:" label ":pure-deterministic-cxtm-and-handles")
38 (and (equalp actual (mm-cxtm map)) (equal before (mm-state map))
39 (occurrence-current-p map) (every (lambda (i) (eq i (topic-maps.tmdm::canonical-item i))) held)))
40 actual))
41 (defun occurrence-condition (c)
42 (when c
43 (let ((data (mm-condition c)))
44 (when (typep c 'topic-maps.tmdm::occurrence-error)
45 (setf (cdr (assoc "code" (topic-maps.test-foundation::json-object-members data) :test #'equal))
46 (string-downcase (string (topic-maps.tmdm::occurrence-error-code c)))))
47 data)))
48 (defun occurrence-observe (raw key)
49 ;; Observe real productive calls and retained native handles; return unchanged.
50 (let ((parser (symbol-function 'topic-maps.xml:parse-octets))
51 (reader (symbol-function 'topic-maps.xtm::read-occurrence))
52 (calls 0) (same nil) (held nil) (counts nil) (map nil))
53 (unwind-protect
54 (progn
55 (setf (symbol-function 'topic-maps.xml:parse-octets)
56 (lambda (input &rest args) (incf calls) (setf same (eq input raw)) (apply parser input args)))
57 (setf (symbol-function 'topic-maps.xtm::read-occurrence)
58 (lambda (node owner model)
59 (let ((o (funcall reader node owner model)))
60 (push o held) (push (length (all-occurrences model)) counts) o)))
61 (setf map (deserialize-octets raw :document-iri *document* :source-key key)))
62 (setf (symbol-function 'topic-maps.xml:parse-octets) parser
63 (symbol-function 'topic-maps.xtm::read-occurrence) reader))
64 (values map (nreverse held) (nreverse counts) calls same)))
65 (defun occurrence-handle-evidence (map held)
66 (mm-fields "readHandleCount" (length held)
67 "distinctReadHandles" (length (remove-duplicates held :test #'eq))
68 "canonicalGroupsInFinalMap" (coerce (mapcar (lambda (old)
69 (1+ (position (canonical-occurrence old) (all-occurrences map) :test #'eq))) held) 'vector)
70 "replacedReadHandles" (coerce (mapcar (lambda (old)
71 (if (eq old (canonical-occurrence old)) :false :true)) held) 'vector)))
72 (defun occurrence-original-model-checks (name map)
73 (let* ((owner (by-id map "topic")) (type (by-id map "occtype"))
74 (scoped (search "scope" name)) (merged (equal name "merge-itemid-with-occurrences"))
75 (uri (or (search "resourceref" name) (search "resourcedata-uri" name)))
76 (dtype (cond (uri (iri-datatype)) ((equal name "occurrence-datatype-unknown") "http://example.com/bogus") (t (string-datatype))))
77 (values (if merged '("Some data" "Some more data")
78 (list (cond ((search "relative" name) (mm-child-iri "photo.jpg"))
79 (uri "http://www.isotopicmaps.org/cxtm")
80 ((equal name "occurrence-datatype-unknown") "BOGUS") (t "Testing resource data."))))))
81 (check (concatenate 'string "occurrence-original:" name ":exact-native-properties")
82 (and (= (if scoped 3 2) (length (topic-map-topics map)))
83 (= (if merged 2 1) (length (all-occurrences map)))
84 (null (topic-map-associations map)) (null (name-reifier-names map)) (null (all-variants map))
85 (every (lambda (o) (and (eq owner (occurrence-parent o)) (eq type (occurrence-type o))
86 (scope-eq-p (occurrence-scope o) (when scoped (list (by-id map "english"))))
87 (equal dtype (occurrence-datatype o)) (member (occurrence-value o) values :test #'equal)
88 (null (item-identifiers o)) (null (item-reifier o)))) (all-occurrences map))
89 (same-identifiers-p values (mapcar #'occurrence-value (all-occurrences map)))
90 (equal (list (concatenate 'string *document* "#occtype")) (item-identifiers type))
91 (same-identifiers-p (item-identifiers owner)
92 (append (list (concatenate 'string *document* "#topic"))
93 (when merged (list (concatenate 'string *document* "#topic2") "http://example.org/#topic"))))
94 (null (item-identifiers map)) (null (item-reifier map))
95 (every (lambda (topic) (and (null (topic-subject-identifiers topic)) (null (topic-subject-locators topic))
96 (null (topic-reified topic)))) (topic-map-topics map)) (occurrence-current-p map)))
97 (when (equal name "occurrence-scope-duplicate-merged")
98 (check "occurrence-original:scope-merged:retained-II-and-EQ-theme"
99 (and (eq (by-id map "en") (by-id map "english"))
100 (same-identifiers-p (item-identifiers (by-id map "en"))
101 (list (concatenate 'string *document* "#en") (concatenate 'string *document* "#english"))))))))
102 (defun occurrence-original-contracts ()
103 (setf *occurrence-outputs* nil)
104 (dolist (name *occurrence-originals*)
105 (let* ((id (format nil "xtm2/in/~A.xtm" name))
106 (*document* (concatenate 'string "https://xtm-tests.example.invalid/cd165b150176c1d6842b37be9cc9051b40d4996b/" id))
107 (source (corpus-path id)) (baseline (corpus-path (format nil "xtm2/baseline/~A.xtm.cxtm" name)))
108 (raw (file-bytes source)) (copy (copy-seq raw)) (expected (file-bytes baseline))
109 (case (topic-maps.test-foundation:make-test-case :id id :category :valid :source-pathname source
110 :document-iri *document* :expected-outcome :cxtm-equal :expected-baseline baseline
111 :clauses '("XTM 2.0 4.13-4.17,4.20" "TMDM 5.6,6.2,6.5" "CXTM 3,4")))
112 (map nil) (actual nil) (c nil) (held nil) (counts nil) (calls 0) (same nil))
113 (check (concatenate 'string "occurrence-original:" name ":not-already-registered")
114 (null (find id *cases* :key #'topic-maps.test-foundation:test-case-id :test #'equal)))
115 (setf *cases* (append *cases* (list case)))
116 (handler-case
117 (progn
118 (multiple-value-setq (map held counts calls same) (occurrence-observe raw id))
119 (occurrence-original-model-checks name map)
120 (check (concatenate 'string "occurrence-original:" name ":original-octets-qualified-parser")
121 (and (= 1 calls) same (equalp copy raw)))
122 (check (concatenate 'string "occurrence-original:" name ":old-handles-canonical-and-live")
123 (every (lambda (old) (member (canonical-occurrence old) (all-occurrences map) :test #'eq)) held))
124 (when (member name '("occurrence-duplicate" "occurrence-scope-duplicate-merged") :test #'equal)
125 (check (concatenate 'string "occurrence-original:" name ":distinct-old-handles-normalized")
126 (and (= 2 (length held)) (not (eq (first held) (second held)))
127 (eq (canonical-occurrence (first held)) (canonical-occurrence (second held)))
128 (equal counts (if (equal name "occurrence-duplicate") '(1 1) '(1 2))))))
129 (setf actual (occurrence-pure name map))
130 (let ((other (deserialize-octets raw :document-iri *document* :source-key "independent:occurrence-original")))
131 (check (concatenate 'string "occurrence-original:" name ":source-key-independent")
132 (and (equalp (occurrence-model map) (occurrence-model other)) (equalp actual (mm-cxtm other))))))
133 (error (condition) (setf c condition)))
134 (record-original-result case actual expected c)
135 (push (mm-fields "id" id "documentIRI" *document* "sourceKey" id "sourceBytes" (length raw)
136 "sourceHex" (format nil "~{~2,'0X~}" (coerce raw 'list)) "sourceText" (babel:octets-to-string raw :encoding :utf-8)
137 "qualifiedParserCalls" calls "originalOctetsEQ" (if same :true :false)
138 "model" (when map (occurrence-model map)) "occurrenceCountsAfterEachRead" (coerce counts 'vector)
139 "retainedHandleEvidence" (when map (occurrence-handle-evidence map held))
140 "retainedReadHandles" (length held) "oldHandlesCanonicalAndLive" (if (and map (every (lambda (o) (member (canonical-occurrence o) (all-occurrences map) :test #'eq)) held)) :true :false)
141 "actualBytes" (when actual (length actual)) "expectedBytes" (length expected)
142 "actualCXTM" (when actual (babel:octets-to-string actual :encoding :utf-8)) "expectedCXTM" (babel:octets-to-string expected :encoding :utf-8)
143 "firstDifferentByte" (when actual (mismatch actual expected)) "condition" (occurrence-condition c)
144 "status" (string-downcase (string (topic-maps.test-foundation:test-case-status case)))) *occurrence-outputs*)
145 (when c (error c))
146 (check (concatenate 'string "occurrence-original:" name ":complete-original-CXTM-byte-exact") (equalp actual expected))))
147 (setf *occurrence-outputs* (nreverse *occurrence-outputs*))
148 (check "occurrence-originals:83-unique-cases-75-positive-eight-negative"
149 (and (= 83 (length *cases*)) (= 75 (count :valid *cases* :key #'topic-maps.test-foundation:test-case-category))
150 (= 83 (length (remove-duplicates *cases* :key #'topic-maps.test-foundation:test-case-id :test #'equal))))))
151 (defun occurrence-xml (resource &key (type "t") scope)
152 (format nil "<occurrence><type><topicRef href='#~A'/></type>~A~A</occurrence>" type
153 (if scope (scope-xml scope) "") resource))
154 (defun occurrence-control (label body verify)
155 (let* ((raw (bytes (document body))) (copy (copy-seq raw)) (map nil) (held nil) (counts nil) (calls nil) (same nil))
156 (multiple-value-setq (map held counts calls same) (occurrence-observe raw label))
157 (funcall verify map held counts)
158 (let ((actual (occurrence-pure label map)))
159 (check (concatenate 'string "occurrence:" label ":qualified-parser-source-preserved")
160 (and same (= 1 calls) (equalp raw copy)))
161 (push (mm-fields "label" label "sourceText" (document body) "model" (occurrence-model map)
162 "actualCXTM" (babel:octets-to-string actual :encoding :utf-8) "condition" nil
163 "occurrenceCountsAfterEachRead" (coerce counts 'vector) "retainedReadHandles" (length held)
164 "retainedHandleEvidence" (occurrence-handle-evidence map held)) *occurrence-controls*))))
165 (defun occurrence-value-controls ()
166 (dolist (row (list (list "default" "<resourceData> V &amp; 馬🦊 </resourceData>" " V & 馬🦊 " (string-datatype))
167 (list "whitespace" "<resourceData> &#x9;A&#xA; </resourceData>" (format nil " ~CA~% " #\Tab) (string-datatype))
168 (list "empty" "<resourceData/>" "" (string-datatype))
169 (list "custom" "<resourceData datatype='urn:custom'>literal%GG</resourceData>" "literal%GG" "urn:custom")
170 (list "integer-lexical" (datatype-resource (integer-datatype) "+00042") "+00042" (integer-datatype))
171 (list "uri-relative" (datatype-resource (iri-datatype) "../photo") (mm-child-iri "../photo") (iri-datatype))
172 (list "ref-relative" "<resourceRef href='../photo'/>" (mm-child-iri "../photo") (iri-datatype))
173 (list "ref-absolute" "<resourceRef href='urn:photo'/>" "urn:photo" (iri-datatype))))
174 (destructuring-bind (label resource value dtype) row
175 (occurrence-control label (format nil "<topic id='a'>~A</topic><topic id='t'/><topic id='s'/>"
176 (occurrence-xml resource :scope '("s" "s")))
177 (lambda (map held counts) (declare (ignore held counts))
178 (let ((o (first (all-occurrences map))))
179 (check (concatenate 'string "occurrence:" label ":exact-value-datatype-forward-references")
180 (and (= 3 (length (topic-map-topics map))) (= 1 (length (all-occurrences map)))
181 (eq (by-id map "a") (occurrence-parent o)) (eq (by-id map "t") (occurrence-type o))
182 (scope-eq-p (list (by-id map "s")) (occurrence-scope o))
183 (equal value (occurrence-value o)) (equal dtype (occurrence-datatype o)))))))))
184 (let* ((resource "<resourceData datatype='urn:type'>V</resourceData>")
185 (base (occurrence-xml resource :scope '("s"))))
186 (occurrence-control "equality-discriminators"
187 (format nil "<topic id='a'>~A~A~A~A~A~A</topic><topic id='b'>~A</topic>" base base
188 (occurrence-xml "<resourceData datatype='urn:type'>W</resourceData>" :scope '("s"))
189 (occurrence-xml "<resourceData datatype='urn:other'>V</resourceData>" :scope '("s"))
190 (occurrence-xml resource :type "u" :scope '("s")) (occurrence-xml resource :scope '("z")) base)
191 (lambda (map held counts) (declare (ignore counts))
192 (check "occurrence:equality-complete-parent-type-scope-value-datatype"
193 (and (= 6 (length (all-occurrences map))) (= 5 (length (topic-occurrences (by-id map "a"))))
194 (= 1 (length (topic-occurrences (by-id map "b")))) (= 7 (length held))
195 (not (eq (first held) (second held))) (eq (canonical-occurrence (first held)) (canonical-occurrence (second held)))))))))
196 (defun occurrence-merge-controls ()
197 (dolist (kind '("subjectIdentifier" "subjectLocator" "itemIdentity"))
198 (dolist (dimension '("parent" "type" "scope"))
199 (let* ((resource "<resourceData>V</resourceData>")
200 (a (if (equal dimension "parent") "a" "x")) (b (if (equal dimension "parent") "b" "y"))
201 (first (occurrence-xml resource :type (if (equal dimension "type") "x" "t") :scope (if (equal dimension "scope") '("x") '("s"))))
202 (second (occurrence-xml resource :type (if (equal dimension "type") "y" "t") :scope (if (equal dimension "scope") '("y") '("s"))))
203 (body (concatenate 'string
204 (if (equal dimension "parent") (format nil "<topic id='a'>~A</topic><topic id='b'>~A</topic>" first second)
205 (format nil "<topic id='a'>~A~A</topic>" first second))
206 (format nil "<topic id='alias1'><itemIdentity href='#~A'/><~A href='urn:shared'/></topic><topic id='alias2'><itemIdentity href='#~A'/><~A href='urn:shared'/></topic>" a kind b kind))))
207 (occurrence-control (format nil "merge-~A-~A" dimension kind) body
208 (lambda (map held counts)
209 (check (format nil "occurrence:merge-~A-~A:two-before-one-after-old-handles-EQ" dimension kind)
210 (and (equal '(1 2) counts) (= 1 (length (all-occurrences map))) (= 2 (length held))
211 (not (eq (first held) (second held)))
212 (eq (canonical-occurrence (first held)) (canonical-occurrence (second held)))
213 (not (eq (first held) (canonical-occurrence (first held))))
214 (not (eq (second held) (canonical-occurrence (second held))))
215 (eq (by-id map a) (by-id map b)) (eq (by-id map "alias1") (by-id map "alias2")))))))))
216 (occurrence-control "other-characteristics-preserved"
217 (format nil "<topic id='a'><instanceOf><topicRef href='#class'/></instanceOf><name><value>N</value><variant><scope><topicRef href='#vscope'/></scope><resourceData>V</resourceData></variant></name>~A</topic>"
218 (occurrence-xml "<resourceData>O</resourceData>"))
219 (lambda (map held counts) (declare (ignore held counts))
220 (check "occurrence:existing-names-variants-core-associations-preserved"
221 (and (= 1 (length (all-occurrences map))) (= 1 (length (name-reifier-names map)))
222 (= 1 (length (all-variants map))) (= 1 (length (topic-map-associations map)))
223 (= 2 (length (association-roles (first (topic-map-associations map)))))
224 (equal "N" (topic-name-value (first (topic-names (by-id map "a")))))
225 (equal "V" (variant-value (first (all-variants map)))))))))
226 (defun occurrence-negative-controls ()
227 (dolist (spec
228 '(("missing-type" "<occurrence><resourceData>V</resourceData></occurrence>" xtm-rejection :missing-occurrence-type)
229 ("missing-resource" "<occurrence><type><topicRef href='#t'/></type></occurrence>" xtm-rejection :missing-occurrence-resource)
230 ("two-resources" "<occurrence><type><topicRef href='#t'/></type><resourceData>V</resourceData><resourceRef href='urn:v'/></occurrence>" xtm-rejection :occurrence-resource-cardinality)
231 ("two-types" "<occurrence><type><topicRef href='#t'/></type><type><topicRef href='#u'/></type><resourceData>V</resourceData></occurrence>" xtm-rejection :duplicate-occurrence-type)
232 ("empty-type" "<occurrence><type/><resourceData>V</resourceData></occurrence>" xtm-rejection :type-cardinality)
233 ("two-type-refs" "<occurrence><type><topicRef href='#t'/><topicRef href='#u'/></type><resourceData>V</resourceData></occurrence>" xtm-rejection :type-cardinality)
234 ("bad-type-ref" "<occurrence><type><topicRef href='t'/></type><resourceData>V</resourceData></occurrence>" xtm-rejection :invalid-topic-ref)
235 ("empty-scope" "<occurrence><type><topicRef href='#t'/></type><scope/><resourceData>V</resourceData></occurrence>" xtm-rejection :empty-scope)
236 ("bad-scope-ref" "<occurrence><type><topicRef href='#t'/></type><scope><topicRef href='#2bad'/></scope><resourceData>V</resourceData></occurrence>" xtm-rejection :invalid-topic-ref)
237 ("two-scopes" "<occurrence><type><topicRef href='#t'/></type><scope><topicRef href='#s'/></scope><scope><topicRef href='#s'/></scope><resourceData>V</resourceData></occurrence>" xtm-rejection :duplicate-occurrence-scope)
238 ("wrong-order" "<occurrence><type><topicRef href='#t'/></type><resourceData>V</resourceData><scope><topicRef href='#s'/></scope></occurrence>" xtm-rejection :element-order)
239 ("early-scope" "<occurrence><scope><topicRef href='#s'/></scope><type><topicRef href='#t'/></type><resourceData>V</resourceData></occurrence>" xtm-rejection :missing-occurrence-type)
240 ("bad-child" "<occurrence><wrong/></occurrence>" xtm-rejection :unexpected-element)
241 ("foreign-namespace" "<occurrence xmlns='urn:foreign'/>" xtm-rejection :invalid-namespace)
242 ("bad-attribute" "<occurrence bogus='x'/>" xtm-rejection :unexpected-attribute)
243 ("text-child" "<occurrence>unexpected</occurrence>" xtm-rejection :unexpected-text)
244 ("relative-datatype" "<occurrence><type><topicRef href='#t'/></type><resourceData datatype='relative'>V</resourceData></occurrence>" xtm-rejection :invalid-resource-data-datatype)
245 ("embedded-without-anyType" "<occurrence><type><topicRef href='#t'/></type><resourceData><x xmlns='urn:xml'/></resourceData></occurrence>" xtm-rejection :unexpected-child)
246 ("anyType-text" "<occurrence><type><topicRef href='#t'/></type><resourceData datatype='http://www.w3.org/2001/XMLSchema#anyType'>V</resourceData></occurrence>" xtm-unsupported :resource-data-datatype)
247 ("anyType-XML" "<occurrence><type><topicRef href='#t'/></type><resourceData datatype='http://www.w3.org/2001/XMLSchema#anyType'><x xmlns='urn:xml'/></resourceData></occurrence>" xtm-unsupported :resource-data-datatype)
248 ("item-identity" "<occurrence><itemIdentity href='urn:o'/><type><topicRef href='#t'/></type><resourceData>V</resourceData></occurrence>" xtm-unsupported :unsupported-construct)
249 ("reification" "<occurrence reifier='#r'><type><topicRef href='#t'/></type><resourceData>V</resourceData></occurrence>" xtm-unsupported :unsupported-construct)))
250 (destructuring-bind (label body class code) spec
251 (let* ((key (concatenate 'string "occurrence-negative:" label))
252 (c (condition-from (lambda () (deserialize-octets (bytes (document (format nil "<topic id='a'>~A</topic>" body)))
253 :document-iri *document* :source-key key)))))
254 (check (concatenate 'string key ":actual-class-code-context-position")
255 (and (eq (type-of c) class) (eq code (error-code c)) (equal *document* (error-document-iri c))
256 (equal key (error-source-key c)) (plusp (error-line c)) (plusp (error-column c))))
257 (push (mm-fields "label" key "sourceText" (document (format nil "<topic id='a'>~A</topic>" body)) "condition" (occurrence-condition c)) *occurrence-controls*))))
258 (dolist (body '("<occurrence/>" "<topic id='a'><name><value>N</value><occurrence/></name></topic>"))
259 (let ((c (condition-from (lambda () (read-body body)))))
260 (check (concatenate 'string "occurrence-negative:invalid-parent-context:" body) (and (typep c 'xtm-rejection) (eq :unexpected-element (error-code c))))
261 (push (mm-fields "label" "invalid-parent-context" "sourceText" (document body) "condition" (occurrence-condition c)) *occurrence-controls*)))
262 (let ((c (condition-from (lambda () (deserialize-octets (bytes "<a><b></a>") :document-iri *document* :source-key "occurrence:XML")))))
263 (check "occurrence-negative:real-XML-error" (and (typep c 'xtm-xml-error) (eq :xml-not-well-formed (error-code c))))
264 (push (mm-fields "label" "real-XML-error" "sourceText" "<a><b></a>" "condition" (occurrence-condition c)) *occurrence-controls*))
265 (dolist (body (list
266 (format nil "<topic id='a'>~A</topic>" (occurrence-xml (datatype-resource (integer-datatype) "bad")))
267 (format nil "<itemIdentity href='#t'/><topic id='a'>~A</topic>" (occurrence-xml "<resourceData>V</resourceData>"))))
268 (let ((c (condition-from (lambda () (read-body body)))))
269 (check (if (search "bad" body) "occurrence-negative:native-invalid-integer" "occurrence-negative:native-type-identifier-conflict")
270 (if (search "bad" body)
271 (and (typep c 'topic-maps.tmdm::occurrence-error) (eq :invalid-integer-value (topic-maps.tmdm::occurrence-error-code c)))
272 (and (typep c 'item-identifier-error) (eq :duplicate-item-identifier (item-identifier-error-code c)))))
273 (push (mm-fields "label" "occurrence-native-conflict" "sourceText" (document body) "condition" (occurrence-condition c)) *occurrence-controls*))))
274 (defun occurrence-tests ()
275 (setf *occurrence-controls* nil)
276 (occurrence-value-controls) (occurrence-merge-controls) (occurrence-negative-controls)
277 (setf *occurrence-controls* (nreverse *occurrence-controls*)))