lutaml-model 0.8.192 → 0.8.194

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.
@@ -0,0 +1,539 @@
1
+ = XLink 1.1 – XML Linking Language Specification Reference
2
+
3
+ This document provides a comprehensive overview of XLink, based on the W3C "XML Linking Language (XLink) Version 1.1" Recommendation (06 May 2010). It details definitions, global attributes, element types, usage rules, conformance expectations, and complete implementation requirements.
4
+
5
+ == 1. Introduction and Design Goals
6
+
7
+ XLink allows elements in any namespace to act as links by using **global attributes** in the XLink namespace (`http://www.w3.org/1999/xlink`). It enables both simple (HTML‑style) and extended (graph‑style) linking through attribute-based definitions.
8
+
9
+ === 1.1 Design Principles
10
+
11
+ XLink provides a framework for creating both basic unidirectional links and more complex linking structures. It allows XML documents to:
12
+
13
+ * Assert linking relationships among more than two resources
14
+ * Associate metadata with a link
15
+ * Express links that reside in a location separate from the linked resources
16
+ * Support both local and remote resource participation
17
+ * Enable inbound, outbound, and third-party arcs
18
+
19
+ === 1.2 Processing Dependencies
20
+
21
+ XLink processing depends on:
22
+ * XML 1.0 (Fifth Edition)
23
+ * XML Namespaces 1.0 (Third Edition)
24
+ * XML Base (Second Edition)
25
+ * RFC 3987 (Internationalized Resource Identifiers)
26
+ * Character Model for the World Wide Web 1.0: Fundamentals
27
+
28
+ == 2. XLink Concepts and Terminology
29
+
30
+ === 2.1 Links and Resources
31
+
32
+ **XLink Link**: An explicit relationship between resources or portions of resources, made explicit by an XLink linking element.
33
+
34
+ **Resource**: Any addressable unit of information or service (as defined in RFC 3986). Examples include files, images, documents, programs, and query results.
35
+
36
+ **Participating Resources**: When a link associates a set of resources, those resources are said to participate in the link.
37
+
38
+ **Local Resource**: An XML element that participates in a link by virtue of having as its parent, or being itself, a linking element (specified "by value").
39
+
40
+ **Remote Resource**: Any resource or resource portion that participates in a link by virtue of being addressed with an IRI reference (specified "by reference").
41
+
42
+ === 2.2 Arcs, Traversal, and Behavior
43
+
44
+ **Traversal**: Using or following a link for any purpose.
45
+
46
+ **Arc**: Information about how to traverse a pair of resources, including the direction of traversal and possibly application behavior information.
47
+
48
+ **Starting Resource**: The source from which traversal is begun.
49
+
50
+ **Ending Resource**: The destination of traversal.
51
+
52
+ **Outbound Arc**: An arc that has a local starting resource and a remote ending resource (goes away from the linking element).
53
+
54
+ **Inbound Arc**: An arc whose ending resource is local but starting resource is remote.
55
+
56
+ **Third-party Arc**: An arc where neither the starting resource nor the ending resource is local.
57
+
58
+ **Linkbases**: Documents containing collections of inbound and third-party links.
59
+
60
+ == 3. Global Attributes
61
+
62
+ The set of XLink global attributes includes:
63
+
64
+ * `type`
65
+ * `href`
66
+ * `role`
67
+ * `arcrole`
68
+ * `title`
69
+ * `show`
70
+ * `actuate`
71
+ * `label`
72
+ * `from`
73
+ * `to`
74
+
75
+ **Constraint**: No other attributes in the XLink namespace are permitted.
76
+
77
+ == 4. Element Identification
78
+
79
+ An element becomes an XLink element if:
80
+
81
+ * It has an `xlink:type` attribute with one of:
82
+ - `simple`, `extended`, `locator`, `arc`, `resource`, `title`, or `none`
83
+ * **OR** it has an `xlink:href` **without** a `type`—this implies `type="simple"`.
84
+
85
+ **Important**: In XLink 1.1, the `xlink:type` attribute is optional on simple links when `xlink:href` is present.
86
+
87
+ == 5. Attribute Usage per XLink Type
88
+
89
+ This table summarizes which attributes are **Required (R)**, **Optional (O)**, or **invalid (–)** depending on the element's `type`:
90
+
91
+ [options="header"]
92
+ |===
93
+ | Attribute | simple | extended | locator | arc | resource | title
94
+
95
+ | `type` | O* | R | R | R | R | R
96
+ | `href` | O* | – | R | – | – | –
97
+ | `role` | O | O | O | – | O | –
98
+ | `arcrole` | O | – | – | O | – | –
99
+ | `title` | O | O | O | O | O | –
100
+ | `show` | O | – | – | O | – | –
101
+ | `actuate` | O | – | – | O | – | –
102
+ | `label` | – | – | O | – | O | –
103
+ | `from` | – | – | – | O | – | –
104
+ | `to` | – | – | – | O | – | –
105
+ |===
106
+
107
+ \* At least one of `type` or `href` must be present for a simple link.
108
+
109
+ == 6. XLink Element Types and Relationships
110
+
111
+ === 6.1 Element Type Relationships
112
+
113
+ Various XLink element types have special meanings when they appear as direct children of other XLink element types:
114
+
115
+ [options="header"]
116
+ |===
117
+ | Parent Type | Allowed Child Types
118
+
119
+ | simple | none
120
+ | extended | locator, arc, resource, title
121
+ | locator | title
122
+ | arc | title
123
+ | resource | none
124
+ | title | none
125
+ |===
126
+
127
+ **Constraint**: Other combinations are not conformant.
128
+
129
+ === 6.2 Simple Links (`simple`-Type Element)
130
+
131
+ **Definition**: A simple link is a link that associates exactly two resources, one local and one remote, with an arc going from the former to the latter. Thus, a simple link is always an outbound link.
132
+
133
+ **Purpose**: Convenient shorthand for the equivalent extended link, combining the functions of `extended`, `locator`, `arc`, and `resource` type elements.
134
+
135
+ .Simple Link Example
136
+ [source,xml]
137
+ ----
138
+ <studentlink xmlns:xlink="http://www.w3.org/1999/xlink"
139
+ xlink:href="students/patjones62.xml"
140
+ xlink:title="Pat Jones">Pat Jones</studentlink>
141
+ ----
142
+
143
+ **Constraints**:
144
+ - The simple-type element itself, together with all its content, is the local resource
145
+ - It is not an error for a simple-type element to have no `href` attribute (link is simply untraversable)
146
+ - Nested XLink elements have no XLink-specified relationship to the parent link
147
+
148
+ === 6.3 Extended Links (`extended`-Type Element)
149
+
150
+ **Definition**: An extended link is a link that associates an arbitrary number of resources. The participating resources may be any combination of remote and local.
151
+
152
+ **Purpose**: Enable inbound and third-party arcs, associate arbitrary numbers of resources, support complex linking scenarios.
153
+
154
+ .Extended Link Structure
155
+ [source,xml]
156
+ ----
157
+ <courseload xmlns:xlink="http://www.w3.org/1999/xlink"
158
+ xlink:type="extended">
159
+ <person xlink:type="locator"
160
+ xlink:href="students/patjones62.xml"
161
+ xlink:label="student62"/>
162
+ <course xlink:type="locator"
163
+ xlink:href="courses/cs101.xml"
164
+ xlink:label="CS-101"/>
165
+ <gpa xlink:type="resource"
166
+ xlink:label="PatJonesGPA">3.5</gpa>
167
+ <go xlink:type="arc"
168
+ xlink:from="student62"
169
+ xlink:to="PatJonesGPA"/>
170
+ </courseload>
171
+ ----
172
+
173
+ **Constraints**:
174
+ - May contain `locator`, `arc`, `resource`, and `title` type elements
175
+ - Subelements of `simple` or `extended` type anywhere inside are not conformant
176
+ - Not an error to associate fewer than two resources (simply untraversable)
177
+
178
+ === 6.4 Locator Elements (`locator`-Type Element)
179
+
180
+ **Purpose**: Indicate remote resources that participate in an extended link.
181
+
182
+ **Requirements**:
183
+ - MUST have the `href` attribute with a value supplied
184
+ - MUST have `extended`-type element as parent
185
+ - May have `role`, `title`, and `label` attributes
186
+
187
+ **Constraint**: A locator-type element does not constitute a link by itself; it requires an extended link context.
188
+
189
+ === 6.5 Arc Elements (`arc`-Type Element)
190
+
191
+ **Purpose**: Indicate rules for traversing among participating resources in an extended link.
192
+
193
+ **Traversal Rules**:
194
+ - `from` and `to` attributes define traversal between resource pairs identified by their `label` values
195
+ - Missing `from` or `to` values mean "all labels" in that extended link
196
+ - Multiple locators with same label create multiple traversal arcs
197
+
198
+ **Constraint - No Arc Duplication**: Each arc-type element must have a unique pair of `from` and `to` values within the same extended link.
199
+
200
+ .Arc Traversal Examples
201
+ [source,xml]
202
+ ----
203
+ <!-- Traversal from parents to children -->
204
+ <go xlink:type="arc" xlink:from="parent" xlink:to="child"/>
205
+
206
+ <!-- Traversal to all children (from all resources) -->
207
+ <go xlink:type="arc" xlink:to="child"/>
208
+
209
+ <!-- All possible traversals if no arcs specified -->
210
+ <go xlink:type="arc"/>
211
+ ----
212
+
213
+ === 6.6 Resource Elements (`resource`-Type Element)
214
+
215
+ **Purpose**: Provide local resources for an extended link.
216
+
217
+ **Constraints**:
218
+ - The entire subelement, together with all its contents, makes up a local resource
219
+ - MUST have `extended`-type element as parent
220
+ - May have `role`, `title`, and `label` attributes
221
+ - Content has no XLink-specified relationship to the link
222
+
223
+ === 6.7 Title Elements (`title`-Type Element)
224
+
225
+ **Purpose**: Provide human-readable labels for extended links, locators, and arcs.
226
+
227
+ **Usage**:
228
+ - Useful for markup requirements (bidirectional text, Ruby annotation)
229
+ - Support for internationalization and localization
230
+ - Multiple titles for different natural languages
231
+
232
+ **Constraints**:
233
+ - MUST have `extended`, `locator`, or `arc` type element as parent
234
+ - If both `title` attribute and `title`-type elements present, relationship is not XLink-specified
235
+
236
+ == 7. Detailed Attribute Specifications
237
+
238
+ === 7.1 Type Attribute (`type`)
239
+
240
+ **Constraint - type Value**: The value of the `type` attribute must be supplied unless the element is a simple link and an `href` attribute in the XLink namespace is supplied. If a value is supplied, it must be one of "simple", "extended", "locator", "arc", "resource", "title", or "none".
241
+
242
+ **Special Behavior**: When the value is "none", the element has no XLink-specified meaning, and any XLink-related content or attributes have no XLink-specified relationship to the element.
243
+
244
+ === 7.2 Locator Attribute (`href`)
245
+
246
+ **Purpose**: Supplies the data that allows an XLink application to find a remote resource (or resource fragment).
247
+
248
+ **Usage**: May be used on `simple`-type elements, and must be used on `locator`-type elements.
249
+
250
+ **Value**: The value is a Legacy Extended IRI (LEIRI) per RFC 3987.
251
+
252
+ **Resolution Requirements**:
253
+ - If the value is a relative reference, its absolute version must be computed by XML Base before use
254
+ - Processing relative identifiers follows RFC 3986 algorithms
255
+ - Fragment identifiers follow the syntax of the target media type
256
+
257
+ **Note**: XLink applications need not enforce URI syntactic constraints, but applications using libraries that detect violations should not recover silently.
258
+
259
+ === 7.3 Semantic Attributes (`role`, `arcrole`, and `title`)
260
+
261
+ **Purpose**: Describe the meaning of resources within the context of a link.
262
+
263
+ **role Attribute**:
264
+ - Used on: `extended`, `simple`, `locator`, and `resource` type elements
265
+ - Value: Legacy Extended IRI (must not be relative)
266
+ - Indicates a property that the resource has
267
+
268
+ **arcrole Attribute**:
269
+ - Used on: `arc` and `simple` type elements
270
+ - Value: Legacy Extended IRI (must not be relative)
271
+ - Corresponds to RDF notion of a property: "starting-resource HAS arc-role ending-resource"
272
+
273
+ **title Attribute**:
274
+ - Used on: All element types except `title`-type elements
275
+ - Value: String that describes the resource
276
+ - Usage dependent on processing type (accessibility, link tables, hover text, etc.)
277
+
278
+ === 7.4 Behavior Attributes (`show` and `actuate`)
279
+
280
+ **Purpose**: Signal behavior intentions for traversal to ending resources.
281
+
282
+ **Usage**: May be used on `simple` and `arc` type elements.
283
+
284
+ **Linkbase Special Rule**: Applications encountering `arc`-type elements in linkbase lists must treat behavior attributes as if they were specified as `show="none"` and `actuate="onLoad"`.
285
+
286
+ ==== 7.4.1 Show Attribute
287
+
288
+ **Constraint - show Value**: If supplied, must be one of "new", "replace", "embed", "other", "none".
289
+
290
+ **Conforming Application Behavior**:
291
+
292
+ * **"new"**: Load ending resource in new window, frame, pane, or presentation context
293
+ * **"replace"**: Load ending resource in same presentation context as starting resource
294
+ * **"embed"**: Load ending resource presentation in place of starting resource presentation
295
+ * **"other"**: Unconstrained behavior; application should look for other markup
296
+ * **"none"**: Unconstrained behavior; no other markup present
297
+
298
+ **Important Notes**:
299
+ - Embedding affects only presentation, not permanent transformation
300
+ - Behavior with non-contiguous starting/ending resources is unconstrained
301
+ - Behavior of embedding XML-based ending resources is not defined in this specification
302
+
303
+ ==== 7.4.2 Actuate Attribute
304
+
305
+ **Constraint - actuate Value**: If supplied, must be one of "onLoad", "onRequest", "other", "none".
306
+
307
+ **Conforming Application Behavior**:
308
+
309
+ * **"onLoad"**: Traverse to ending resource immediately on loading starting resource
310
+ * **"onRequest"**: Traverse only on post-loading event triggered for traversal
311
+ * **"other"**: Unconstrained behavior; application should look for other markup
312
+ * **"none"**: Unconstrained behavior; no other markup present
313
+
314
+ **Special Cases**:
315
+ - If multiple arcs have `show="replace" actuate="onLoad"`, application behavior is unconstrained
316
+ - Post-loading events include user clicks, software countdowns, etc.
317
+
318
+ === 7.5 Traversal Attributes (`label`, `from`, and `to`)
319
+
320
+ **Purpose**: Define traversal relationships in extended links.
321
+
322
+ **Constraint - Values**: Values of `label`, `from`, or `to` attributes must be NCNames.
323
+
324
+ **label Attribute**:
325
+ - Used on: `resource` and `locator` type elements
326
+ - Provides identifier for arc-type elements to reference
327
+
328
+ **from and to Attributes**:
329
+ - Used on: `arc` type elements only
330
+ - Values must correspond to `label` attribute values on `locator` or `resource` type elements
331
+ - Both elements must be direct children of the same `extended`-type element
332
+
333
+ **Traversal Logic**:
334
+ - Missing `from` or `to` values mean "all labels" in the extended link
335
+ - Same label on multiple elements creates multiple traversal pairs
336
+ - No arc-type elements means all possible traversals are available
337
+
338
+ == 8. Linkbases and Special Arc Roles
339
+
340
+ === 8.1 Linkbase Discovery
341
+
342
+ **Special arcrole**: `http://www.w3.org/1999/xlink/properties/linkbase`
343
+
344
+ **Purpose**: Instruct XLink applications to access potentially relevant linkbases for processing inbound and third-party links.
345
+
346
+ **Constraint - Linkbases Must Be XML**: Any linkbase specified as the ending resource of an arc with this special arcrole value must be an XML document.
347
+
348
+ **Processing Requirements**:
349
+ 1. On loading a linkbase arc, application should track the starting resource
350
+ 2. When starting resource is loaded and traversal actuated, access the linkbase
351
+ 3. Extract any extended links found inside the linkbase
352
+ 4. Make extracted links available for processing
353
+ 5. Ignore `show` attribute value on linkbase arcs (traversal doesn't entail presentation)
354
+
355
+ **Linkbase Chaining**: Linkbases may serve as starting resources for other linkbase arcs (applications may limit chain length).
356
+
357
+ **Cycle Prevention**: Applications should maintain lists of retrieved links and avoid duplicate resources or cyclic dependencies.
358
+
359
+ .Linkbase Example
360
+ [source,xml]
361
+ ----
362
+ <basesloaded xmlns:xlink="http://www.w3.org/1999/xlink"
363
+ xlink:type="extended">
364
+ <startrsrc xlink:type="locator"
365
+ xlink:label="spec"
366
+ xlink:href="spec.xml"/>
367
+ <linkbase xlink:type="locator"
368
+ xlink:label="linkbase"
369
+ xlink:href="linkbase.xml"/>
370
+ <load xlink:type="arc"
371
+ xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase"
372
+ xlink:from="spec"
373
+ xlink:to="linkbase"
374
+ xlink:actuate="onLoad"/>
375
+ </basesloaded>
376
+ ----
377
+
378
+ == 9. Markup Conformance Requirements
379
+
380
+ === 9.1 Markup Conformance
381
+
382
+ An XML element conforms to XLink if:
383
+
384
+ 1. It has a `type` attribute from the XLink namespace whose value is one of "simple", "extended", "locator", "arc", "resource", "title", or "none", and adheres to the conformance constraints imposed by the chosen XLink element type, OR
385
+ 2. It does not have a `type` attribute from the XLink namespace and adheres to the conformance constraints imposed by the XLink simple element type, OR
386
+ 3. It does not have any attributes in the XLink namespace other than `type`, `href`, `role`, `arcrole`, `title`, `show`, `actuate`, `label`, `from`, and `to`
387
+ 4. Content conforming to XLink must conform to Character Model Fundamentals
388
+
389
+ **Important**: This specification imposes no particular constraints on schemas; conformance applies only to elements and attributes.
390
+
391
+ === 9.2 Application Conformance
392
+
393
+ **Definition**: An XLink application is any software module that interprets well-formed XML documents containing XLink elements and attributes, or XML information sets containing corresponding information items and properties.
394
+
395
+ **RFC 2119 Keywords**: The key words "must", "must not", "required", "shall", "shall not", "should", "should not", "recommended", "may", and "optional" are to be interpreted as described in RFC 2119.
396
+
397
+ ==== 9.2.1 Full Conformance
398
+
399
+ An application satisfies full conformance if:
400
+
401
+ 1. It observes the mandatory conditions ("must") for applications set forth in this specification
402
+ 2. For any recommended or optional conditions ("should" and "may") it chooses to observe, it observes them in the prescribed way
403
+ 3. It performs markup conformance testing according to all conformance constraints in this specification
404
+ 4. It applies XLink semantics only to elements which satisfy the markup conformance criteria
405
+ 5. Applications implementing XLink must conform to Character Model Fundamentals
406
+
407
+ ==== 9.2.2 Simple Conformance
408
+
409
+ An application satisfies simple conformance if it is fully conformant with respect to simple links:
410
+
411
+ * The processor may ignore any link which specifies an `xlink:type` other than "simple"
412
+ * If the `xlink:href` attribute is specified and the `xlink:type` attribute is not specified, the element must be processed as if `xlink:type` specified "simple"
413
+ * An application claiming simple conformance may ignore all other XLink elements
414
+
415
+ == 10. Implementation Guidelines
416
+
417
+ === 10.1 Attribute Value Defaulting
418
+
419
+ **DTD Defaults**: Attribute value defaults (fixed or not) may be added to DTDs or schemas to avoid repeating unchanging XLink attribute values.
420
+
421
+ **External Subset Warning**: Parsers are not required to process the external subset. Applications that don't process external subsets will not be aware of default values identified therein.
422
+
423
+ **Namespace Declaration Risk**: Using attribute value defaults for XLink namespace declarations poses interoperability risks with modern schema languages and should be used with care.
424
+
425
+ === 10.2 Integration with Other Markup
426
+
427
+ **Non-XLink Attributes**: There is no restriction on using non-XLink attributes alongside XLink attributes.
428
+
429
+ **Schema Freedom**: DTDs or schemas using XLink features need not use the entire set of XLink attributes and may tighten constraints beyond XLink minimums.
430
+
431
+ **Validation**: Valid documents must conform to constraints in their governing schema in addition to XLink constraints.
432
+
433
+ === 10.3 Legacy Markup Considerations
434
+
435
+ **Namespace Requirement**: XLink's global attributes require namespace prefixes, so non-XLink-based links in legacy documents generally do not serve as conforming XLink constructs.
436
+
437
+ **Conflicting Semantics**: When XLink is used on elements with other linking semantics, XLink cannot define the semantics of such combinations. The element specification should define the result semantics.
438
+
439
+ .Example: Non-XLink vs XLink href
440
+ [source,xml]
441
+ ----
442
+ <!-- XHTML href (not XLink) -->
443
+ <a href="page.html">Link</a>
444
+
445
+ <!-- XLink href -->
446
+ <a xmlns:xlink="http://www.w3.org/1999/xlink"
447
+ xlink:href="page.html">Link</a>
448
+ ----
449
+
450
+ == 11. Processing Model and Requirements
451
+
452
+ === 11.1 Recognition and Processing
453
+
454
+ **Element Recognition**: XLink elements are identified by:
455
+ - Presence of `xlink:type` attribute with valid value, OR
456
+ - Presence of `xlink:href` attribute (implies `type="simple"`)
457
+
458
+ **Namespace Declaration**: Use of XLink requires declaration of XLink namespace: `http://www.w3.org/1999/xlink`
459
+
460
+ **Attribute Validation**: Applications must validate attribute combinations according to element type constraints.
461
+
462
+ === 11.2 URI Processing
463
+
464
+ **LEIRI Support**: Applications must support Legacy Extended IRIs as defined in the LEIRI specification.
465
+
466
+ **Base URI Resolution**: Relative IRI references must be resolved using XML Base.
467
+
468
+ **Fragment Processing**: Fragment identifier syntax depends on target media type; XML resources should use XPointer Framework and element() Scheme.
469
+
470
+ === 11.3 Traversal Processing
471
+
472
+ **Arc Resolution**: Applications must correctly resolve arc traversal rules including:
473
+ - Label matching between `from`/`to` and `label` attributes
474
+ - Default behavior for missing `from`/`to` values
475
+ - Multiple traversal creation from shared labels
476
+
477
+ **Behavior Application**: Conforming applications should implement specified behaviors for `show` and `actuate` values.
478
+
479
+ == 12. Complete Implementation Checklist
480
+
481
+ When building an XLink processor:
482
+
483
+ **Recognition Phase**:
484
+
485
+ - [ ] Detect XLink elements by presence of `type` or `href` in XLink namespace
486
+ - [ ] Validate XLink namespace declaration
487
+ - [ ] Identify element type (simple, extended, locator, arc, resource, title, none)
488
+
489
+ **Validation Phase**:
490
+
491
+ - [ ] Validate attribute presence/absence according to type-based constraints
492
+ - [ ] Enforce value constraints (enum values, IRI format, NCName for labels)
493
+ - [ ] Validate parent-child element type relationships
494
+ - [ ] Check for arc duplication in extended links
495
+ - [ ] Validate `from`/`to` label references
496
+
497
+ **Processing Phase**:
498
+
499
+ - [ ] Resolve relative IRIs using XML Base
500
+ - [ ] Handle LEIRI processing for Unicode characters
501
+ - [ ] Implement arc traversal logic for extended links
502
+ - [ ] Apply behavior attributes (`show`, `actuate`) correctly
503
+ - [ ] Support linkbase processing for special arcrole
504
+ - [ ] Handle title elements for internationalization
505
+
506
+ **Conformance Level**:
507
+
508
+ - [ ] Choose and implement full or simple conformance
509
+ - [ ] Perform markup conformance testing
510
+ - [ ] Handle error cases gracefully
511
+ - [ ] Document conformance level and supported features
512
+
513
+ == Implementation Status in lutaml-model
514
+
515
+ [cols="1,1,1", options="header"]
516
+
517
+ |===
518
+
519
+ | Feature/Requirement | Status | Notes
520
+
521
+ | XLink element recognition (`xlink:type`, `xlink:href`) | Not implemented | No dedicated XLink element detection
522
+ | XLink namespace declaration validation | Not implemented | No XLink-specific namespace checks
523
+ | XLink global attributes (`type`, `href`, `role`, `arcrole`, `title`, `show`, `actuate`, `label`, `from`, `to`) | Not implemented | No attribute validation or mapping for XLink
524
+ | XLink element type identification (simple, extended, locator, arc, resource, title, none) | Not implemented | No logic for XLink element types
525
+ | Attribute usage validation per XLink type | Not implemented | No enforcement of attribute constraints
526
+ | Parent-child element type relationships | Not implemented | No validation of allowed child types
527
+ | Arc traversal logic (`from`, `to`, label matching) | Not implemented | No arc or traversal processing
528
+ | Behavior attributes (`show`, `actuate`) | Not implemented | No behavior attribute support
529
+ | Linkbase processing (`arcrole` special value) | Not implemented | No linkbase or arcrole logic
530
+ | LEIRI/IRI resolution, XML Base integration | Not implemented | No XLink-specific IRI resolution
531
+ | Title element handling (internationalization) | Not implemented | No dedicated title element logic
532
+ | Markup conformance testing | Not implemented | No XLink conformance checks
533
+ | Error handling for XLink constraints | Not implemented | No XLink-specific error handling
534
+ | Documentation of conformance level | Not implemented | No XLink conformance documentation
535
+ |===
536
+
537
+ *Summary*: The lutaml-model codebase does not currently implement any XLink 1.1 features, validation, or processing logic. All XLink-related requirements are unimplemented as of this review.
538
+
539
+ ---
@@ -41,16 +41,18 @@ module Lutaml
41
41
  }
42
42
  )
43
43
 
44
- # Date — ISO8601 with optional timezone
44
+ # Date — ISO8601 with optional timezone; delegates to the
45
+ # resolved type class (subclass serialize overrides fire)
45
46
  v.register_format_type_serializer(
46
47
  :json, Lutaml::Model::Type::Date,
47
- to: ->(inst) { Lutaml::Model::Type::Date.serialize(inst.value) }
48
+ to: ->(inst) { inst.class.serialize(inst.value) }
48
49
  )
49
50
 
50
- # TimeWithoutDate — HH:MM:SS format
51
+ # TimeWithoutDate — HH:MM:SS format; delegates to the
52
+ # resolved type class
51
53
  v.register_format_type_serializer(
52
54
  :json, Lutaml::Model::Type::TimeWithoutDate,
53
- to: ->(inst) { Lutaml::Model::Type::TimeWithoutDate.serialize(inst.value) }
55
+ to: ->(inst) { inst.class.serialize(inst.value) }
54
56
  )
55
57
 
56
58
  # Symbol — :symbol: format
@@ -147,11 +147,66 @@ module Lutaml
147
147
  end
148
148
 
149
149
  def self.cast_from_string!(type)
150
+ ensure_namespace_eager_loaded(type)
150
151
  Type.const_get(type)
151
152
  rescue NameError
152
153
  raise ArgumentError, "Unknown Lutaml::Model::Type: #{type}"
153
154
  end
154
155
 
156
+ # When a string-typed attribute references a class inside a namespace
157
+ # that uses autoload + lazy per-file registration (e.g. `Mml::V3::Math`,
158
+ # where sibling types register themselves as a side-effect of their
159
+ # file being loaded), resolving just the leaf constant via `const_get`
160
+ # leaves the sibling types unregistered. Deserialization of the root
161
+ # then fails because the registry has no entry for child element types.
162
+ #
163
+ # To fix this, walk each parent namespace segment of the string-typed
164
+ # reference and force every direct child constant to resolve. Each
165
+ # resolution triggers its autoload, which fires any per-file
166
+ # registration side-effects.
167
+ #
168
+ # Each namespace is touched at most once per process (memoized in
169
+ # `@eager_loaded_namespaces`) to keep repeated attribute declarations
170
+ # cheap.
171
+ def self.ensure_namespace_eager_loaded(type)
172
+ return unless type.is_a?(String) && type.include?("::")
173
+
174
+ segments = type.split("::")
175
+ return if segments.length < 2
176
+
177
+ @eager_loaded_namespaces ||= {}
178
+ @eager_loaded_namespaces_mutex ||= Mutex.new
179
+
180
+ segments[0..-2].each_with_object(+"") do |segment, accumulator|
181
+ accumulator << "::" unless accumulator.empty?
182
+ accumulator << segment
183
+ namespace_name = accumulator.freeze
184
+
185
+ @eager_loaded_namespaces_mutex.synchronize do
186
+ next if @eager_loaded_namespaces[namespace_name]
187
+
188
+ begin
189
+ namespace = Object.const_get(namespace_name)
190
+ rescue NameError
191
+ next
192
+ end
193
+ next unless namespace.is_a?(Module)
194
+
195
+ # Force every direct child constant to resolve, triggering any
196
+ # pending autoloads. Skip constants that fail to load (they may
197
+ # be defined dynamically or have unsatisfied dependencies).
198
+ namespace.constants(false).each do |child_name|
199
+ namespace.const_get(child_name)
200
+ rescue StandardError
201
+ nil
202
+ end
203
+
204
+ @eager_loaded_namespaces[namespace_name] = true
205
+ end
206
+ end
207
+ end
208
+ private_class_method :ensure_namespace_eager_loaded
209
+
155
210
  def initialize(name, type, options = {})
156
211
  skip_validation = options.fetch(:skip_validation, false)
157
212
 
@@ -15,9 +15,10 @@ module Lutaml
15
15
 
16
16
  case value
17
17
  when ::DateTime
18
- # Preserve timezone by keeping as DateTime at midnight
19
- ::DateTime.new(value.year, value.month, value.mday, 0, 0, 0,
20
- value.offset)
18
+ # Precision is the value: keep the time-of-day verbatim.
19
+ # Truncating here (or in serialize below) silently drops
20
+ # time components the consumer round-trips (issue #1256).
21
+ value
21
22
  when ::Time
22
23
  value.to_date
23
24
  when ::Date
@@ -26,9 +27,15 @@ module Lutaml
26
27
  str = value.to_s
27
28
  tz_match = str.match(TIMEZONE_RE)
28
29
  if tz_match
29
- date = ::Date.parse(str.sub(TIMEZONE_RE, ""))
30
- offset = parse_timezone(tz_match[1])
31
- ::DateTime.new(date.year, date.month, date.mday, 0, 0, 0, offset)
30
+ if str.sub(TIMEZONE_RE, "").include?(":")
31
+ # Time-of-day present: DateTime.parse keeps both the
32
+ # time and the zone (a bare date+zone loses the zone).
33
+ ::DateTime.parse(str)
34
+ else
35
+ date = ::Date.parse(str.sub(TIMEZONE_RE, ""))
36
+ offset = parse_timezone(tz_match[1])
37
+ ::DateTime.new(date.year, date.month, date.mday, 0, 0, 0, offset)
38
+ end
32
39
  else
33
40
  ::Date.parse(str)
34
41
  end
@@ -37,16 +44,13 @@ module Lutaml
37
44
  nil
38
45
  end
39
46
 
40
- # xs:date format with optional timezone
47
+ # xs:date for date-only values; the full ISO 8601 dateTime form
48
+ # when the value is a ::DateTime — cast and serialize agree, so
49
+ # a time carried into the type survives the round-trip.
41
50
  def self.serialize(value)
42
51
  return nil if value.nil?
43
52
 
44
- case value
45
- when ::DateTime
46
- value.strftime("%Y-%m-%d%:z")
47
- else
48
- value.iso8601
49
- end
53
+ value.is_a?(::DateTime) ? DateTime.format_datetime_iso8601(value) : value.iso8601
50
54
  end
51
55
 
52
56
  # Default XSD type for Date