]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - docs/reading-association-arity.md
Register five original XTM mergeMap contracts (Slice 22H)
[topic-maps.git] / docs / reading-association-arity.md
1 # Reading Associations with Arbitrarily Many Roles
2
3 Slice 17A builds on `f1270a43720ab1454bebfb3d0a9e3555554a7ab9`.
4 It removes a CTM reader restriction; it introduces no TMDM information items,
5 public model API, identity rules or canonicalization rules.
6
7 ## Normative requirements
8
9 - [CTM §3.13](https://www.isotopicmaps.org/ctm/ctm.html), productions 59–62:
10 an Association has one or more Role declarations, without an upper bound.
11 Type/Player references, optional Association Scope and Association/Role
12 Reifiers continue to use the existing shared deserialization mechanisms.
13 - [TMDM §§5.7–5.8, 6.6–6.7](https://www.isotopicmaps.org/sam/sam-model/2006-06-18/):
14 Association equality considers Type, Scope and its Role set. Roles sharing
15 Parent, Type and Player merge; their Item Identifiers are united and their
16 Reifiers handled by the existing merge rules. Declaration order is not a
17 further identity property.
18 - [CXTM §§3.9–3.10, 3.19, 4.4, 4.10–4.11](https://www.isotopicmaps.org/cxtm/cxtm.html):
19 number sorted Associations/Roles and emit complete rolePlayed references.
20 Association ordering uses Type/Roles/Scope/Parent; Role ordering uses
21 Player/Type/Parent. The existing implementation already handles these sets.
22
23 ## Original source, expected model and current observation
24
25 The untouched pinned `ctm/in/association-duplicate-role.ctm` contains:
26
27 ```text
28 assoctype(roletype1: topic1, roletype2: topic2, roletype3: topic3, roletype1: topic1)
29 ```
30
31 Document IRI:
32 `https://ctm-tests.example.invalid/cd165b150176c1d6842b37be9cc9051b40d4996b/ctm/in/association-duplicate-role.ctm`.
33
34 The expected result has seven Topics identified by Document-IRI-relative Item
35 Identifiers, one Association typed by the `#assoctype` Topic, and three Roles:
36 `#roletype1 → #topic1`, `#roletype2 → #topic2`, `#roletype3 → #topic3`.
37 Each Role's Parent is the actual Association object; `topic-roles-played`
38 returns that same Role. Scope is empty and Reifiers are null. No Names or
39 Occurrences are required. The repeated first Role declaration does not add a
40 fourth distinct Role. The original CXTM baseline is 1,157 bytes.
41
42 `reports/slice-17a/arity.json` records observations of these actual references;
43 `association-duplicate-role.ctm.cxtm` records actual serialized bytes. The
44 imported contract is executed through CTM deserialization, not manual model
45 construction. The independent JSON/XML checker verifies the observed Type,
46 Player and Parent relations against the original baseline.
47
48 ## Inspect actual Lisp objects
49
50 These forms load only the independent reader into the calling process. For a
51 fresh inspection use SBCL with `--no-sysinit --no-userinit`. The recorded
52 `describe.log` belongs to its isolated execution context; printed addresses are
53 not persistent Topic identity.
54
55 ```lisp
56 (require :asdf)
57 (asdf:load-asd #P"/Users/rgb/workspace/topic-maps/topic-maps.asd")
58 (asdf:load-system "topic-maps/ctm")
59 (let* ((base "https://ctm-tests.example.invalid/cd165b150176c1d6842b37be9cc9051b40d4996b/ctm/in/association-duplicate-role.ctm")
60 (map (topic-maps.ctm:deserialize-file
61 #P"/Users/rgb/workspace/topic-maps/vendor/cxtm/ctm/in/association-duplicate-role.ctm"
62 :document-iri base))
63 (association (first (topic-maps.tmdm:topic-map-associations map))))
64 (assert (= 3 (length (topic-maps.tmdm:association-roles association))))
65 (describe association)
66 (dolist (role (topic-maps.tmdm:association-roles association))
67 (assert (eq association (topic-maps.tmdm:association-role-parent role)))
68 (describe role)
69 (format t "~&Type ~S -> Player ~S~%"
70 (topic-maps.tmdm:topic-item-identifiers (topic-maps.tmdm:association-role-type role))
71 (topic-maps.tmdm:topic-item-identifiers (topic-maps.tmdm:association-role-player role)))))
72 ```
73
74 ## Explicit boundary: Slice 17B
75
76 `isa`/`ako` remain unsupported. TMDM §7.1 requires the distinct Core Subjects
77 defined in §7 to remain distinct. Read-only probes at the accepted base showed
78 that merging the Topics identified by `.../type` and `.../instance`, or adding
79 both Subject Identifiers to one Topic, was accepted. This is an open normative
80 requirement for Slice 17B. Slice 17A does not change those identity operations
81 or claim to correct that discrepancy. General n-ary Associations must not be
82 confused with the exactly binary standardized relationships of §§7.2–7.3.
83
84 Templates, Include/Mergemap and HyperDoc changes are excluded. The two existing
85 DateTime baseline discrepancies remain FAIL, not implementation successes.