lutaml-model 0.8.187 → 0.8.188

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 (306) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependent-repos-tools-informational.json +8 -0
  3. data/.github/workflows/dependent-repos-tools.json +1 -5
  4. data/.github/workflows/dependent-tests.yml +26 -2
  5. data/Gemfile +2 -0
  6. data/Rakefile +6 -0
  7. data/exe/lutaml-lml-lsp +11 -0
  8. data/lib/compat/opal/generate_boot.rb +12 -5
  9. data/lib/compat/opal/lutaml_model_boot.rb +96 -4
  10. data/lib/lutaml/lml/association_label_resolver.rb +52 -0
  11. data/lib/lutaml/lml/data_processor/attribute_processing.rb +133 -0
  12. data/lib/lutaml/lml/data_processor/collection_processing.rb +37 -0
  13. data/lib/lutaml/lml/data_processor/instance_processing.rb +77 -0
  14. data/lib/lutaml/lml/data_processor/value_declaration_processing.rb +70 -0
  15. data/lib/lutaml/lml/data_processor/value_processing.rb +103 -0
  16. data/lib/lutaml/lml/data_processor/view_processing.rb +26 -0
  17. data/lib/lutaml/lml/data_processor.rb +66 -0
  18. data/lib/lutaml/lml/diagnostic.rb +149 -0
  19. data/lib/lutaml/lml/document_builder.rb +486 -0
  20. data/lib/lutaml/lml/entity_types.rb +31 -0
  21. data/lib/lutaml/lml/executor/adapter_helpers.rb +45 -0
  22. data/lib/lutaml/lml/executor/condition_evaluator.rb +175 -0
  23. data/lib/lutaml/lml/executor/csv_adapter.rb +89 -0
  24. data/lib/lutaml/lml/executor/format_adapter.rb +54 -0
  25. data/lib/lutaml/lml/executor/xml_adapter.rb +102 -0
  26. data/lib/lutaml/lml/executor.rb +96 -0
  27. data/lib/lutaml/lml/format/adapter/document.rb +11 -0
  28. data/lib/lutaml/lml/format/adapter/mapping.rb +31 -0
  29. data/lib/lutaml/lml/format/adapter/standard_adapter.rb +164 -0
  30. data/lib/lutaml/lml/format/adapter/transform.rb +11 -0
  31. data/lib/lutaml/lml/format.rb +34 -0
  32. data/lib/lutaml/lml/formatter/base.rb +81 -0
  33. data/lib/lutaml/lml/formatter/canonical.rb +738 -0
  34. data/lib/lutaml/lml/formatter.rb +11 -0
  35. data/lib/lutaml/lml/grammar/lml.artifact.json +14993 -0
  36. data/lib/lutaml/lml/grammar/lml.parg +389 -0
  37. data/lib/lutaml/lml/grammar.rb +60 -0
  38. data/lib/lutaml/lml/has_attributes.rb +14 -0
  39. data/lib/lutaml/lml/import_resolver.rb +96 -0
  40. data/lib/lutaml/lml/layout/engine.rb +17 -0
  41. data/lib/lutaml/lml/layout.rb +9 -0
  42. data/lib/lutaml/lml/literal_value.rb +32 -0
  43. data/lib/lutaml/lml/lsp/conversions.rb +78 -0
  44. data/lib/lutaml/lml/lsp/keywords.rb +43 -0
  45. data/lib/lutaml/lml/lsp/server.rb +380 -0
  46. data/lib/lutaml/lml/lsp/store.rb +68 -0
  47. data/lib/lutaml/lml/lsp/transport.rb +53 -0
  48. data/lib/lutaml/lml/lsp.rb +16 -0
  49. data/lib/lutaml/lml/model_compiler/enums.rb +170 -0
  50. data/lib/lutaml/lml/model_compiler/hydration.rb +122 -0
  51. data/lib/lutaml/lml/model_compiler/serialization_mappings.rb +188 -0
  52. data/lib/lutaml/lml/model_compiler/string_formats.rb +42 -0
  53. data/lib/lutaml/lml/model_compiler/validation.rb +65 -0
  54. data/lib/lutaml/lml/model_compiler.rb +329 -0
  55. data/lib/lutaml/lml/models/action.rb +10 -0
  56. data/lib/lutaml/lml/models/association.rb +31 -0
  57. data/lib/lutaml/lml/models/cardinality.rb +10 -0
  58. data/lib/lutaml/lml/models/collection.rb +11 -0
  59. data/lib/lutaml/lml/models/constraint.rb +25 -0
  60. data/lib/lutaml/lml/models/data_type.rb +43 -0
  61. data/lib/lutaml/lml/models/derived_field.rb +14 -0
  62. data/lib/lutaml/lml/models/diagram.rb +22 -0
  63. data/lib/lutaml/lml/models/document.rb +86 -0
  64. data/lib/lutaml/lml/models/enum.rb +40 -0
  65. data/lib/lutaml/lml/models/fidelity.rb +10 -0
  66. data/lib/lutaml/lml/models/group.rb +11 -0
  67. data/lib/lutaml/lml/models/instance.rb +28 -0
  68. data/lib/lutaml/lml/models/instance_collection.rb +18 -0
  69. data/lib/lutaml/lml/models/instances_export.rb +10 -0
  70. data/lib/lutaml/lml/models/instances_import.rb +11 -0
  71. data/lib/lutaml/lml/models/mapping.rb +15 -0
  72. data/lib/lutaml/lml/models/mapping_rule.rb +16 -0
  73. data/lib/lutaml/lml/models/member_field.rb +16 -0
  74. data/lib/lutaml/lml/models/namespace.rb +18 -0
  75. data/lib/lutaml/lml/models/operation.rb +28 -0
  76. data/lib/lutaml/lml/models/operation_parameter.rb +12 -0
  77. data/lib/lutaml/lml/models/package.rb +28 -0
  78. data/lib/lutaml/lml/models/primitive_type.rb +35 -0
  79. data/lib/lutaml/lml/models/reference.rb +23 -0
  80. data/lib/lutaml/lml/models/serialization_mapping.rb +21 -0
  81. data/lib/lutaml/lml/models/string_format.rb +16 -0
  82. data/lib/lutaml/lml/models/top_element_attribute.rb +118 -0
  83. data/lib/lutaml/lml/models/uml_class.rb +87 -0
  84. data/lib/lutaml/lml/models/value.rb +17 -0
  85. data/lib/lutaml/lml/models/view_filter.rb +11 -0
  86. data/lib/lutaml/lml/models/view_import.rb +11 -0
  87. data/lib/lutaml/lml/parser.rb +19 -0
  88. data/lib/lutaml/lml/pipeline.rb +73 -0
  89. data/lib/lutaml/lml/positioned.rb +13 -0
  90. data/lib/lutaml/lml/preprocessor.rb +132 -0
  91. data/lib/lutaml/lml/quoting.rb +60 -0
  92. data/lib/lutaml/lml/source.rb +49 -0
  93. data/lib/lutaml/lml/source_position.rb +20 -0
  94. data/lib/lutaml/lml/symbol_index.rb +202 -0
  95. data/lib/lutaml/lml/transform.rb +119 -0
  96. data/lib/lutaml/lml/types/text_type.rb +28 -0
  97. data/lib/lutaml/lml/types.rb +10 -0
  98. data/lib/lutaml/lml/validator.rb +460 -0
  99. data/lib/lutaml/lml/view_resolution.rb +32 -0
  100. data/lib/lutaml/lml/view_resolver.rb +48 -0
  101. data/lib/lutaml/lml/yaml_parser.rb +17 -0
  102. data/lib/lutaml/lml.rb +130 -0
  103. data/lib/lutaml/model/adapter_resolver.rb +21 -2
  104. data/lib/lutaml/model/config.rb +22 -0
  105. data/lib/lutaml/model/serialize/format_conversion.rb +8 -6
  106. data/lib/lutaml/model/version.rb +1 -1
  107. data/lib/lutaml/xml/adapter/base_adapter.rb +26 -0
  108. data/lib/lutaml/xml/adapter/moxml_adapter.rb +49 -0
  109. data/lib/lutaml/xml/adapter/xml_parser.rb +4 -4
  110. data/lib/lutaml/xml/adapter/xml_serializer.rb +1 -1
  111. data/lib/lutaml/xml/adapter.rb +5 -0
  112. data/lib/lutaml/xml/adapter_loader.rb +5 -0
  113. data/lib/lutaml/xml/format.rb +23 -2
  114. data/lib/lutaml/xml/leptris/native_emission.rb +6 -1
  115. data/lib/lutaml/xml/leptris/plan_serializer.rb +5 -1
  116. data/lib/lutaml/xml/parse_session.rb +8 -1
  117. data/lib/lutaml/xml/schema/builder/moxml.rb +1 -1
  118. data/lib/lutaml/xml/schema/builder.rb +1 -1
  119. data/lib/lutaml/xml/schema/relaxng_schema.rb +1 -1
  120. data/lib/lutaml/xml/schema/vc_namespace.rb +24 -0
  121. data/lib/lutaml/xml/schema/xsd/any.rb +4 -0
  122. data/lib/lutaml/xml/schema/xsd/any_attribute.rb +4 -0
  123. data/lib/lutaml/xml/schema/xsd/base.rb +7 -0
  124. data/lib/lutaml/xml/schema/xsd/schema.rb +38 -0
  125. data/lib/lutaml/xml/schema/xsd/schema_validator.rb +1 -1
  126. data/lib/lutaml/xml/schema/xsd.rb +1 -0
  127. data/lib/lutaml/xml/schema/xsd_schema.rb +1 -1
  128. data/lib/lutaml/xml/serialization/format_conversion.rb +6 -0
  129. data/lib/lutaml/xml/xsd_validator.rb +1 -1
  130. data/lutaml-model.gemspec +2 -0
  131. data/spec/lml/fixtures/dsl/broken_diagram.lutaml +34 -0
  132. data/spec/lml/fixtures/dsl/diagram.lutaml +4 -0
  133. data/spec/lml/fixtures/dsl/diagram_attributes.lutaml +6 -0
  134. data/spec/lml/fixtures/dsl/diagram_blank_definion.lutaml +6 -0
  135. data/spec/lml/fixtures/dsl/diagram_blank_entities.lutaml +8 -0
  136. data/spec/lml/fixtures/dsl/diagram_class_assocation.lutaml +29 -0
  137. data/spec/lml/fixtures/dsl/diagram_class_fields.lutaml +25 -0
  138. data/spec/lml/fixtures/dsl/diagram_commented_includes.lutaml +5 -0
  139. data/spec/lml/fixtures/dsl/diagram_comments.lutaml +28 -0
  140. data/spec/lml/fixtures/dsl/diagram_concept_model.lutaml +132 -0
  141. data/spec/lml/fixtures/dsl/diagram_data_types.lutaml +44 -0
  142. data/spec/lml/fixtures/dsl/diagram_definitions.lutaml +25 -0
  143. data/spec/lml/fixtures/dsl/diagram_includes.lutaml +6 -0
  144. data/spec/lml/fixtures/dsl/diagram_multiply_classes.lutaml +7 -0
  145. data/spec/lml/fixtures/dsl/diagram_non_existing_include.lutaml +6 -0
  146. data/spec/lml/fixtures/dsl/shared.lutaml +5 -0
  147. data/spec/lml/fixtures/dsl/shared1.lutaml +4 -0
  148. data/spec/lml/fixtures/generated_dot/AddressClassProfile.dot +170 -0
  149. data/spec/lml/fixtures/generated_dot/AddressProfile.dot +34 -0
  150. data/spec/lml/fixtures/generated_dot/address_class_profile_with_associations.dot +127 -0
  151. data/spec/lml/fixtures/generated_dot/address_profile_with_associations.dot +28 -0
  152. data/spec/lml/fixtures/generated_dot/document.dot +28 -0
  153. data/spec/lml/fixtures/generated_dot/document.dot.backup +33 -0
  154. data/spec/lml/fixtures/generated_dot/document_with_fidelity.dot +27 -0
  155. data/spec/lml/fixtures/lml/data_s102_check.lml +79 -0
  156. data/spec/lml/fixtures/lml/data_s158_metadata.lml +28 -0
  157. data/spec/lml/fixtures/lml/iho_data_models.lml +59 -0
  158. data/spec/lml/fixtures/lml/iho_s102_check.lml +101 -0
  159. data/spec/lml/fixtures/mixed_lml/diagram.lml +26 -0
  160. data/spec/lml/fixtures/mixed_lml/instances.lml +72 -0
  161. data/spec/lml/fixtures/mixed_lml/model.lml +30 -0
  162. data/spec/lml/fixtures/real_world/basicdoc-models/AdmonitionType.lutaml +32 -0
  163. data/spec/lml/fixtures/real_world/basicdoc-models/BasicBlock.lutaml +11 -0
  164. data/spec/lml/fixtures/real_world/basicdoc-models/BasicDocument.lutaml +41 -0
  165. data/spec/lml/fixtures/real_world/basicdoc-models/BasicSection.lutaml +38 -0
  166. data/spec/lml/fixtures/real_world/basicdoc-models/BibliographicItem.lutaml +6 -0
  167. data/spec/lml/fixtures/real_world/basicdoc-models/FigureBlock.lutaml +65 -0
  168. data/spec/lml/fixtures/real_world/basicdoc-models/FormattedString.lutaml +12 -0
  169. data/spec/lml/fixtures/real_world/basicdoc-models/List.lutaml +12 -0
  170. data/spec/lml/fixtures/real_world/basicdoc-models/OrderedListType.lutaml +32 -0
  171. data/spec/lml/fixtures/real_world/basicdoc-models/Signature.lutaml +22 -0
  172. data/spec/lml/fixtures/real_world/basicdoc-models/String.lutaml +2 -0
  173. data/spec/lml/fixtures/real_world/basicdoc-models/TableBlock.lutaml +60 -0
  174. data/spec/lml/fixtures/real_world/basicdoc-models/TextElement.lutaml +13 -0
  175. data/spec/lml/fixtures/real_world/basicdoc-models/Uri.lutaml +7 -0
  176. data/spec/lml/fixtures/real_world/metanorma-model-iso/BibliographicItem.lutaml +4 -0
  177. data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoAdmonitionType.lutaml +31 -0
  178. data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoBibDataExtensionType.lutaml +40 -0
  179. data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoSections.lutaml +30 -0
  180. data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoStandardDocument.lutaml +46 -0
  181. data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoTerm.lutaml +20 -0
  182. data/spec/lml/fixtures/real_world/metanorma-model-iso/StandardBibDataExtensionType.lutaml +2 -0
  183. data/spec/lml/fixtures/real_world/metanorma-model-iso/StandardDocument.lutaml +2 -0
  184. data/spec/lml/fixtures/rs3001/01_class_tail_comment.lml +5 -0
  185. data/spec/lml/fixtures/rs3001/02_definition_block.lml +9 -0
  186. data/spec/lml/fixtures/rs3001/03_package_ceramics.lml +20 -0
  187. data/spec/lml/fixtures/rs3001/04_attribute_definition_form.lml +10 -0
  188. data/spec/lml/fixtures/rs3001/05_attribute_cardinality_unbounded.lml +10 -0
  189. data/spec/lml/fixtures/rs3001/06_attribute_values_set.lml +10 -0
  190. data/spec/lml/fixtures/rs3001/07_attribute_pattern.lml +10 -0
  191. data/spec/lml/fixtures/rs3001/08_attribute_default_colon.lml +15 -0
  192. data/spec/lml/fixtures/rs3001/09_value_porcelain.lml +9 -0
  193. data/spec/lml/fixtures/rs3001/10_enum_glaze_technique.lml +19 -0
  194. data/spec/lml/fixtures/rs3001/11_enum_values_as_instances.lml +29 -0
  195. data/spec/lml/fixtures/rs3001/12_instance_named.lml +13 -0
  196. data/spec/lml/fixtures/rs3001/13_instances_collection_refs.lml +11 -0
  197. data/spec/lml/fixtures/rs3001/14_require_models.lml +7 -0
  198. data/spec/lml/fixtures/rs3001/15_comment_line.lml +1 -0
  199. data/spec/lml/fixtures/rs3001/16_comment_tail.lml +5 -0
  200. data/spec/lml/fixtures/rs3001/17_comment_documented_class.lml +5 -0
  201. data/spec/lml/fixtures/rs3001/18_comment_block.lml +4 -0
  202. data/spec/lml/fixtures/rs3001/19_top_level_instance_definition.lml +21 -0
  203. data/spec/lml/fixtures/rs3001/20_instance_typed_definition.lml +22 -0
  204. data/spec/lml/fixtures/rs3001/21_instance_collection_studios.lml +19 -0
  205. data/spec/lml/fixtures/rs3001/22_instance_collection_tiles.lml +15 -0
  206. data/spec/lml/fixtures/rs3001/23_reference_cross_collection.lml +11 -0
  207. data/spec/lml/fixtures/rs3001/24_null_and_empty.lml +15 -0
  208. data/spec/lml/fixtures/rs3001/25_string_escapes.lml +23 -0
  209. data/spec/lml/fixtures/rs3001/26_quoted_keys.lml +7 -0
  210. data/spec/lml/fixtures/test.lutaml +20 -0
  211. data/spec/lml/fixtures/test_data/components.csv +4 -0
  212. data/spec/lml/fixtures/test_data/products.xml +18 -0
  213. data/spec/lml/fixtures/uml/address_class_profile_with_associations.yml +58 -0
  214. data/spec/lml/fixtures/uml/address_profile_with_associations.yml +31 -0
  215. data/spec/lml/fixtures/uml/association.yml +11 -0
  216. data/spec/lml/fixtures/uml/class.yml +28 -0
  217. data/spec/lml/fixtures/uml/data_type.yml +30 -0
  218. data/spec/lml/fixtures/uml/diagram.yml +7 -0
  219. data/spec/lml/fixtures/uml/document.yml +44 -0
  220. data/spec/lml/fixtures/uml/document_with_fidelity.yml +47 -0
  221. data/spec/lml/fixtures/uml/enum.yml +14 -0
  222. data/spec/lml/fixtures/uml/operation.yml +8 -0
  223. data/spec/lml/fixtures/uml/package.yml +10 -0
  224. data/spec/lml/fixtures/uml/top_element.yml +11 -0
  225. data/spec/lml/fixtures/uml/top_element_attribute.yml +10 -0
  226. data/spec/lml/fixtures/uml/trigger.yml +12 -0
  227. data/spec/lml/fixtures/uml/value.yml +8 -0
  228. data/spec/lml/fixtures/view/cycle_a.lutaml +3 -0
  229. data/spec/lml/fixtures/view/cycle_b.lutaml +3 -0
  230. data/spec/lml/fixtures/view/import_model.lutaml +3 -0
  231. data/spec/lml/fixtures/view/import_view.lutaml +3 -0
  232. data/spec/lml/fixtures/view/import_with_hide.lutaml +4 -0
  233. data/spec/lml/fixtures/view/import_with_show.lutaml +4 -0
  234. data/spec/lml/fixtures/view/models/bar.lutaml +3 -0
  235. data/spec/lml/fixtures/view/models/baz.lutaml +3 -0
  236. data/spec/lml/fixtures/view/models/foo.lutaml +4 -0
  237. data/spec/lml/integration/instance_import_export_spec.rb +102 -0
  238. data/spec/lml/lml_spec_setup.rb +25 -0
  239. data/spec/lml/lutaml/lml/association_label_resolver_spec.rb +139 -0
  240. data/spec/lml/lutaml/lml/data_processor_spec.rb +274 -0
  241. data/spec/lml/lutaml/lml/declarations_spec.rb +337 -0
  242. data/spec/lml/lutaml/lml/document_builder_registry_spec.rb +52 -0
  243. data/spec/lml/lutaml/lml/document_builder_spec.rb +99 -0
  244. data/spec/lml/lutaml/lml/element_visibility_spec.rb +128 -0
  245. data/spec/lml/lutaml/lml/entity_types_spec.rb +56 -0
  246. data/spec/lml/lutaml/lml/enum_spec.rb +77 -0
  247. data/spec/lml/lutaml/lml/executor/adapter_helpers_spec.rb +96 -0
  248. data/spec/lml/lutaml/lml/executor/condition_evaluator_spec.rb +393 -0
  249. data/spec/lml/lutaml/lml/executor/csv_adapter_spec.rb +151 -0
  250. data/spec/lml/lutaml/lml/executor/format_adapter_spec.rb +31 -0
  251. data/spec/lml/lutaml/lml/executor/xml_adapter_spec.rb +201 -0
  252. data/spec/lml/lutaml/lml/executor_spec.rb +71 -0
  253. data/spec/lml/lutaml/lml/format_adapter_spec.rb +272 -0
  254. data/spec/lml/lutaml/lml/format_autoload_spec.rb +31 -0
  255. data/spec/lml/lutaml/lml/grammar_spec.rb +581 -0
  256. data/spec/lml/lutaml/lml/has_attributes_spec.rb +54 -0
  257. data/spec/lml/lutaml/lml/import_resolver_spec.rb +116 -0
  258. data/spec/lml/lutaml/lml/instance_hydration_spec.rb +178 -0
  259. data/spec/lml/lutaml/lml/lsp/server_spec.rb +285 -0
  260. data/spec/lml/lutaml/lml/model_compiler_spec.rb +406 -0
  261. data/spec/lml/lutaml/lml/models/association_spec.rb +40 -0
  262. data/spec/lml/lutaml/lml/models/collection_spec.rb +27 -0
  263. data/spec/lml/lutaml/lml/models/data_type_spec.rb +34 -0
  264. data/spec/lml/lutaml/lml/models/diagram_spec.rb +18 -0
  265. data/spec/lml/lutaml/lml/models/document_spec.rb +64 -0
  266. data/spec/lml/lutaml/lml/models/enum_spec.rb +42 -0
  267. data/spec/lml/lutaml/lml/models/inheritance_spec.rb +77 -0
  268. data/spec/lml/lutaml/lml/models/instance_collection_spec.rb +62 -0
  269. data/spec/lml/lutaml/lml/models/instance_spec.rb +81 -0
  270. data/spec/lml/lutaml/lml/models/instances_export_spec.rb +23 -0
  271. data/spec/lml/lutaml/lml/models/instances_import_spec.rb +28 -0
  272. data/spec/lml/lutaml/lml/models/package_spec.rb +26 -0
  273. data/spec/lml/lutaml/lml/models/primitive_type_spec.rb +34 -0
  274. data/spec/lml/lutaml/lml/models/top_element_attribute_spec.rb +153 -0
  275. data/spec/lml/lutaml/lml/models/uml_class_spec.rb +70 -0
  276. data/spec/lml/lutaml/lml/models_version_spec.rb +27 -0
  277. data/spec/lml/lutaml/lml/operations_spec.rb +59 -0
  278. data/spec/lml/lutaml/lml/parser_spec.rb +348 -0
  279. data/spec/lml/lutaml/lml/pipeline_spec.rb +93 -0
  280. data/spec/lml/lutaml/lml/preprocessor_spec.rb +174 -0
  281. data/spec/lml/lutaml/lml/property_laws_spec.rb +344 -0
  282. data/spec/lml/lutaml/lml/real_world_spec.rb +191 -0
  283. data/spec/lml/lutaml/lml/reference_spec.rb +64 -0
  284. data/spec/lml/lutaml/lml/round_trip_spec.rb +457 -0
  285. data/spec/lml/lutaml/lml/rs3001_corpus_spec.rb +83 -0
  286. data/spec/lml/lutaml/lml/rs3001_syntax_spec.rb +77 -0
  287. data/spec/lml/lutaml/lml/serialization_mapping_spec.rb +127 -0
  288. data/spec/lml/lutaml/lml/source_spec.rb +62 -0
  289. data/spec/lml/lutaml/lml/transform_spec.rb +37 -0
  290. data/spec/lml/lutaml/lml/types/text_type_spec.rb +43 -0
  291. data/spec/lml/lutaml/lml/validator_spec.rb +238 -0
  292. data/spec/lml/lutaml/lml/view_resolver_spec.rb +78 -0
  293. data/spec/lml/lutaml/lml/view_spec.rb +112 -0
  294. data/spec/lml/lutaml/parsers/dsl_spec.rb +275 -0
  295. data/spec/lml/lutaml/parsers/yaml_spec.rb +52 -0
  296. data/spec/lml/lutaml/qualified_type_spec.rb +33 -0
  297. data/spec/lutaml/model/adapter_type_unset_restore_spec.rb +61 -0
  298. data/spec/lutaml/model/custom_bibtex_adapter_spec.rb +4 -1
  299. data/spec/lutaml/xml/adapter/moxml_lane_spec.rb +112 -0
  300. data/spec/lutaml/xml/adapter_metadata_default_spec.rb +21 -2
  301. data/spec/lutaml/xml/adapter_moxml_engine_spec.rb +57 -0
  302. data/spec/lutaml/xml/leptris/native_emission_plain_model_spec.rb +50 -0
  303. data/spec/lutaml/xml/plain_model_mapping_resolution_spec.rb +88 -0
  304. data/spec/lutaml/xml/schema/xsd/vc_versioning_spec.rb +49 -0
  305. data/spec/lutaml/xml/schema/xsd/xsd_11_constructs_spec.rb +43 -0
  306. metadata +286 -2
@@ -0,0 +1,329 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/lml/model_compiler/hydration"
4
+ require "lutaml/lml/model_compiler/validation"
5
+ require "lutaml/lml/model_compiler/enums"
6
+ require "lutaml/lml/model_compiler/serialization_mappings"
7
+ require "lutaml/lml/model_compiler/string_formats"
8
+
9
+ require "json"
10
+
11
+ module Lutaml
12
+ module Lml
13
+ # Compiles LML model definitions into anonymous
14
+ # Lutaml::Model::Serializable subclasses, hydrates instance data
15
+ # against them, and applies declared serialization mappings. The
16
+ # concern modules (Hydration, Validation, Enums,
17
+ # SerializationMappings, StringFormats) share this class's state.
18
+ class ModelCompiler
19
+ autoload :Hydration, "lutaml/lml/model_compiler/hydration"
20
+ autoload :Validation, "lutaml/lml/model_compiler/validation"
21
+ autoload :Enums, "lutaml/lml/model_compiler/enums"
22
+ autoload :SerializationMappings, "lutaml/lml/model_compiler/serialization_mappings"
23
+ autoload :StringFormats, "lutaml/lml/model_compiler/string_formats"
24
+
25
+ class ValidationError < ::Lutaml::Lml::Error; end
26
+
27
+ # The default generated namespace nests under Lutaml::Lml so
28
+ # compiled constants never collide with top-level constants.
29
+ DEFAULT_NAMESPACE = "Lutaml::Lml::Generated"
30
+
31
+ TYPE_MAP = {
32
+ "String" => :string,
33
+ "string" => :string,
34
+ "Integer" => :integer,
35
+ "integer" => :integer,
36
+ "Boolean" => :boolean,
37
+ "boolean" => :boolean,
38
+ "Float" => :float,
39
+ "float" => :float,
40
+ "Date" => :date,
41
+ "date_time" => :date_time,
42
+ "DateTime" => :date_time,
43
+ "Time" => :time,
44
+ "Uri" => :string,
45
+ }.freeze
46
+
47
+ # Tokens that denote unbounded cardinality in LML attribute
48
+ # declarations. Anything else must parse as an Integer.
49
+ UNBOUNDED_TOKENS = %w[* n N unbounded].freeze
50
+
51
+ include Hydration
52
+ include Validation
53
+ include Enums
54
+ include SerializationMappings
55
+ include StringFormats
56
+
57
+ def initialize(namespace: nil, artifact_paths: {}, default_artifact: nil)
58
+ @namespace = namespace
59
+ @artifact_paths = artifact_paths
60
+ @default_artifact = default_artifact
61
+ @compiled = {}
62
+ @forward_refs = {}
63
+ @enum_names = Set.new
64
+ @enum_classes = {}
65
+ @declared_namespaces = []
66
+ @serialization_mappings = []
67
+ @namespace_classes = {}
68
+ @class_defs = {}
69
+ end
70
+
71
+ def compile(input)
72
+ doc = Lutaml::Lml.parse_document(input)
73
+ compile_document(doc)
74
+ @compiled
75
+ end
76
+
77
+ def hydrate(input)
78
+ doc = input.is_a?(Document) ? input : Lutaml::Lml.parse_document(input)
79
+ compile_document(doc) unless @compiled.any?
80
+ return {} unless doc.instance
81
+
82
+ hydrate_instance(doc.instance)
83
+ rescue Lutaml::Lml::Error
84
+ raise
85
+ rescue StandardError => e
86
+ raise ::Lutaml::Lml::HydrationError.new(
87
+ "hydration failed: #{e.message}",
88
+ diagnostic: Diagnostic.build(
89
+ "hydration/LML-H01",
90
+ message: e.message,
91
+ file: input.is_a?(Document) ? input.source_path : nil,
92
+ ),
93
+ )
94
+ end
95
+
96
+ def compiled_classes
97
+ @compiled
98
+ end
99
+
100
+ # Validate an instances document against compiled models.
101
+ #
102
+ # Accepts the instances input as a String, IO, StringIO, or a
103
+ # pre-parsed Document. If +compiled:+ is supplied, that registry is
104
+ # used; otherwise models are compiled from the same input (which
105
+ # must therefore contain a models section).
106
+ #
107
+ # Returns an array of validation error strings (empty if all pass).
108
+ def validate(input, compiled: nil)
109
+ doc = input.is_a?(Document) ? input : Lutaml::Lml.parse_document(input)
110
+ if compiled
111
+ @compiled = compiled
112
+ else
113
+ compile_document(doc)
114
+ end
115
+
116
+ errors = []
117
+ validate_instance(doc.instance, errors) if doc.instance
118
+ errors
119
+ end
120
+
121
+ private
122
+
123
+ def compile_document(doc)
124
+ @declared_namespaces = Array(doc.namespaces)
125
+ @serialization_mappings = Array(doc.serialization_mappings)
126
+ doc.classes.each { |c| compile_class(c) }
127
+ hoist_class_serialization_mappings(doc)
128
+ doc.enums.each { |e| compile_enum(e) }
129
+ doc.data_types.each { |dt| compile_data_type(dt) }
130
+ resolve_forward_references
131
+ apply_xml_mappings
132
+ apply_key_value_mappings
133
+ register_string_formats(doc)
134
+ end
135
+
136
+ def resolve_forward_references
137
+ @forward_refs.each do |class_name, deferred_attrs|
138
+ klass = @compiled[class_name]
139
+ next unless klass
140
+
141
+ deferred_attrs.each do |attr_name, raw_type, _type, options|
142
+ resolved = resolve_type(raw_type)
143
+ klass.attribute attr_name, resolved, **options
144
+ end
145
+ end
146
+ end
147
+
148
+ def compile_class(klass_def)
149
+ name = klass_def.name.to_s
150
+ @class_defs[name] = klass_def
151
+ compiled_klass = build_compiled_class(klass_def)
152
+ apply_declared_mappings(compiled_klass, klass_def)
153
+ declare_derived_fields(compiled_klass, klass_def)
154
+ register(name, compiled_klass)
155
+ end
156
+
157
+ alias compile_data_type compile_class
158
+ def build_compiled_class(def_obj)
159
+ all_attrs = build_attributes(def_obj)
160
+ immediate, deferred = all_attrs.partition do |(_, raw_type, type, _)|
161
+ type != :string || TYPE_MAP.key?(raw_type) || raw_type.start_with?("reference:(")
162
+ end
163
+
164
+ compiled_klass = Class.new(Lutaml::Model::Serializable) do
165
+ immediate.each do |attr_name, _raw, type, options|
166
+ attribute attr_name, type, options
167
+ end
168
+ end
169
+ render_nil_map = Array(def_obj.attributes).to_h do |a|
170
+ [a.name.to_sym, declared_render_nil(a)]
171
+ end.compact
172
+ unless render_nil_map.empty?
173
+ compiled_klass.class_eval do
174
+ @lml_render_nil = render_nil_map
175
+
176
+ class << self
177
+ attr_reader :lml_render_nil
178
+ end
179
+ end
180
+ apply_render_nil_mappings(compiled_klass, render_nil_map)
181
+ end
182
+
183
+ name = def_obj.name.to_s
184
+ @forward_refs[name] = deferred unless deferred.empty?
185
+ compiled_klass
186
+ end
187
+
188
+ def build_attributes(klass_def)
189
+ Array(klass_def.attributes).map do |attr|
190
+ attr_name = attr.name.to_sym
191
+ raw_type = resolve_values_type(klass_def, attr)
192
+ type = resolve_type(raw_type)
193
+ options = build_options(attr)
194
+ [attr_name, raw_type, type, options]
195
+ end
196
+ end
197
+
198
+ def resolve_type(type_name)
199
+ return TYPE_MAP[type_name] if TYPE_MAP.key?(type_name)
200
+ return :string if type_name.start_with?("reference:(")
201
+ return @compiled[type_name] if @compiled.key?(type_name)
202
+
203
+ :string
204
+ end
205
+
206
+ def build_options(attr)
207
+ declared = declared_attribute_options(attr)
208
+ options = {}
209
+ card = attr.cardinality
210
+ unless card
211
+ # LML attributes without an explicit cardinality are optional (0..1)
212
+ options[:default] = declared[:default]
213
+ return options
214
+ end
215
+
216
+ min = parse_cardinality_value(card.min)
217
+ max = parse_cardinality_value(card.max)
218
+
219
+ collection = (max && (max > 1 || max == Float::INFINITY)) ||
220
+ (max.nil? && min && min > 1)
221
+ if collection
222
+ options[:collection] = true
223
+ elsif min.zero?
224
+ options[:default] = nil
225
+ end
226
+ # a declared default literal wins over the absent-marker
227
+ options[:default] = declared[:default] if declared.key?(:default)
228
+ options
229
+ end
230
+
231
+ # L7b: default <literal> and render_nil true|false ride the
232
+ # keyword-attribute properties (bare name-value lines). Defaults
233
+ # fire only on ABSENT input; render_nil mirrors lutaml-model.
234
+ def declared_attribute_options(attr)
235
+ options = {}
236
+ Array(attr.properties).each do |prop|
237
+ next unless prop.name.to_s == "default"
238
+
239
+ value = prop.value
240
+ value = value[:string] if value.is_a?(Hash) && value.key?(:string)
241
+ options[:default] = value&.to_s
242
+ end
243
+ options
244
+ end
245
+
246
+ # render_nil is a lutaml-model MAPPING option, not an attribute
247
+ # option: collect the declaration for the mapping passes
248
+ def declared_render_nil(attr)
249
+ prop = Array(attr.properties).find { |prop| prop.name.to_s == "render_nil" }
250
+ prop ? prop.value.to_s == "true" : nil
251
+ end
252
+
253
+ def parse_cardinality_value(val)
254
+ return nil if val.nil?
255
+ return Float::INFINITY if UNBOUNDED_TOKENS.include?(val.to_s)
256
+ return val.to_i if val.to_s.match?(/\A\d+\z/)
257
+
258
+ message = "Unrecognized cardinality token: #{val.inspect}"
259
+ raise ::Lutaml::Lml::ValidationError.new(
260
+ message,
261
+ diagnostic: Diagnostic.build("contract/LML-C04", message: message),
262
+ )
263
+ end
264
+
265
+ def declare_derived_fields(compiled_klass, def_obj)
266
+ return unless def_obj.is_a?(UmlClass) || def_obj.is_a?(DataType)
267
+
268
+ derived = Array(def_obj.derived_fields)
269
+ return if derived.empty?
270
+
271
+ compiled_klass.class_eval do
272
+ @lml_derived_fields = derived.map { |f| f.name.to_sym }
273
+ def self.derived_fields
274
+ @lml_derived_fields
275
+ end
276
+ end
277
+ derived.each do |field|
278
+ compiled_klass.attribute field.name.to_sym, resolve_type(field.type.to_s)
279
+ end
280
+ end
281
+
282
+ def artifact_path_for(reference)
283
+ mapped = @artifact_paths && @artifact_paths[reference]
284
+ return mapped if mapped && File.exist?(mapped.to_s)
285
+ return reference if File.exist?(reference)
286
+
287
+ nil
288
+ end
289
+
290
+ # Emit KV mappings carrying render_nil for the declared
291
+ # attributes (yaml/json round-trips honor them)
292
+ def apply_render_nil_mappings(compiled_klass, render_nil_map)
293
+ %i[yaml json].each do |fmt|
294
+ compiled_klass.public_send(fmt) do |mapping|
295
+ render_nil_map.each do |name, flag|
296
+ mapping.map name.to_s, to: name, render_nil: flag
297
+ end
298
+ end
299
+ end
300
+ end
301
+
302
+ def register(name, klass)
303
+ @compiled[name] = klass
304
+ return name_anonymous_class(klass, name) unless @namespace
305
+
306
+ namespace_module.const_set(name, klass)
307
+ end
308
+
309
+ # Without a target namespace the class stays anonymous, and
310
+ # lutaml-model's schema generators need a class name for $defs/$ref.
311
+ def name_anonymous_class(klass, name)
312
+ klass.define_singleton_method(:name) { name }
313
+ end
314
+
315
+ def namespace_module
316
+ return @namespace if @namespace.is_a?(Module)
317
+
318
+ @namespace_module ||= begin
319
+ chain = @namespace.to_s.split("::")
320
+ chain.reduce(Object) do |parent, name|
321
+ parent.const_get(name)
322
+ rescue NameError
323
+ parent.const_set(name, Module.new)
324
+ end
325
+ end
326
+ end
327
+ end
328
+ end
329
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Lml
5
+ class Action < Lutaml::Model::Serializable
6
+ attribute :verb, :string
7
+ attribute :direction, :string
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/lml/positioned"
4
+
5
+ module Lutaml
6
+ module Lml
7
+ # A relationship between two class ends.
8
+ class Association < Lutaml::Model::Serializable
9
+ include Lutaml::Lml::Positioned
10
+
11
+ # From TopElement
12
+ attribute :name, :string
13
+ attribute :definition, Lutaml::Lml::Types::TextType
14
+ attribute :keyword, :string
15
+ attribute :stereotype, :string, collection: true, default: -> { [] }
16
+ attribute :visibility, :string, default: "public"
17
+
18
+ # From Association
19
+ attribute :owner_end, :string
20
+ attribute :owner_end_attribute_name, :string
21
+ attribute :owner_end_cardinality, "Lutaml::Lml::Cardinality"
22
+ attribute :owner_end_type, :string
23
+ attribute :member_end, :string
24
+ attribute :member_end_attribute_name, :string
25
+ attribute :member_end_cardinality, "Lutaml::Lml::Cardinality"
26
+ attribute :member_end_type, :string
27
+ attribute :static, :string
28
+ attribute :action, "Lutaml::Lml::Action"
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Lml
5
+ class Cardinality < Lutaml::Model::Serializable
6
+ attribute :min, :string
7
+ attribute :max, :string
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Lml
5
+ class Collection < Lutaml::Model::Serializable
6
+ attribute :name, :string
7
+ attribute :includes, :string, collection: true
8
+ attribute :validations, :string, collection: true
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/lml/positioned"
4
+
5
+ module Lutaml
6
+ module Lml
7
+ # A named constraint on a class.
8
+ class Constraint < Lutaml::Model::Serializable
9
+ include Lutaml::Lml::Positioned
10
+
11
+ # From TopElement
12
+ attribute :name, :string
13
+ attribute :definition, Lutaml::Lml::Types::TextType
14
+ attribute :keyword, :string
15
+ attribute :stereotype, :string, collection: true, default: -> { [] }
16
+ attribute :visibility, :string, default: "public"
17
+
18
+ # From Constraint
19
+ attribute :body, :string
20
+ attribute :type, :string
21
+ attribute :weight, :string
22
+ attribute :status, :string
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/lml/positioned"
4
+
5
+ module Lutaml
6
+ module Lml
7
+ # A user-defined data type declaration.
8
+ class DataType < Lutaml::Model::Serializable
9
+ include Lutaml::Lml::Positioned
10
+
11
+ # From TopElement
12
+ attribute :name, :string
13
+ attribute :wire_mappings, "Lutaml::Lml::Mapping", collection: true, default: -> { [] }
14
+ attribute :derived_fields, "Lutaml::Lml::DerivedField", collection: true, default: -> { [] }
15
+ attribute :serialization_mappings, "Lutaml::Lml::SerializationMapping", collection: true, default: -> { [] }
16
+ attribute :definition, Lutaml::Lml::Types::TextType
17
+ attribute :keyword, :string, default: "dataType"
18
+ attribute :stereotype, :string, collection: true, default: -> { [] }
19
+ attribute :visibility, :string, default: "public"
20
+
21
+ # From UmlClassifier
22
+ attribute :is_abstract, :boolean, default: false
23
+
24
+ # From DataType
25
+ attribute :nested_classifier, :string, collection: true, default: -> { [] }
26
+ attribute :type, :string
27
+ attribute :attributes, "Lutaml::Lml::TopElementAttribute", collection: true
28
+ attribute :modifier, :string
29
+ attribute :constraints, "Lutaml::Lml::Constraint", collection: true
30
+ attribute :operations, "Lutaml::Lml::Operation", collection: true
31
+ attribute :data_types, "Lutaml::Lml::DataType", collection: true
32
+ attribute :associations, "Lutaml::Lml::Association", collection: true
33
+
34
+ def self.entity_type
35
+ :data_types
36
+ end
37
+
38
+ def self.classifiable?
39
+ true
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Lml
5
+ # A derived-field declaration: existence + type only. The
6
+ # computation is bound by the binder from the grammar artifact's
7
+ # derive specs — LML never defines computation.
8
+ # derive urn: String
9
+ class DerivedField < Lutaml::Model::Serializable
10
+ attribute :name, :string
11
+ attribute :type, :string
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/lml/positioned"
4
+
5
+ module Lutaml
6
+ module Lml
7
+ # A diagram declaration.
8
+ class Diagram < Lutaml::Model::Serializable
9
+ include Lutaml::Lml::Positioned
10
+
11
+ attribute :name, :string
12
+ attribute :definition, Lutaml::Lml::Types::TextType
13
+ attribute :keyword, :string
14
+ attribute :stereotype, :string, collection: true, default: -> { [] }
15
+ attribute :visibility, :string, default: "public"
16
+
17
+ attribute :package_id, :string
18
+ attribute :package_name, :string
19
+ attribute :diagram_type, :string
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/lml/positioned"
4
+
5
+ module Lutaml
6
+ module Lml
7
+ # The parsed LML document model.
8
+ class Document < Lutaml::Model::Serializable
9
+ include Lutaml::Lml::Positioned
10
+
11
+ # Non-serialized navigation index (definitions and uses).
12
+ def symbols
13
+ @symbols ||= SymbolIndex.new(self)
14
+ end
15
+
16
+ # Core attributes
17
+ attribute :name, :string
18
+ attribute :lml_version, :string
19
+ attribute :title, :string
20
+ attribute :caption, :string
21
+ attribute :groups, "Lutaml::Lml::Group", collection: true, default: -> { [] }
22
+ attribute :fidelity, "Lutaml::Lml::Fidelity"
23
+ attribute :fontname, :string
24
+ attribute :comments, :string, collection: true, default: -> { [] }
25
+
26
+ attribute :classes, "Lutaml::Lml::UmlClass", collection: true, default: -> { [] }
27
+ attribute :data_types, "Lutaml::Lml::DataType", collection: true, default: -> { [] }
28
+ attribute :enums, "Lutaml::Lml::Enum", collection: true, default: -> { [] }
29
+ attribute :packages, "Lutaml::Lml::Package", collection: true, default: -> { [] }
30
+ attribute :namespaces, "Lutaml::Lml::Namespace", collection: true, default: -> { [] }
31
+ # `models <Name> version "x.y.z"` headers: model name -> declared
32
+ # version (issue #16, the co-release identity line).
33
+ attribute :model_versions, :hash, default: -> { {} }
34
+ attribute :serialization_mappings, "Lutaml::Lml::SerializationMapping", collection: true, default: -> { [] }
35
+ attribute :primitives, "Lutaml::Lml::PrimitiveType", collection: true, default: -> { [] }
36
+ attribute :associations, "Lutaml::Lml::Association", collection: true, default: -> { [] }
37
+ attribute :diagrams, "Lutaml::Lml::Diagram", collection: true, default: -> { [] }
38
+
39
+ # LML-specific. instance/instances/fidelity/show_filter/hide_filter
40
+ # are deliberately default-less: nil means "absent".
41
+ attribute :instance, "Lutaml::Lml::Instance"
42
+ attribute :requires, :string, collection: true, default: -> { [] }
43
+ attribute :instances, "Lutaml::Lml::InstanceCollection"
44
+
45
+ # Repeated `instances` blocks accumulate (issue #17): instances,
46
+ # imports, exports and collections concat; a duplicate collection
47
+ # name is an error (same name is a mistake, distinct names intent).
48
+ def instances=(collection)
49
+ collection = Lutaml::Lml::InstanceCollection.new(**collection) if collection.is_a?(Hash)
50
+ if @instances.nil? || (@instances.instances.empty? && @instances.imports.empty? &&
51
+ @instances.exports.empty? && @instances.collections.empty?)
52
+ @instances = collection
53
+ else
54
+ merge_instances(collection)
55
+ end
56
+ end
57
+
58
+ def merge_instances(incoming)
59
+ names = @instances.collections.map(&:name)
60
+ incoming.collections.each do |collection|
61
+ raise Lutaml::Lml::Error, "duplicate collection name '#{collection.name}'" if names.include?(collection.name)
62
+ end
63
+ @instances.instances.concat(incoming.instances)
64
+ @instances.imports.concat(incoming.imports)
65
+ @instances.exports.concat(incoming.exports)
66
+ @instances.collections.concat(incoming.collections)
67
+ end
68
+ attribute :view_imports, "Lutaml::Lml::ViewImport", collection: true, default: -> { [] }
69
+ attribute :show_filter, "Lutaml::Lml::ViewFilter"
70
+ attribute :hide_filter, "Lutaml::Lml::ViewFilter"
71
+
72
+ # All class-like entities on the document. Used by resolvers and
73
+ # formatters that need to walk every classifiable type without
74
+ # caring which collection holds it.
75
+ def all_classes
76
+ EntityTypes.all.flat_map { |type| public_send(type.entity_type) }
77
+ end
78
+
79
+ # Class-like entities that can own associations. Excludes enums
80
+ # (which have no attributes/associations of their own).
81
+ def classifiable_classes
82
+ EntityTypes.classifiable.flat_map { |type| public_send(type.entity_type) }
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/lml/positioned"
4
+
5
+ module Lutaml
6
+ module Lml
7
+ # An enumeration declaration with its value members.
8
+ class Enum < Lutaml::Model::Serializable
9
+ include Lutaml::Lml::Positioned
10
+
11
+ # From TopElement
12
+ attribute :name, :string
13
+ attribute :definition, Lutaml::Lml::Types::TextType
14
+ attribute :keyword, :string, default: "enumeration"
15
+ attribute :stereotype, :string, collection: true, default: -> { [] }
16
+ attribute :visibility, :string, default: "public"
17
+
18
+ # From UmlClassifier
19
+ attribute :is_abstract, :boolean, default: false
20
+
21
+ # From Enum
22
+ attribute :attributes, "Lutaml::Lml::TopElementAttribute", collection: true,
23
+ default: -> { [] }
24
+ attribute :modifier, :string
25
+ attribute :member_fields, "Lutaml::Lml::MemberField", collection: true, default: -> { [] }
26
+ attribute :from_table_name, :string
27
+ attribute :from_table_artifact, :string
28
+ attribute :operations, "Lutaml::Lml::Operation", collection: true, default: -> { [] }
29
+ attribute :values, "Lutaml::Lml::Value", collection: true, default: -> { [] }
30
+
31
+ def self.entity_type
32
+ :enums
33
+ end
34
+
35
+ def self.classifiable?
36
+ false
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Lml
5
+ class Fidelity < Lutaml::Model::Serializable
6
+ attribute :hideMembers, :boolean
7
+ attribute :hideOtherClasses, :boolean
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Lml
5
+ class Group < Lutaml::Model::Serializable
6
+ attribute :id, :string
7
+ attribute :values, :string, collection: true
8
+ attribute :groups, "Lutaml::Lml::Group", collection: true
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/lml/positioned"
4
+
5
+ module Lutaml
6
+ module Lml
7
+ # An instance with attribute assignments.
8
+ class Instance < Lutaml::Model::Serializable
9
+ include Lutaml::Lml::Positioned
10
+
11
+ attribute :name, :string
12
+ attribute :type, :string
13
+ attribute :isa, :string
14
+ attribute :attributes, "Lutaml::Lml::TopElementAttribute", collection: true
15
+ attribute :instance, "Lutaml::Lml::Instance"
16
+ attribute :template, "Lutaml::Lml::TopElementAttribute", collection: true
17
+ attribute :parent, :string
18
+
19
+ def each_attribute
20
+ return enum_for(:each_attribute) unless block_given?
21
+
22
+ Array(attributes).each do |attr|
23
+ yield attr.name, attr.value, Array(attr.instances)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end