@cda/adapter-xma 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +35 -10
  2. package/dist/mapping/generic-relationship-mapping.d.ts +18 -0
  3. package/dist/mapping/generic-relationship-mapping.d.ts.map +1 -0
  4. package/dist/mapping/generic-relationship-mapping.js +68 -0
  5. package/dist/mapping/generic-relationship-mapping.js.map +1 -0
  6. package/dist/mapping/relationship-mapping.d.ts +28 -2
  7. package/dist/mapping/relationship-mapping.d.ts.map +1 -1
  8. package/dist/mapping/relationship-mapping.js +650 -2
  9. package/dist/mapping/relationship-mapping.js.map +1 -1
  10. package/dist/serializer/document-writer.d.ts +25 -4
  11. package/dist/serializer/document-writer.d.ts.map +1 -1
  12. package/dist/serializer/document-writer.js +24 -15
  13. package/dist/serializer/document-writer.js.map +1 -1
  14. package/dist/serializer/graphical-writer.d.ts +2 -2
  15. package/dist/serializer/graphical-writer.d.ts.map +1 -1
  16. package/dist/serializer/graphical-writer.js +30 -2
  17. package/dist/serializer/graphical-writer.js.map +1 -1
  18. package/dist/serializer/relationship-writer.d.ts +21 -6
  19. package/dist/serializer/relationship-writer.d.ts.map +1 -1
  20. package/dist/serializer/relationship-writer.js +20 -9
  21. package/dist/serializer/relationship-writer.js.map +1 -1
  22. package/dist/serializer/semantic-writer.d.ts +8 -0
  23. package/dist/serializer/semantic-writer.d.ts.map +1 -1
  24. package/dist/serializer/semantic-writer.js +45 -1
  25. package/dist/serializer/semantic-writer.js.map +1 -1
  26. package/dist/serializer/serialize-xma.d.ts.map +1 -1
  27. package/dist/serializer/serialize-xma.js +10 -20
  28. package/dist/serializer/serialize-xma.js.map +1 -1
  29. package/dist/serializer/view-writer.d.ts +2 -2
  30. package/dist/serializer/view-writer.d.ts.map +1 -1
  31. package/dist/serializer/view-writer.js.map +1 -1
  32. package/package.json +1 -1
package/README.md CHANGED
@@ -88,7 +88,7 @@ interface XmaSerializeOptions {
88
88
 
89
89
  This is **initial, evidence-backed XMA serialization support** — not a
90
90
  complete, universal XMA converter. Everything below was confirmed against
91
- two reference `.archimate`/`.xma` fixture pairs (see
91
+ four reference `.archimate`/`.xma` fixture pairs (see
92
92
  [`tests/fixtures/README.md`](tests/fixtures/README.md)); nothing here is
93
93
  extrapolated beyond that evidence.
94
94
 
@@ -98,13 +98,28 @@ extrapolated beyond that evidence.
98
98
  Application, Technology, Physical, Motivation, Implementation & Migration,
99
99
  Composite), with confirmed scheme/collection placement and default icon
100
100
  decoration presence.
101
+ - `Junction`/`OrJunction` — a root-level `Connectors` container, confirmed
102
+ distinct graphical form (no fill/line color, `mm_graphicType="3"`). See
103
+ `tests/fixtures/README.md`.
101
104
  - Element and view names, and documentation (as RTF profile values).
102
- - A single ArchiMate view per model: node geometry (exact ×3 scale),
103
- default per-category fill colors, line color, opacity, and font.
105
+ - **Multiple ArchiMate views per model** (up from exactly one) — each gets
106
+ its own `GraphicalModule`, all nesting under one shared `AbstractViews`
107
+ container. Confirmed against 38-view and 3-view real-world fixtures. Node
108
+ geometry (exact ×3 scale), default per-category fill colors, line color,
109
+ opacity, and font are unaffected by view count.
104
110
  - Notes and Groups (as `ArchiMate:ViewGraphic`), including Group
105
111
  documentation.
106
- - Three confirmed semantic relationship mappings and their graphical
107
- representation:
112
+ - **90 confirmed exact-triple semantic relationship mappings** (up from 3),
113
+ spanning all eight schemes, plus **3 confirmed generic (type-independent)
114
+ forms** — `AssociationRelationship`, a `Grouping` endpoint (Composition,
115
+ Specialization, Influence, Use), and a `Junction`/`OrJunction` endpoint
116
+ (Realisation, Influence) — see `src/mapping/relationship-mapping.ts` and
117
+ `src/mapping/generic-relationship-mapping.ts` for the tables, and
118
+ `tests/fixtures/README.md` for how each was derived and verified. The
119
+ original 3 exact-triple mappings additionally have their graphical
120
+ `MM_DirectedRel` representation confirmed end-to-end; the rest were
121
+ confirmed at the semantic layer only (the same generic serializer code
122
+ path, not independently fixture-checked for the graphical layer):
108
123
  - `AssignmentRelationship` `BusinessActor` → `BusinessProcess`
109
124
  - `ServingRelationship` `ApplicationService` → `BusinessProcess` (XMA
110
125
  calls this `...Use`, not `...Serving`)
@@ -119,12 +134,21 @@ extrapolated beyond that evidence.
119
134
 
120
135
  ### Not yet guaranteed
121
136
 
122
- - Relationship type/source/target combinations beyond the three confirmed
123
- above (reported as a diagnostic, not silently dropped or guessed).
124
- - More than one view per model (reported as a diagnostic).
137
+ - Relationship type/source/target combinations beyond the 90 confirmed exact
138
+ triples and the 3 confirmed generic forms (reported as a diagnostic, not
139
+ silently dropped or guessed) e.g. a `Grouping`/`Junction` endpoint paired
140
+ with a verb outside the confirmed set for that endpoint kind.
141
+ - A handful of concrete types that collapse to a coarser XMA category
142
+ specifically for relationship naming, distinct from their own element
143
+ mapping — confirmed and implemented for `TechnologyCollaboration` →
144
+ `TechnologyNode`, `BusinessCollaboration` → `BusinessRole`, and
145
+ `SystemSoftware` → `TechnologyNode`. `Constraint` → `MotivationRequirement`
146
+ remains circumstantial (one otherwise-unexplained count mismatch, no
147
+ direct confirmation) and is **not** implemented. See "Generic and
148
+ collapsed forms" in [`tests/fixtures/README.md`](tests/fixtures/README.md).
125
149
  - Nested diagram objects, `DiagramModelReference` ("insert view as
126
150
  reference"), and purely visual (non-semantic) connections.
127
- - Junctions, profiles/specializations, and arbitrary model properties.
151
+ - Profiles/specializations and arbitrary model properties.
128
152
  - Explicit font size, bold/italic, line width, font color, or connector
129
153
  line color overrides (reported as diagnostics; the confirmed defaults are
130
154
  used instead).
@@ -152,7 +176,8 @@ src/
152
176
 
153
177
  mapping/ immutable mapping DATA (never switch statements)
154
178
  element-mapping.ts 60 confirmed Archi type -> XMA type/scheme/collection
155
- relationship-mapping.ts 3 confirmed (type, source, target) -> XMA relationship
179
+ relationship-mapping.ts 90 confirmed (type, source, target) -> XMA relationship
180
+ generic-relationship-mapping.ts 3 confirmed type-independent forms (Association, Grouping, Junction)
156
181
  scheme-mapping.ts scheme container / folder-nesting metadata
157
182
  visual-mapping.ts default fill/line colors, font, opacity
158
183
 
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Generic (type-independent) relationship forms — confirmed to exist, but
3
+ * structurally different from `relationship-mapping.ts`'s exact-triple
4
+ * table: these apply *regardless* of the concrete source/target type, not
5
+ * for one specific pair. See `tests/fixtures/README.md` for the full
6
+ * derivation evidence.
7
+ *
8
+ * All three forms serialize into the root-level `<ArchiMate:Relations>`
9
+ * container (a sibling of `AbstractSchemes` under `ArchiMateComponent`),
10
+ * never inside a layer scheme — confirmed directly in both fixtures
11
+ * (`sabsa.xma`, `agile-manifesto.xma`): every generic-form relation appears
12
+ * there, never nested in `BusinessScheme`/`ApplicationScheme`/etc.
13
+ */
14
+ export interface GenericRelationshipMapping {
15
+ xmaType: string;
16
+ }
17
+ export declare function lookupGenericRelationshipMapping(archiRelationshipType: string, sourceArchiType: string, targetArchiType: string): GenericRelationshipMapping | undefined;
18
+ //# sourceMappingURL=generic-relationship-mapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-relationship-mapping.d.ts","sourceRoot":"","sources":["../../src/mapping/generic-relationship-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAkCH,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,gCAAgC,CAC9C,qBAAqB,EAAE,MAAM,EAC7B,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,GACtB,0BAA0B,GAAG,SAAS,CA4BxC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Generic (type-independent) relationship forms — confirmed to exist, but
3
+ * structurally different from `relationship-mapping.ts`'s exact-triple
4
+ * table: these apply *regardless* of the concrete source/target type, not
5
+ * for one specific pair. See `tests/fixtures/README.md` for the full
6
+ * derivation evidence.
7
+ *
8
+ * All three forms serialize into the root-level `<ArchiMate:Relations>`
9
+ * container (a sibling of `AbstractSchemes` under `ArchiMateComponent`),
10
+ * never inside a layer scheme — confirmed directly in both fixtures
11
+ * (`sabsa.xma`, `agile-manifesto.xma`): every generic-form relation appears
12
+ * there, never nested in `BusinessScheme`/`ApplicationScheme`/etc.
13
+ */
14
+ /** Archi relationship type -> its confirmed "verb" suffix (see relationship-mapping.ts). */
15
+ const VERB_BY_ARCHI_TYPE = {
16
+ AssignmentRelationship: 'Assignment',
17
+ AccessRelationship: 'Access',
18
+ RealizationRelationship: 'Realisation',
19
+ FlowRelationship: 'Flow',
20
+ TriggeringRelationship: 'Triggering',
21
+ InfluenceRelationship: 'Influence',
22
+ SpecializationRelationship: 'Specialization',
23
+ CompositionRelationship: 'Composition',
24
+ ServingRelationship: 'Use',
25
+ };
26
+ /**
27
+ * Verbs confirmed (directly, not inferred) to produce the generic
28
+ * `{Verb}Relation` form when a `Junction`/`OrJunction` is an endpoint:
29
+ * `RealizationRelationship` (`RealisationRelation`, sabsa + agile-manifesto)
30
+ * and `InfluenceRelationship` (`InfluenceRelation`, agile-manifesto). Not
31
+ * extended to other verbs without fixture evidence for that specific verb —
32
+ * a relationship type absent from this set is still reported unsupported.
33
+ */
34
+ const JUNCTION_CONFIRMED_VERBS = new Set(['Realisation', 'Influence']);
35
+ /**
36
+ * Verbs confirmed to produce the `{Grouping|Element}{Grouping|Element}{Verb}`
37
+ * generic form when a `Grouping` is an endpoint (sabsa + agile-manifesto):
38
+ * `CompositionRelationship`, `SpecializationRelationship`,
39
+ * `InfluenceRelationship`, `ServingRelationship`. Same "no evidence, no
40
+ * guess" rule as Junction above.
41
+ */
42
+ const GROUPING_CONFIRMED_VERBS = new Set(['Composition', 'Specialization', 'Influence', 'Use']);
43
+ export function lookupGenericRelationshipMapping(archiRelationshipType, sourceArchiType, targetArchiType) {
44
+ // Confirmed universal: every AssociationRelationship instance across dozens of
45
+ // distinct source/target type pairs (sabsa + agile-manifesto) serializes as this
46
+ // one generic tag — never a type-specific one.
47
+ if (archiRelationshipType === 'AssociationRelationship') {
48
+ return { xmaType: 'ElementElementAssociation' };
49
+ }
50
+ const verb = VERB_BY_ARCHI_TYPE[archiRelationshipType];
51
+ if (!verb) {
52
+ return undefined;
53
+ }
54
+ const sourceIsJunction = sourceArchiType === 'Junction';
55
+ const targetIsJunction = targetArchiType === 'Junction';
56
+ if ((sourceIsJunction || targetIsJunction) && JUNCTION_CONFIRMED_VERBS.has(verb)) {
57
+ return { xmaType: `${verb}Relation` };
58
+ }
59
+ const sourceIsGrouping = sourceArchiType === 'Grouping';
60
+ const targetIsGrouping = targetArchiType === 'Grouping';
61
+ if ((sourceIsGrouping || targetIsGrouping) && GROUPING_CONFIRMED_VERBS.has(verb)) {
62
+ const sourcePart = sourceIsGrouping ? 'Grouping' : 'Element';
63
+ const targetPart = targetIsGrouping ? 'Grouping' : 'Element';
64
+ return { xmaType: `${sourcePart}${targetPart}${verb}` };
65
+ }
66
+ return undefined;
67
+ }
68
+ //# sourceMappingURL=generic-relationship-mapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-relationship-mapping.js","sourceRoot":"","sources":["../../src/mapping/generic-relationship-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,4FAA4F;AAC5F,MAAM,kBAAkB,GAAqC;IAC3D,sBAAsB,EAAE,YAAY;IACpC,kBAAkB,EAAE,QAAQ;IAC5B,uBAAuB,EAAE,aAAa;IACtC,gBAAgB,EAAE,MAAM;IACxB,sBAAsB,EAAE,YAAY;IACpC,qBAAqB,EAAE,WAAW;IAClC,0BAA0B,EAAE,gBAAgB;IAC5C,uBAAuB,EAAE,aAAa;IACtC,mBAAmB,EAAE,KAAK;CAC3B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAA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semantic type, target semantic type) — never by relationship type alone.
4
4
  *
5
- * Only THREE mappings are proven, all confirmed directly against
6
- * `tests/fixtures/relationships/relaciones.{archimate,xma}`. Every other
5
+ * 90 exact-triple mappings are proven: the original 3 confirmed against
6
+ * `tests/fixtures/relationships/relaciones.{archimate,xma}`, 64 more
7
+ * confirmed against `tests/fixtures/sabsa/sabsa.{archimate,xma}`, 20 more
8
+ * confirmed against `tests/fixtures/agile-manifesto/agile-manifesto.{archimate,xma}`,
9
+ * and 3 confirmed "...Collaboration collapses to its singular active-structure
10
+ * counterpart" instances (see below) — see each fixture pair's entry in
11
+ * `tests/fixtures/README.md` for the full derivation method. Every other
7
12
  * relationship type/source/target combination is unsupported for v0.1 and
8
13
  * must be diagnosed, never guessed (see `serializer/relationship-writer.ts`).
14
+ *
15
+ * `scheme` is always the scheme of the *source* type (confirmed even across
16
+ * schemes, e.g. `WorkPackage -> BusinessFunction` lives in `IMScheme`, the
17
+ * source's scheme, not `BusinessScheme`).
18
+ *
19
+ * Three "...Collaboration" entries collapse to their singular active-structure
20
+ * counterpart for relationship naming only (their own element mapping is
21
+ * unaffected — see `element-mapping.ts`): `BusinessCollaboration` collapses
22
+ * to `BusinessRole`, `TechnologyCollaboration` collapses to `TechnologyNode`.
23
+ * Verified directly against raw relation instances in both fixtures, not
24
+ * inferred.
25
+ *
26
+ * NOT modeled here as exact triples — genuinely type-independent, so they
27
+ * live in `generic-relationship-mapping.ts` instead:
28
+ * - `AssociationRelationship` always serializes as the generic
29
+ * `ElementElementAssociation`, regardless of source/target type.
30
+ * - A `Grouping` endpoint (for the confirmed verbs Composition,
31
+ * Specialization, Influence, Use) or a `Junction`/`OrJunction` endpoint
32
+ * (for the confirmed verbs Realisation, Influence) uses a generic form
33
+ * (e.g. `GroupingElementComposition`, `RealisationRelation`) instead of a
34
+ * type-specific one.
9
35
  */
10
36
  export interface RelationshipMappingEntry {
11
37
  archiRelationshipType: string;
@@ -1 +1 @@
1
- {"version":3,"file":"relationship-mapping.d.ts","sourceRoot":"","sources":["../../src/mapping/relationship-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,wBAAwB;IACvC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,qFAAqF;IACrF,OAAO,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,qBAAqB,EAAE,SAAS,wBAAwB,EAwBpE,CAAC;AAaF,wBAAgB,yBAAyB,CACvC,gBAAgB,EAAE,MAAM,EACxB,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,GACtB,wBAAwB,GAAG,SAAS,CAEtC"}
1
+ {"version":3,"file":"relationship-mapping.d.ts","sourceRoot":"","sources":["../../src/mapping/relationship-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,MAAM,WAAW,wBAAwB;IACvC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,qFAAqF;IACrF,OAAO,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,qBAAqB,EAAE,SAAS,wBAAwB,EA+oBpE,CAAC;AAaF,wBAAgB,yBAAyB,CACvC,gBAAgB,EAAE,MAAM,EACxB,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,GACtB,wBAAwB,GAAG,SAAS,CAEtC"}