]>
dreyeck.freedombox.rocks Git - topic-maps.git/blob - reports/slice-22a/build-matrix.py
2 """Join reviewed capability annotations with existing reports and original bytes.
3 Documentary analysis only: no reader implementation, test system or registration.
6 from collections
import Counter
9 from pathlib
import Path
11 import xml
. etree
. ElementTree
as ET
13 ROOT
= Path ( __file__
). resolve (). parents
[ 2 ]
14 PIN
= 'cd165b150176c1d6842b37be9cc9051b40d4996b'
16 'CTM' : { 'edition' : 'ISO/IEC 13250-6:2010' , 'url' : 'https://www.isotopicmaps.org/ctm/ctm.html' ,
17 'evidenceLimit' : 'Public HTML mirror; published 2010 preview confirms through 3.4.2, not full 3.9/3.14-3.16. Corpus targets draft 2010-03-31.' },
18 'XTM' : { 'edition' : 'ISO/IEC 13250-3:2007 / XTM 2.0' , 'url' : 'https://www.isotopicmaps.org/sam/sam-xtm/' ,
19 'evidenceLimit' : '2006-06-19 public mirror explicitly states identity with published standard; ISO publication remains authoritative.' },
20 'TMDM' : { 'edition' : 'ISO/IEC 13250-2:2006' , 'url' : 'https://www.isotopicmaps.org/sam/sam-model/2006-06-18/' ,
21 'evidenceLimit' : 'Mirror states identity with publication; model has no standalone processor conformance section (1).' },
22 'CXTM' : { 'edition' : 'ISO/IEC 13250-4:2009' , 'url' : 'https://www.isotopicmaps.org/cxtm/cxtm.html' ,
23 'evidenceLimit' : 'Public 2009-01-27 mirror; final edition/errata equivalence is a closure review obligation.' },
24 'XSD' : { 'edition' : 'XML Schema 1.0 Part 2, Second Edition, 2004-10-28' ,
25 'url' : 'https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/' , 'evidenceLimit' : 'Dated primary W3C Recommendation; no substitution of XSD 1.1.' },
26 'CTM-published-preview' : { 'edition' : 'ISO/IEC 13250-6:2010(E), first edition 2010-11-15, 11-page preview' ,
27 'url' : 'https://cdn.standards.iteh.ai/samples/43940/6663ee28c1604551ac6adc02e22c6bb6/ISO-IEC-13250-6-2010.pdf' ,
28 'evidenceLimit' : 'Public published sample inspected online only; later clauses/complete grammar unavailable in preview. No local download.' }}
31 'registration' : ( 'Bereits bytegenau beobachtet; Registrierung fehlt' , '22B' ),
32 'text-datatype' : ( 'Textuelles resourceData mit beliebiger absoluter Datentyp-IRI' , '22D' ),
33 'occurrence' : ( 'Occurrences: Parent, Type, Scope, Resource, II, Reification, Merging' , '22E' ),
34 'association-role' : ( 'Explizite Associations/Roles: Type, Player, Scope, II, Merging' , '22F' ),
35 'association-reification' : ( 'Reification kanonischer Associations/Roles' , '22G' ),
36 'mergemap' : ( 'XTM mergeMap: endlicher Resolver, Dokumentidentität, Import, Zyklen' , '22H' ),
37 'ctm-tail-grammar' : ( 'Norm-/Qualifikationsentscheidung zum unmarkierten SI-Template-Tail' , '22C' ),
38 'ctm-include' : ( 'Normentscheidung zu Include-Umgebung und erhaltenen Identifiern' , '22C' ),
39 'ctm-datetime' : ( 'Normativ begründete DateTime-Baseline-Abweichung abschließen' , '22C' )}
42 def load ( path
): return json
. loads ( path
. read_text ())
43 def sha ( path
): return hashlib
. sha256 ( path
. read_bytes ()). hexdigest ()
44 def save ( path
, value
): path
. write_text ( json
. dumps ( value
, indent
= 2 , ensure_ascii
= False ) + ' \n ' )
45 def local ( tag
): return tag
. rsplit ( '}' , 1 )[- 1 ]
47 return { 'element' : local ( node
. tag
), 'attributes' : dict ( node
. attrib
), 'text' : node
. text
or '' ,
48 'children' : [ tree ( c
) for c
in node
]}
50 raw
= path
. read_bytes ()
51 return { 'path' : str ( path
. relative_to ( ROOT
)), 'bytes' : len ( raw
), 'sha256' : sha ( path
),
52 'hex' : raw
. hex (), 'text' : raw
. decode ( 'utf-8' )}
53 def reference ( key
, clauses
): return dict ( standard
= key
, clauses
= clauses
, ** NORMS
[ key
])
54 def expected_model ( path
):
55 node
= ET
. fromstring ( path
. read_bytes ())
56 return { 'evidence' : 'unchanged legacy CXTM baseline, not independent normative authority' ,
57 'elementCounts' : dict ( Counter ( local ( n
. tag
) for n
in node
. iter ())), 'xmlTree' : tree ( node
)}
60 def xtm_features ( source
):
61 node
= ET
. fromstring ( source
. read_bytes ())
62 elements
= list ( node
. iter ())
63 names
= [ local ( n
. tag
) for n
in elements
]
64 reifiers
= [{ 'element' : local ( n
. tag
), 'iri' : n
. get ( 'reifier' )} for n
in elements
if n
. get ( 'reifier' ) is not None ]
66 for tag
, capability
in [( 'occurrence' , 'occurrence' ), ( 'association' , 'association-role' ), ( 'role' , 'association-role' )]:
67 if tag
in names
and capability
not in required
: required
. append ( capability
)
68 for name
in sorted ({ r
[ 'element' ] for r
in reifiers
}): required
. append ( name
+ '-reification' )
69 if 'itemIdentity' in names
: required
. append ( 'native-item-identifiers-and-normalization' )
70 if 'scope' in names
: required
. append ( 'canonical-scope-set-and-reference-merging' )
71 if 'resourceRef' in names
: required
. append ( 'resource-IRI-resolution' )
72 datatypes
= [ n
. get ( 'datatype' , 'http://www.w3.org/2001/XMLSchema#string' ) for n
in elements
if local ( n
. tag
) == 'resourceData' ]
73 if 'http://example.com/bogus' in datatypes
: required
. append ( 'text-datatype' )
74 if 'mergeMap' in names
: required
. append ( 'mergemap' )
75 return { 'elementCounts' : dict ( Counter ( names
)), 'reifiers' : reifiers
, 'datatypes' : datatypes
,
76 'resourceReferences' : [ n
. get ( 'href' ) for n
in elements
if local ( n
. tag
) == 'resourceRef' ],
77 'topicReferences' : [ n
. get ( 'href' ) for n
in elements
if local ( n
. tag
) == 'topicRef' ],
78 'sourceTree' : tree ( node
), 'requiredCapabilities' : required
}
81 def xtm_annotation ( id , f
):
82 names
= f
[ 'elementCounts' ]; rs
= { r
[ 'element' ] for r
in f
[ 'reifiers' ]}
83 negative
= '/invalid/' in id
84 if id == 'xtm2/in/variant-duplicate-reifier2.xtm' : group
= 'registration'
85 elif 'mergeMap' in names
: group
= 'mergemap'
86 elif 'occurrence' in names
: group
= 'occurrence'
87 elif 'association' in rs
or 'role' in rs
: group
= 'association-reification'
88 elif 'association' in names
: group
= 'association-role'
90 assert id == 'xtm2/in/variant-datatype-unknown.xtm'
91 group
= 'text-datatype'
92 clauses
= [ '4.2' , '4.3.1-4.3.4' ]
93 model_clauses
= [ '5.1' , '5.2' , '5.3' , '6.2' ]
94 if 'topicRef' in names
: clauses
. append ( '4.20' )
95 if 'scope' in names
: clauses
. append ( '4.13' )
96 if 'type' in names
: clauses
. append ( '4.14' )
97 if 'occurrence' in names
: clauses
. append ( '4.15' ); model_clauses
+= [ '5.6' , '6.5' ]
98 if 'variant' in names
: clauses
. append ( '4.12' ); model_clauses
+= [ '5.5' , '6.4' ]
99 if 'resourceData' in names
: clauses
. append ( '4.16.1-4.16.2' )
100 if 'resourceRef' in names
: clauses
. append ( '4.17' )
101 if 'association' in names
: clauses
+= [ '4.18' , '4.19' ]; model_clauses
+= [ '5.7' , '5.8' , '6.6' , '6.7' ]
102 if 'itemIdentity' in names
: clauses
. append ( '4.6' )
103 if group
== 'mergemap' : clauses
. append ( '4.21' )
105 'registration' : [ 'existing-qualified-variant-reification' ],
106 'text-datatype' : [ 'existing-qualified-XML-and-resourceData-string-path' ],
107 'occurrence' : [ 'existing-native-add-occurrence-canonical-occurrence-II-reifier-APIs' ],
108 'association-role' : [ 'existing-native-make-association-and-canonical-association-role-APIs' ],
109 'association-reification' : [ '22F' , 'existing-native-II-only-reifier-resolution' ],
110 'mergemap' : [ '22C:map-metadata-and-cycle-decisions' , 'existing-qualified-XML-and-native-import-map-content' ]
112 if group
== 'occurrence' and 'text-datatype' in f
[ 'requiredCapabilities' ]: deps
+= [ '22D' ]
113 classification
= 'already-observed-unregistered' if group
== 'registration' else 'missing-language-capability'
115 issue
= 'Normstellen geprüft; Originalmodell und Originalvergleich erst nach Implementierung zu qualifizieren.'
116 if id == 'xtm2/in/mergemap-itemid.xtm' :
117 classification
= 'normative-conflict' ; decision
= 'C'
118 issue
= 'Vorläufiger Konflikt: Baseline überträgt Quell-Map-II, 4.21 nennt nur Topics/Associations; endgültige Norm-/Errataentscheidung offen. Keine Zusage eines PASS.'
119 elif id == 'xtm2/in/mergemap-loop.xtm' :
120 classification
= 'unresolved-requirement' ; decision
= 'C'
121 issue
= 'Positive Baseline fordert Terminierung mit beiden Dokumenten. Explizite Zyklus-/Cache-Semantik im geprüften Text nicht angegeben; Profilentscheidung/Primärbeleg erforderlich.'
122 elif group
== 'registration' : issue
= 'Erneut ausgeführt und 702/702 Bytes gleich; native Beziehungen geprüft; Case Record bleibt NOT-RUN.'
124 if id == 'xtm2/invalid/reifier-collision.xtm' :
125 intended
= { 'cause' : 'Dasselbe #reifier-Topic reifiziert Map und Occurrence, also verschiedene Items.' ,
126 'requiredCondition' : 'REIFICATION-ERROR' , 'requiredCode' : 'reifier-conflict' ,
127 'currentlyReached' : False , 'evidence' : 'Original-Attributwerte und Kommentar; TMDM 5.3.5 / 6.2.' }
128 elif id == 'xtm2/invalid/role-duplicate-reified.xtm' :
129 intended
= { 'cause' : 'Gleicher Role-Type/Player und Reifier bei ungleichen Association-Parents (#assoctype vs #assoctype2). Rollen sind nicht gleich.' ,
130 'requiredCondition' : 'REIFICATION-ERROR' , 'requiredCode' : 'reifier-conflict' ,
131 'currentlyReached' : False , 'evidence' : 'Originalkommentar sowie TMDM 5.8 (Parent in Gleichheit), 5.3.5 / 6.2.' }
132 elif id == 'xtm2/invalid/topicref-no-fragment-id.xtm' :
133 intended
= { 'cause' : 'Association-Scope topicRef href="scopingtopic" hat keinen Shorthand-Fragment-Identifier.' ,
134 'requiredCondition' : 'XTM-REJECTION' , 'requiredCode' : 'invalid-topic-ref' ,
135 'currentlyReached' : False , 'evidence' : 'Originalkommentar, XTM 4.13 / 4.20.' }
136 return { 'family' : group
, 'familyDescription' : FAMILIES
[ group
][ 0 ], 'primaryClassification' : classification
,
137 'normativeDecisionABC' : decision
, 'normativeJustificationStatus' : issue
,
138 'normativeReferences' : [ reference ( 'XTM' , clauses
), reference ( 'TMDM' , model_clauses
), reference ( 'CXTM' , [ '3-4' ])],
139 'missingCapability' : FAMILIES
[ group
][ 0 ] if group
!= 'registration' else 'Nur dauerhafte Originalregistrierung; keine Produktionsänderung.' ,
140 'dependencies' : deps
, 'proposedSlice' : FAMILIES
[ group
][ 1 ], 'intendedNegativeCause' : intended
,
141 'forecastIsNotExecutedPASS' : True , 'expectedOutcome' : 'qualified-rejection' if negative
else 'byte-exact-CXTM' }
144 def ctm_annotation ( case
, obs
, detailed
):
145 id = case
[ 'id' ]; negative
= case
[ 'category' ] == 'invalid'
146 if '/template-' in id :
147 group
= 'ctm-tail-grammar' ; decision
= 'C' ; category
= 'normative-conflict'
148 refs
= [ reference ( 'CTM' , [ '3.3.5 [12]' , '3.3.6 [13],[17]-[19]' , '3.3.7 [20]-[21]' , '3.4 [28]' , '3.8 [49]' , '3.9 [50]-[52]' , '3.14 [63]-[67]' , '3.15 [68]-[70]' ])]
149 missing
= 'Keine belegte fehlende Normfähigkeit: Variable im unmarkierten zusätzlichen SI-Slot ist in der geprüften Ableitung nicht vorgesehen.'
150 status
= 'HTML-Ableitung [50]→[51]→[52]→[17]→[12] geprüft; vollständigen veröffentlichten Grammatiktext abgleichen, keine stillschweigende Erweiterung.'
151 proposed
= '22C: Striktes Profil bestätigen; positive Korpusabweichung begründet ausweisen. Negativen Originalen keinen argumentbezogenen PASS geben, solange die vorgesehene Substitutionsprüfung nicht erreicht ist.'
153 status
+= ' Die frühe Body-Syntaxablehnung ist keine erreichte Prüfung des markierten Arguments.'
154 proposed
+= ' Alternative normative Grammatik-Ablehnung nur nach ausdrücklich geänderter Qualifikationsentscheidung; gültige Kontextgegenprobe separat, kein Ersatzoriginal.'
155 elif '/include-' in id :
156 group
= 'ctm-include' ; decision
= 'C' ; category
= 'unresolved-requirement'
157 refs
= [ reference ( 'CTM' , [ '3.2' , '3.3.6' , '3.3.8' , '3.14-3.15' , '3.16.2' ]), reference ( 'TMDM' , [ '5-6' ]), reference ( 'CXTM' , [ '3.13' , '3.17-3.18' ])]
158 missing
= 'Keine nachgewiesene fehlende Fähigkeit; bestehende Umgebung-/Alias-Auslegung gegen maßgeblichen vollständigen Normtext entscheiden.'
159 status
= 'B nach bisheriger Mirror-Auslegung plausibel; formaler Abschluss C, weil veröffentlichte spätere CTM-Klauseln hier nicht vollständig primär verifiziert sind.'
160 proposed
= '22C: unverändert FAIL; vollständige Primärfassung/Errata beschaffen lassen und A/B entscheiden. Nur bei nachgewiesenem A eine gesondert freigegebene minimale Korrektur planen.'
162 assert '/occurrence-datetime' in id
163 group
= 'ctm-datetime' ; decision
= 'B' ; category
= 'normative-conflict'
164 refs
= [ reference ( 'CTM-published-preview' , [ '3.4.1 (printed p.5)' ]), reference ( 'XSD' , [ '3.2.7.1-3.2.7.3' , 'D.1' ]), reference ( 'CXTM' , [ '3.16' , '4.9' ]), reference ( 'TMDM' , [ '4.3-4.4' , '5.6' , '6.5' ])]
165 missing
= 'Keine Reader-Erweiterung zur Nachbildung der Baseline; qualifizierten Baseline-Konflikt abschließen.'
166 status
= 'B durch untersuchte XSD-1.0-/CXTM-Regeln gestützt; öffentliche CXTM-Fassung/Errata im abschließenden Editionsreview bestätigen.'
167 proposed
= '22C: aktuellen Wert erhalten, FAIL und Normabweichung ausweisen; niemals Originalbaseline oder fallabhängige Ausgabe anpassen.'
168 negative_intent
= None
170 marker
= '^' if 'item-identifier' in id else '='
171 number
= 2 if '2nd-arg' in id else 1
172 negative_intent
= { 'argumentPosition' : number
, 'marker' : marker
,
173 'cause' : f
'Argument {number} mit {marker} ist für den beabsichtigten unmarkierten SI-Verwendungskontext ungeeignet.' ,
174 'currentlyReached' : False , 'actualBlockingCause' : 'INVALID-TEMPLATE-BODY/:template-identity-tail' ,
175 'evidence' : 'Originalkörper und markiertes Argument; bei 2nd-arg Originalkommentar valid/invalid.' }
176 return { 'family' : group
, 'familyDescription' : FAMILIES
[ group
][ 0 ], 'primaryClassification' : category
,
177 'normativeDecisionABC' : decision
, 'normativeJustificationStatus' : status
, 'normativeReferences' : refs
,
178 'missingCapability' : missing
, 'dependencies' : [ '22C:authoritative-edition-and-qualification-decision' ],
179 'proposedSlice' : '22C' , 'proposedDecision' : proposed
, 'intendedNegativeCause' : negative_intent
,
180 'templateAnalysis' : ({ k
: detailed
[ k
] for k
in [ 'variables' , 'declaration' , 'bindings' , 'invocations' ] if k
in detailed
} if detailed
else None ),
181 'forecastIsNotExecutedPASS' : True }
184 def make_matrix ( baseline
, observations
):
185 ctm
= load ( baseline
/ 'ctm.validation.json' ); xtm
= load ( baseline
/ 'xtm.json' )
186 assert ctm
== load ( ROOT
/ 'reports/slice-21o/ctm.validation.json' )
187 assert xtm
== load ( ROOT
/ 'reports/slice-21o/xtm.json' )
188 registered
= { c
[ 'id' ]: c
for c
in xtm
[ 'cases' ]}
189 diagnostics
= { c
[ 'id' ]: c
for c
in load ( baseline
/ 'after-diagnostics.json' )}
190 actual_ctm
= { c
[ 'id' ]: c
for c
in load ( observations
/ 'ctm-observations.json' )[ 'cases' ]}
191 old_templates
= { c
[ 'id' ]: c
for c
in load ( ROOT
/ 'reports/slice-20j/slice20i/detailed-inventory.json' )[ 'cases' ]}
192 controls
= load ( observations
/ 'controls.json' )
194 for c
in ctm
[ 'cases' ]:
195 if c
[ 'status' ] == 'pass' : continue
196 id = c
[ 'id' ]; obs
= actual_ctm
[ id ]; source
= ROOT
/ 'vendor/cxtm' / id
197 assert bytes
. fromhex ( obs
[ 'sourceHex' ]) == source
. read_bytes ()
198 d
= old_templates
. get ( id )
200 assert sha ( source
) == d
[ 'sourceSHA256' ] and obs
[ 'condition' ] == d
[ 'condition' ]
201 baseline_path
= ROOT
/ 'vendor/cxtm' / c
[ 'expectedCXTM' ] if c
[ 'expectedCXTM' ] else None
202 ann
= ctm_annotation ( c
, obs
, d
)
203 row
= { 'id' : id , 'corpus' : 'CTM' , 'normVersion' : NORMS
[ 'CTM' ][ 'edition' ],
204 'corpusVersion' : 'CTM draft 2010-03-31, pin ' + PIN
,
205 'category' : c
[ 'category' ], 'registeredStatus' : c
[ 'status' ], 'caseRecord' : c
,
206 'source' : original ( source
), 'documentIRI' : c
[ 'documentIRI' ], 'condition' : obs
[ 'condition' ],
207 'expected' : { 'outcome' : c
[ 'expectedOutcome' ], 'baseline' : original ( baseline_path
) if baseline_path
else None ,
208 'baselineModel' : expected_model ( baseline_path
) if baseline_path
else None },
209 'observation' : obs
, ** ann
}
210 if d
and d
. get ( 'expandedControl' ):
211 expanded
= next ( x
for x
in controls
if x
[ 'originalControlOnly' ] == id )
212 assert expanded
== d
[ 'expandedControl' ]
213 row
[ 'expandedControl' ] = expanded
215 xtm_catalog
= sorted ([* ( ROOT
/ 'vendor/cxtm/xtm2/in' ). glob ( '*.xtm' ), * ( ROOT
/ 'vendor/cxtm/xtm2/invalid' ). glob ( '*.xtm' )])
216 assert len ( xtm_catalog
) == 124
217 for source
in xtm_catalog
:
218 id = str ( source
. relative_to ( ROOT
/ 'vendor/cxtm' ))
219 if id in registered
: continue
220 negative
= '/invalid/' in id
221 baseline_path
= None if negative
else ROOT
/ 'vendor/cxtm/xtm2/baseline' /( source
. name
+ '.cxtm' )
222 f
= xtm_features ( source
); obs
= diagnostics
[ id ]; ann
= xtm_annotation ( id , f
)
223 row
= { 'id' : id , 'corpus' : 'XTM 2.0' , 'normVersion' : NORMS
[ 'XTM' ][ 'edition' ],
224 'corpusVersion' : PIN
, 'category' : 'invalid' if negative
else 'valid' , 'registeredStatus' : 'not-run' ,
225 'caseRecord' : None , 'caseRecordProvenance' : 'Current registered IDs subtracted from exact 124-file original inventory; not a newly registered Case Record.' ,
226 'source' : original ( source
), 'documentIRI' : obs
[ 'documentIRI' ], 'condition' : obs
[ 'condition' ],
227 'expected' : { 'outcome' : 'xtm-rejection' if negative
else 'cxtm-equal' ,
228 'baseline' : original ( baseline_path
) if baseline_path
else None ,
229 'baselineModel' : expected_model ( baseline_path
) if baseline_path
else None },
230 'sourceFeatures' : f
, 'observation' : obs
, ** ann
}
231 if ann
[ 'family' ] == 'registration' :
232 further
= load ( baseline
/ 'further-variant-reification.json' )
233 assert further
[ 'id' ] == id and not further
[ 'registered' ] and further
[ 'byteExact' ]
234 row
[ 'nativeModelObservation' ] = further
235 if ann
[ 'family' ] == 'mergemap' :
236 child
= source
. parent
/ next ( n
. get ( 'href' ) for n
in ET
. fromstring ( source
. read_bytes ()). iter () if local ( n
. tag
) == 'mergeMap' )
237 row
[ 'auxiliarySource' ] = original ( child
)
238 refs
= [ n
. get ( 'href' ) for n
in ET
. fromstring ( child
. read_bytes ()). iter () if local ( n
. tag
) == 'mergeMap' ]
239 row
[ 'auxiliaryMergeMapReferences' ] = refs
240 row
[ 'referencesRootAgain' ] = source
. name
in refs
242 rows
. sort ( key
= lambda c
: c
[ 'id' ])
243 assert len ( rows
) == len ({ c
[ 'id' ] for c
in rows
}) == 65
244 assert Counter ( c
[ 'corpus' ] for c
in rows
) == { 'CTM' : 11 , 'XTM 2.0' : 54 }
245 assert Counter ( c
[ 'registeredStatus' ] for c
in rows
) == { 'fail' : 4 , 'not-run' : 61 }
246 assert Counter ( c
[ 'category' ] for c
in rows
) == { 'valid' : 58 , 'invalid' : 7 }
247 assert sum ( c
[ 'expected' ][ 'baseline' ] is not None for c
in rows
) == 58
248 groups
= { g
: { 'description' : d
[ 0 ], 'proposedSlice' : d
[ 1 ], 'caseIDs' : [ c
[ 'id' ] for c
in rows
if c
[ 'family' ] == g
]} for g
, d
in FAMILIES
. items ()}
249 return { 'schemaVersion' : 1 , 'kind' : 'documentary-conformance-closure-matrix-no-registration' ,
250 'baseCommit' : '1c0b92c68fe1114b926d4405b553dfb096d2f425' , 'corpusPin' : PIN
,
251 'norms' : NORMS
, 'registeredStatusesUnchanged' : True ,
252 'registeredTotals' :{ 'CTM' :{ 'pass' : 262 , 'fail' : 4 , 'not-run' : 7 , 'total' : 273 }, 'XTM' :{ 'pass' : 70 , 'fail' : 0 , 'not-run' : 54 , 'total' : 124 },
253 'combined' :{ 'pass' : 332 , 'fail' : 4 , 'not-run' : 61 , 'total' : 397 }},
254 'openCounts' : { 'total' : 65 , 'ctm' : 11 , 'xtm' : 54 , 'positive' : 58 , 'negative' : 7 ,
255 'byClassification' : dict ( Counter ( c
[ 'primaryClassification' ] for c
in rows
))},
256 'families' : groups
, 'cases' : rows
}
259 def markdown_matrix ( matrix
):
260 lines
= [ '# Slice 22A — Vollständige Konformitätsmatrix der 65 offenen Originale' , '' ,
261 'Alle Statuswerte stammen aus der frisch reproduzierten Slice-21O-Registrierung. Beobachtungen ersetzen keine Registrierung. Vollständige Bytes, SHA-256, Quellen, Baselines, Modelle, Causes und pro Fall Normedition/Fundstellen stehen in [matrix.json](../reports/slice-22a/matrix.json).' , '' ,
262 'Normeditionen: CTM = ISO/IEC 13250-6:2010 (Korpusentwurf 2010-03-31); XTM = ISO/IEC 13250-3:2007 / XTM 2.0; TMDM = 13250-2:2006; CXTM = 13250-4:2009. Grenzen der Primärevidenz und A/B/C-Entscheidungen: [Abschlussplan](slice-22a-conformance-closure.md).' , '' ,
263 'Kategorien: **F** fehlende Sprachfähigkeit; **N** Norm-/Baseline-Konflikt (gegebenenfalls vorläufig); **U** ungeklärte Anforderung; **R** bereits erfolgreich beobachtet, unregistriert. Prognosen sind keine neu ausgeführten PASS.' , '' ]
264 kinds
={ 'valid' : 'positiv (Korpus)' , 'invalid' : 'negativ (Korpus)' }
265 cats
={ 'missing-language-capability' : 'F' , 'normative-conflict' : 'N' , 'unresolved-requirement' : 'U' , 'already-observed-unregistered' : 'R' }
266 for corpus
in [ 'CTM' , 'XTM 2.0' ]:
267 lines
+= [ '## ' + corpus
, '' , '| Case-ID / Originalquelle | Art / Status | Kategorie | Tatsächliche Condition / Position | Erwartung | Fehlende Fähigkeit / Abhängigkeiten | Normstellen / Begründungsstand | Nächster Slice |' , '|---|---|---|---|---|---|---|---|' ]
268 for row
in matrix
[ 'cases' ]:
269 if row
[ 'corpus' ] != corpus
: continue
270 c
= row
[ 'condition' ]; cond
= 'keine; ' + ( '702/702 Bytes gleich (nur Diagnose)' if row
[ 'family' ]== 'registration' else 'CXTM-Abweichung' )
272 cond
= f
"`{c.get('class',c.get('condition'))}/:{c['code']}`; "
273 if c
. get ( 'position' ) is not None : cond
+= f
"Zeichen {c['position']}, "
274 cond
+= f
"{c['line']}:{c['column']}" if c
. get ( 'line' ) is not None else 'Position null'
275 b
= row
[ 'expected' ][ 'baseline' ]; expected
= f
"[{b['bytes']} CXTM-Bytes](../{b['path']})" if b
else 'qualifizierte Ablehnung; keine Baseline'
276 refs
= '; ' . join ( x
[ 'standard' ]+ ' ' + ', ' . join ( x
[ 'clauses' ]) for x
in row
[ 'normativeReferences' ])
277 deps
= ', ' . join ( row
[ 'dependencies' ]); proof
= row
[ 'normativeDecisionABC' ] or 'Klauseln geprüft; Ausführung offen'
278 lines
. append ( f
"| [`{row['id']}`](../{row['source']['path']}) | {kinds[row['category']]} / **{row['registeredStatus'].upper()}** | {cats[row['primaryClassification']]} | {cond} | {expected} | {row['familyDescription']}; {deps} | {refs} ; {proof} | {row['proposedSlice']} |" )
280 lines
+= [ 'Alle 65 Zeilen sind eindeutige Original-Case-IDs. `.sub`-Ressourcen und synthetische Gegenproben werden nicht mitgezählt. Registrierung und historische Reports bleiben unverändert.' , '' ]
281 return ' \n ' . join ( lines
)
285 p
= argparse
. ArgumentParser ( description
= __doc__
); p
. add_argument ( '--baseline' , type = Path
, required
= True ); p
. add_argument ( '--observations' , type = Path
, required
= True ); p
. add_argument ( '--output' , type = Path
, required
= True ); p
. add_argument ( '--markdown' , type = Path
)
286 a
= p
. parse_args (); matrix
= make_matrix ( a
. baseline
, a
. observations
); save ( a
. output
, matrix
)
287 if a
. markdown
: a
. markdown
. write_text ( markdown_matrix ( matrix
))
288 print ( json
. dumps ( matrix
[ 'openCounts' ]))
290 if __name__
== '__main__' : main ()