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.
- checksums.yaml +4 -4
- data/.github/workflows/dependent-repos-tools-informational.json +8 -0
- data/.github/workflows/dependent-repos-tools.json +1 -5
- data/.github/workflows/dependent-tests.yml +26 -2
- data/Gemfile +2 -0
- data/Rakefile +6 -0
- data/exe/lutaml-lml-lsp +11 -0
- data/lib/compat/opal/generate_boot.rb +12 -5
- data/lib/compat/opal/lutaml_model_boot.rb +96 -4
- data/lib/lutaml/lml/association_label_resolver.rb +52 -0
- data/lib/lutaml/lml/data_processor/attribute_processing.rb +133 -0
- data/lib/lutaml/lml/data_processor/collection_processing.rb +37 -0
- data/lib/lutaml/lml/data_processor/instance_processing.rb +77 -0
- data/lib/lutaml/lml/data_processor/value_declaration_processing.rb +70 -0
- data/lib/lutaml/lml/data_processor/value_processing.rb +103 -0
- data/lib/lutaml/lml/data_processor/view_processing.rb +26 -0
- data/lib/lutaml/lml/data_processor.rb +66 -0
- data/lib/lutaml/lml/diagnostic.rb +149 -0
- data/lib/lutaml/lml/document_builder.rb +486 -0
- data/lib/lutaml/lml/entity_types.rb +31 -0
- data/lib/lutaml/lml/executor/adapter_helpers.rb +45 -0
- data/lib/lutaml/lml/executor/condition_evaluator.rb +175 -0
- data/lib/lutaml/lml/executor/csv_adapter.rb +89 -0
- data/lib/lutaml/lml/executor/format_adapter.rb +54 -0
- data/lib/lutaml/lml/executor/xml_adapter.rb +102 -0
- data/lib/lutaml/lml/executor.rb +96 -0
- data/lib/lutaml/lml/format/adapter/document.rb +11 -0
- data/lib/lutaml/lml/format/adapter/mapping.rb +31 -0
- data/lib/lutaml/lml/format/adapter/standard_adapter.rb +164 -0
- data/lib/lutaml/lml/format/adapter/transform.rb +11 -0
- data/lib/lutaml/lml/format.rb +34 -0
- data/lib/lutaml/lml/formatter/base.rb +81 -0
- data/lib/lutaml/lml/formatter/canonical.rb +738 -0
- data/lib/lutaml/lml/formatter.rb +11 -0
- data/lib/lutaml/lml/grammar/lml.artifact.json +14993 -0
- data/lib/lutaml/lml/grammar/lml.parg +389 -0
- data/lib/lutaml/lml/grammar.rb +60 -0
- data/lib/lutaml/lml/has_attributes.rb +14 -0
- data/lib/lutaml/lml/import_resolver.rb +96 -0
- data/lib/lutaml/lml/layout/engine.rb +17 -0
- data/lib/lutaml/lml/layout.rb +9 -0
- data/lib/lutaml/lml/literal_value.rb +32 -0
- data/lib/lutaml/lml/lsp/conversions.rb +78 -0
- data/lib/lutaml/lml/lsp/keywords.rb +43 -0
- data/lib/lutaml/lml/lsp/server.rb +380 -0
- data/lib/lutaml/lml/lsp/store.rb +68 -0
- data/lib/lutaml/lml/lsp/transport.rb +53 -0
- data/lib/lutaml/lml/lsp.rb +16 -0
- data/lib/lutaml/lml/model_compiler/enums.rb +170 -0
- data/lib/lutaml/lml/model_compiler/hydration.rb +122 -0
- data/lib/lutaml/lml/model_compiler/serialization_mappings.rb +188 -0
- data/lib/lutaml/lml/model_compiler/string_formats.rb +42 -0
- data/lib/lutaml/lml/model_compiler/validation.rb +65 -0
- data/lib/lutaml/lml/model_compiler.rb +329 -0
- data/lib/lutaml/lml/models/action.rb +10 -0
- data/lib/lutaml/lml/models/association.rb +31 -0
- data/lib/lutaml/lml/models/cardinality.rb +10 -0
- data/lib/lutaml/lml/models/collection.rb +11 -0
- data/lib/lutaml/lml/models/constraint.rb +25 -0
- data/lib/lutaml/lml/models/data_type.rb +43 -0
- data/lib/lutaml/lml/models/derived_field.rb +14 -0
- data/lib/lutaml/lml/models/diagram.rb +22 -0
- data/lib/lutaml/lml/models/document.rb +86 -0
- data/lib/lutaml/lml/models/enum.rb +40 -0
- data/lib/lutaml/lml/models/fidelity.rb +10 -0
- data/lib/lutaml/lml/models/group.rb +11 -0
- data/lib/lutaml/lml/models/instance.rb +28 -0
- data/lib/lutaml/lml/models/instance_collection.rb +18 -0
- data/lib/lutaml/lml/models/instances_export.rb +10 -0
- data/lib/lutaml/lml/models/instances_import.rb +11 -0
- data/lib/lutaml/lml/models/mapping.rb +15 -0
- data/lib/lutaml/lml/models/mapping_rule.rb +16 -0
- data/lib/lutaml/lml/models/member_field.rb +16 -0
- data/lib/lutaml/lml/models/namespace.rb +18 -0
- data/lib/lutaml/lml/models/operation.rb +28 -0
- data/lib/lutaml/lml/models/operation_parameter.rb +12 -0
- data/lib/lutaml/lml/models/package.rb +28 -0
- data/lib/lutaml/lml/models/primitive_type.rb +35 -0
- data/lib/lutaml/lml/models/reference.rb +23 -0
- data/lib/lutaml/lml/models/serialization_mapping.rb +21 -0
- data/lib/lutaml/lml/models/string_format.rb +16 -0
- data/lib/lutaml/lml/models/top_element_attribute.rb +118 -0
- data/lib/lutaml/lml/models/uml_class.rb +87 -0
- data/lib/lutaml/lml/models/value.rb +17 -0
- data/lib/lutaml/lml/models/view_filter.rb +11 -0
- data/lib/lutaml/lml/models/view_import.rb +11 -0
- data/lib/lutaml/lml/parser.rb +19 -0
- data/lib/lutaml/lml/pipeline.rb +73 -0
- data/lib/lutaml/lml/positioned.rb +13 -0
- data/lib/lutaml/lml/preprocessor.rb +132 -0
- data/lib/lutaml/lml/quoting.rb +60 -0
- data/lib/lutaml/lml/source.rb +49 -0
- data/lib/lutaml/lml/source_position.rb +20 -0
- data/lib/lutaml/lml/symbol_index.rb +202 -0
- data/lib/lutaml/lml/transform.rb +119 -0
- data/lib/lutaml/lml/types/text_type.rb +28 -0
- data/lib/lutaml/lml/types.rb +10 -0
- data/lib/lutaml/lml/validator.rb +460 -0
- data/lib/lutaml/lml/view_resolution.rb +32 -0
- data/lib/lutaml/lml/view_resolver.rb +48 -0
- data/lib/lutaml/lml/yaml_parser.rb +17 -0
- data/lib/lutaml/lml.rb +130 -0
- data/lib/lutaml/model/adapter_resolver.rb +21 -2
- data/lib/lutaml/model/config.rb +22 -0
- data/lib/lutaml/model/serialize/format_conversion.rb +8 -6
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/xml/adapter/base_adapter.rb +26 -0
- data/lib/lutaml/xml/adapter/moxml_adapter.rb +49 -0
- data/lib/lutaml/xml/adapter/xml_parser.rb +4 -4
- data/lib/lutaml/xml/adapter/xml_serializer.rb +1 -1
- data/lib/lutaml/xml/adapter.rb +5 -0
- data/lib/lutaml/xml/adapter_loader.rb +5 -0
- data/lib/lutaml/xml/format.rb +23 -2
- data/lib/lutaml/xml/leptris/native_emission.rb +6 -1
- data/lib/lutaml/xml/leptris/plan_serializer.rb +5 -1
- data/lib/lutaml/xml/parse_session.rb +8 -1
- data/lib/lutaml/xml/schema/builder/moxml.rb +1 -1
- data/lib/lutaml/xml/schema/builder.rb +1 -1
- data/lib/lutaml/xml/schema/relaxng_schema.rb +1 -1
- data/lib/lutaml/xml/schema/vc_namespace.rb +24 -0
- data/lib/lutaml/xml/schema/xsd/any.rb +4 -0
- data/lib/lutaml/xml/schema/xsd/any_attribute.rb +4 -0
- data/lib/lutaml/xml/schema/xsd/base.rb +7 -0
- data/lib/lutaml/xml/schema/xsd/schema.rb +38 -0
- data/lib/lutaml/xml/schema/xsd/schema_validator.rb +1 -1
- data/lib/lutaml/xml/schema/xsd.rb +1 -0
- data/lib/lutaml/xml/schema/xsd_schema.rb +1 -1
- data/lib/lutaml/xml/serialization/format_conversion.rb +6 -0
- data/lib/lutaml/xml/xsd_validator.rb +1 -1
- data/lutaml-model.gemspec +2 -0
- data/spec/lml/fixtures/dsl/broken_diagram.lutaml +34 -0
- data/spec/lml/fixtures/dsl/diagram.lutaml +4 -0
- data/spec/lml/fixtures/dsl/diagram_attributes.lutaml +6 -0
- data/spec/lml/fixtures/dsl/diagram_blank_definion.lutaml +6 -0
- data/spec/lml/fixtures/dsl/diagram_blank_entities.lutaml +8 -0
- data/spec/lml/fixtures/dsl/diagram_class_assocation.lutaml +29 -0
- data/spec/lml/fixtures/dsl/diagram_class_fields.lutaml +25 -0
- data/spec/lml/fixtures/dsl/diagram_commented_includes.lutaml +5 -0
- data/spec/lml/fixtures/dsl/diagram_comments.lutaml +28 -0
- data/spec/lml/fixtures/dsl/diagram_concept_model.lutaml +132 -0
- data/spec/lml/fixtures/dsl/diagram_data_types.lutaml +44 -0
- data/spec/lml/fixtures/dsl/diagram_definitions.lutaml +25 -0
- data/spec/lml/fixtures/dsl/diagram_includes.lutaml +6 -0
- data/spec/lml/fixtures/dsl/diagram_multiply_classes.lutaml +7 -0
- data/spec/lml/fixtures/dsl/diagram_non_existing_include.lutaml +6 -0
- data/spec/lml/fixtures/dsl/shared.lutaml +5 -0
- data/spec/lml/fixtures/dsl/shared1.lutaml +4 -0
- data/spec/lml/fixtures/generated_dot/AddressClassProfile.dot +170 -0
- data/spec/lml/fixtures/generated_dot/AddressProfile.dot +34 -0
- data/spec/lml/fixtures/generated_dot/address_class_profile_with_associations.dot +127 -0
- data/spec/lml/fixtures/generated_dot/address_profile_with_associations.dot +28 -0
- data/spec/lml/fixtures/generated_dot/document.dot +28 -0
- data/spec/lml/fixtures/generated_dot/document.dot.backup +33 -0
- data/spec/lml/fixtures/generated_dot/document_with_fidelity.dot +27 -0
- data/spec/lml/fixtures/lml/data_s102_check.lml +79 -0
- data/spec/lml/fixtures/lml/data_s158_metadata.lml +28 -0
- data/spec/lml/fixtures/lml/iho_data_models.lml +59 -0
- data/spec/lml/fixtures/lml/iho_s102_check.lml +101 -0
- data/spec/lml/fixtures/mixed_lml/diagram.lml +26 -0
- data/spec/lml/fixtures/mixed_lml/instances.lml +72 -0
- data/spec/lml/fixtures/mixed_lml/model.lml +30 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/AdmonitionType.lutaml +32 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/BasicBlock.lutaml +11 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/BasicDocument.lutaml +41 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/BasicSection.lutaml +38 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/BibliographicItem.lutaml +6 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/FigureBlock.lutaml +65 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/FormattedString.lutaml +12 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/List.lutaml +12 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/OrderedListType.lutaml +32 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/Signature.lutaml +22 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/String.lutaml +2 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/TableBlock.lutaml +60 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/TextElement.lutaml +13 -0
- data/spec/lml/fixtures/real_world/basicdoc-models/Uri.lutaml +7 -0
- data/spec/lml/fixtures/real_world/metanorma-model-iso/BibliographicItem.lutaml +4 -0
- data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoAdmonitionType.lutaml +31 -0
- data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoBibDataExtensionType.lutaml +40 -0
- data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoSections.lutaml +30 -0
- data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoStandardDocument.lutaml +46 -0
- data/spec/lml/fixtures/real_world/metanorma-model-iso/IsoTerm.lutaml +20 -0
- data/spec/lml/fixtures/real_world/metanorma-model-iso/StandardBibDataExtensionType.lutaml +2 -0
- data/spec/lml/fixtures/real_world/metanorma-model-iso/StandardDocument.lutaml +2 -0
- data/spec/lml/fixtures/rs3001/01_class_tail_comment.lml +5 -0
- data/spec/lml/fixtures/rs3001/02_definition_block.lml +9 -0
- data/spec/lml/fixtures/rs3001/03_package_ceramics.lml +20 -0
- data/spec/lml/fixtures/rs3001/04_attribute_definition_form.lml +10 -0
- data/spec/lml/fixtures/rs3001/05_attribute_cardinality_unbounded.lml +10 -0
- data/spec/lml/fixtures/rs3001/06_attribute_values_set.lml +10 -0
- data/spec/lml/fixtures/rs3001/07_attribute_pattern.lml +10 -0
- data/spec/lml/fixtures/rs3001/08_attribute_default_colon.lml +15 -0
- data/spec/lml/fixtures/rs3001/09_value_porcelain.lml +9 -0
- data/spec/lml/fixtures/rs3001/10_enum_glaze_technique.lml +19 -0
- data/spec/lml/fixtures/rs3001/11_enum_values_as_instances.lml +29 -0
- data/spec/lml/fixtures/rs3001/12_instance_named.lml +13 -0
- data/spec/lml/fixtures/rs3001/13_instances_collection_refs.lml +11 -0
- data/spec/lml/fixtures/rs3001/14_require_models.lml +7 -0
- data/spec/lml/fixtures/rs3001/15_comment_line.lml +1 -0
- data/spec/lml/fixtures/rs3001/16_comment_tail.lml +5 -0
- data/spec/lml/fixtures/rs3001/17_comment_documented_class.lml +5 -0
- data/spec/lml/fixtures/rs3001/18_comment_block.lml +4 -0
- data/spec/lml/fixtures/rs3001/19_top_level_instance_definition.lml +21 -0
- data/spec/lml/fixtures/rs3001/20_instance_typed_definition.lml +22 -0
- data/spec/lml/fixtures/rs3001/21_instance_collection_studios.lml +19 -0
- data/spec/lml/fixtures/rs3001/22_instance_collection_tiles.lml +15 -0
- data/spec/lml/fixtures/rs3001/23_reference_cross_collection.lml +11 -0
- data/spec/lml/fixtures/rs3001/24_null_and_empty.lml +15 -0
- data/spec/lml/fixtures/rs3001/25_string_escapes.lml +23 -0
- data/spec/lml/fixtures/rs3001/26_quoted_keys.lml +7 -0
- data/spec/lml/fixtures/test.lutaml +20 -0
- data/spec/lml/fixtures/test_data/components.csv +4 -0
- data/spec/lml/fixtures/test_data/products.xml +18 -0
- data/spec/lml/fixtures/uml/address_class_profile_with_associations.yml +58 -0
- data/spec/lml/fixtures/uml/address_profile_with_associations.yml +31 -0
- data/spec/lml/fixtures/uml/association.yml +11 -0
- data/spec/lml/fixtures/uml/class.yml +28 -0
- data/spec/lml/fixtures/uml/data_type.yml +30 -0
- data/spec/lml/fixtures/uml/diagram.yml +7 -0
- data/spec/lml/fixtures/uml/document.yml +44 -0
- data/spec/lml/fixtures/uml/document_with_fidelity.yml +47 -0
- data/spec/lml/fixtures/uml/enum.yml +14 -0
- data/spec/lml/fixtures/uml/operation.yml +8 -0
- data/spec/lml/fixtures/uml/package.yml +10 -0
- data/spec/lml/fixtures/uml/top_element.yml +11 -0
- data/spec/lml/fixtures/uml/top_element_attribute.yml +10 -0
- data/spec/lml/fixtures/uml/trigger.yml +12 -0
- data/spec/lml/fixtures/uml/value.yml +8 -0
- data/spec/lml/fixtures/view/cycle_a.lutaml +3 -0
- data/spec/lml/fixtures/view/cycle_b.lutaml +3 -0
- data/spec/lml/fixtures/view/import_model.lutaml +3 -0
- data/spec/lml/fixtures/view/import_view.lutaml +3 -0
- data/spec/lml/fixtures/view/import_with_hide.lutaml +4 -0
- data/spec/lml/fixtures/view/import_with_show.lutaml +4 -0
- data/spec/lml/fixtures/view/models/bar.lutaml +3 -0
- data/spec/lml/fixtures/view/models/baz.lutaml +3 -0
- data/spec/lml/fixtures/view/models/foo.lutaml +4 -0
- data/spec/lml/integration/instance_import_export_spec.rb +102 -0
- data/spec/lml/lml_spec_setup.rb +25 -0
- data/spec/lml/lutaml/lml/association_label_resolver_spec.rb +139 -0
- data/spec/lml/lutaml/lml/data_processor_spec.rb +274 -0
- data/spec/lml/lutaml/lml/declarations_spec.rb +337 -0
- data/spec/lml/lutaml/lml/document_builder_registry_spec.rb +52 -0
- data/spec/lml/lutaml/lml/document_builder_spec.rb +99 -0
- data/spec/lml/lutaml/lml/element_visibility_spec.rb +128 -0
- data/spec/lml/lutaml/lml/entity_types_spec.rb +56 -0
- data/spec/lml/lutaml/lml/enum_spec.rb +77 -0
- data/spec/lml/lutaml/lml/executor/adapter_helpers_spec.rb +96 -0
- data/spec/lml/lutaml/lml/executor/condition_evaluator_spec.rb +393 -0
- data/spec/lml/lutaml/lml/executor/csv_adapter_spec.rb +151 -0
- data/spec/lml/lutaml/lml/executor/format_adapter_spec.rb +31 -0
- data/spec/lml/lutaml/lml/executor/xml_adapter_spec.rb +201 -0
- data/spec/lml/lutaml/lml/executor_spec.rb +71 -0
- data/spec/lml/lutaml/lml/format_adapter_spec.rb +272 -0
- data/spec/lml/lutaml/lml/format_autoload_spec.rb +31 -0
- data/spec/lml/lutaml/lml/grammar_spec.rb +581 -0
- data/spec/lml/lutaml/lml/has_attributes_spec.rb +54 -0
- data/spec/lml/lutaml/lml/import_resolver_spec.rb +116 -0
- data/spec/lml/lutaml/lml/instance_hydration_spec.rb +178 -0
- data/spec/lml/lutaml/lml/lsp/server_spec.rb +285 -0
- data/spec/lml/lutaml/lml/model_compiler_spec.rb +406 -0
- data/spec/lml/lutaml/lml/models/association_spec.rb +40 -0
- data/spec/lml/lutaml/lml/models/collection_spec.rb +27 -0
- data/spec/lml/lutaml/lml/models/data_type_spec.rb +34 -0
- data/spec/lml/lutaml/lml/models/diagram_spec.rb +18 -0
- data/spec/lml/lutaml/lml/models/document_spec.rb +64 -0
- data/spec/lml/lutaml/lml/models/enum_spec.rb +42 -0
- data/spec/lml/lutaml/lml/models/inheritance_spec.rb +77 -0
- data/spec/lml/lutaml/lml/models/instance_collection_spec.rb +62 -0
- data/spec/lml/lutaml/lml/models/instance_spec.rb +81 -0
- data/spec/lml/lutaml/lml/models/instances_export_spec.rb +23 -0
- data/spec/lml/lutaml/lml/models/instances_import_spec.rb +28 -0
- data/spec/lml/lutaml/lml/models/package_spec.rb +26 -0
- data/spec/lml/lutaml/lml/models/primitive_type_spec.rb +34 -0
- data/spec/lml/lutaml/lml/models/top_element_attribute_spec.rb +153 -0
- data/spec/lml/lutaml/lml/models/uml_class_spec.rb +70 -0
- data/spec/lml/lutaml/lml/models_version_spec.rb +27 -0
- data/spec/lml/lutaml/lml/operations_spec.rb +59 -0
- data/spec/lml/lutaml/lml/parser_spec.rb +348 -0
- data/spec/lml/lutaml/lml/pipeline_spec.rb +93 -0
- data/spec/lml/lutaml/lml/preprocessor_spec.rb +174 -0
- data/spec/lml/lutaml/lml/property_laws_spec.rb +344 -0
- data/spec/lml/lutaml/lml/real_world_spec.rb +191 -0
- data/spec/lml/lutaml/lml/reference_spec.rb +64 -0
- data/spec/lml/lutaml/lml/round_trip_spec.rb +457 -0
- data/spec/lml/lutaml/lml/rs3001_corpus_spec.rb +83 -0
- data/spec/lml/lutaml/lml/rs3001_syntax_spec.rb +77 -0
- data/spec/lml/lutaml/lml/serialization_mapping_spec.rb +127 -0
- data/spec/lml/lutaml/lml/source_spec.rb +62 -0
- data/spec/lml/lutaml/lml/transform_spec.rb +37 -0
- data/spec/lml/lutaml/lml/types/text_type_spec.rb +43 -0
- data/spec/lml/lutaml/lml/validator_spec.rb +238 -0
- data/spec/lml/lutaml/lml/view_resolver_spec.rb +78 -0
- data/spec/lml/lutaml/lml/view_spec.rb +112 -0
- data/spec/lml/lutaml/parsers/dsl_spec.rb +275 -0
- data/spec/lml/lutaml/parsers/yaml_spec.rb +52 -0
- data/spec/lml/lutaml/qualified_type_spec.rb +33 -0
- data/spec/lutaml/model/adapter_type_unset_restore_spec.rb +61 -0
- data/spec/lutaml/model/custom_bibtex_adapter_spec.rb +4 -1
- data/spec/lutaml/xml/adapter/moxml_lane_spec.rb +112 -0
- data/spec/lutaml/xml/adapter_metadata_default_spec.rb +21 -2
- data/spec/lutaml/xml/adapter_moxml_engine_spec.rb +57 -0
- data/spec/lutaml/xml/leptris/native_emission_plain_model_spec.rb +50 -0
- data/spec/lutaml/xml/plain_model_mapping_resolution_spec.rb +88 -0
- data/spec/lutaml/xml/schema/xsd/vc_versioning_spec.rb +49 -0
- data/spec/lutaml/xml/schema/xsd/xsd_11_constructs_spec.rb +43 -0
- metadata +286 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
lml "1.0"
|
|
2
|
+
|
|
3
|
+
class CeramicTile {
|
|
4
|
+
definition "Types of ceramic tiles."
|
|
5
|
+
|
|
6
|
+
attribute dimensions {
|
|
7
|
+
type Float
|
|
8
|
+
cardinality 2
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
attribute firing_profile, FiringProfile
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
CeramicTile "square" {
|
|
15
|
+
dimensions = [30.5, 30.5]
|
|
16
|
+
|
|
17
|
+
firing_profile = "high"
|
|
18
|
+
|
|
19
|
+
definition {
|
|
20
|
+
A square ceramic tile used for various applications.
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
lml "1.0"
|
|
2
|
+
|
|
3
|
+
models Glaze {
|
|
4
|
+
class Glaze {
|
|
5
|
+
attribute name, String
|
|
6
|
+
|
|
7
|
+
attribute description, String
|
|
8
|
+
|
|
9
|
+
attribute note, String
|
|
10
|
+
|
|
11
|
+
attribute retired, String
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
instance "Glaze" {
|
|
16
|
+
name = "Raku \"kiln\" fired"
|
|
17
|
+
|
|
18
|
+
description = "say \"hi\" and 'bye'"
|
|
19
|
+
|
|
20
|
+
note = ""
|
|
21
|
+
|
|
22
|
+
retired = null
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
diagram MyView {
|
|
2
|
+
title "my diagram"
|
|
3
|
+
|
|
4
|
+
class AddressClassProfile {
|
|
5
|
+
definition {
|
|
6
|
+
this is multiline with `ascidoc`
|
|
7
|
+
comments
|
|
8
|
+
and list
|
|
9
|
+
}
|
|
10
|
+
+addressClassProfile: CharacterString [0..1]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
class AttributeProfile {
|
|
14
|
+
imlicistAttributeProfile: CharacterString [0..1] {
|
|
15
|
+
definition { this is attribute definition
|
|
16
|
+
with multiply lines
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Products>
|
|
3
|
+
<Product>
|
|
4
|
+
<id>P001</id>
|
|
5
|
+
<name>Widget</name>
|
|
6
|
+
<price>9.99</price>
|
|
7
|
+
</Product>
|
|
8
|
+
<Product>
|
|
9
|
+
<id>P002</id>
|
|
10
|
+
<name>Gadget</name>
|
|
11
|
+
<price>14.50</price>
|
|
12
|
+
</Product>
|
|
13
|
+
<Product>
|
|
14
|
+
<id>P003</id>
|
|
15
|
+
<name>Gizmo</name>
|
|
16
|
+
<price>3.00</price>
|
|
17
|
+
</Product>
|
|
18
|
+
</Products>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: TestDocument
|
|
3
|
+
title: Test Document Title
|
|
4
|
+
classes:
|
|
5
|
+
- name: AddressClassProfile
|
|
6
|
+
associations:
|
|
7
|
+
- member_end: AttributeProfile
|
|
8
|
+
owner_end_attribute_name: addressClassProfile
|
|
9
|
+
member_end_attribute_name: attributeProfile
|
|
10
|
+
owner_end_type: aggregation
|
|
11
|
+
member_end_type: direct
|
|
12
|
+
- member_end: ProfileCompliantAddress
|
|
13
|
+
owner_end_attribute_name: profile
|
|
14
|
+
owner_end_cardinality:
|
|
15
|
+
min: '1'
|
|
16
|
+
max: "1"
|
|
17
|
+
action:
|
|
18
|
+
verb: compliesWith
|
|
19
|
+
direction: source
|
|
20
|
+
- name: AttributeProfile
|
|
21
|
+
- name: AddressProfile
|
|
22
|
+
associations:
|
|
23
|
+
- member_end: AddressComponentProfile
|
|
24
|
+
owner_end_attribute_name: componentProfile
|
|
25
|
+
owner_end_type: aggregation
|
|
26
|
+
owner_end_cardinality:
|
|
27
|
+
min: '0'
|
|
28
|
+
max: "*"
|
|
29
|
+
action:
|
|
30
|
+
verb: defines
|
|
31
|
+
direction: target
|
|
32
|
+
- member_end: AddressClassProfile
|
|
33
|
+
owner_end_type: aggregation
|
|
34
|
+
owner_end_attribute_name: addressProfile
|
|
35
|
+
owner_end_cardinality:
|
|
36
|
+
min: '0'
|
|
37
|
+
max: "*"
|
|
38
|
+
action:
|
|
39
|
+
verb: defines
|
|
40
|
+
direction: target
|
|
41
|
+
- name: AddressComponentProfile
|
|
42
|
+
associations:
|
|
43
|
+
- member_end: AddressClassProfile
|
|
44
|
+
member_end_attribute_name: componentProfile
|
|
45
|
+
member_end_type: aggregation
|
|
46
|
+
action:
|
|
47
|
+
verb: uses
|
|
48
|
+
direction: source
|
|
49
|
+
- member_end: AttributeProfile
|
|
50
|
+
member_end_attribute_name: attributeProfile
|
|
51
|
+
owner_end_attribute_name: addressClassProfile
|
|
52
|
+
owner_end_type: aggregation
|
|
53
|
+
member_end_type: direct
|
|
54
|
+
- name: ProfileCompliantAddress
|
|
55
|
+
- name: InterchangeAddressClassProfile
|
|
56
|
+
associations:
|
|
57
|
+
- member_end: AddressClassProfile
|
|
58
|
+
member_end_type: relation
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: TestDocument
|
|
3
|
+
title: Test Document Title
|
|
4
|
+
classes:
|
|
5
|
+
- name: AddressProfile
|
|
6
|
+
attributes:
|
|
7
|
+
- name: country
|
|
8
|
+
type: iso3166Code
|
|
9
|
+
definition: The country of which this AddressProfile represents.
|
|
10
|
+
cardinality:
|
|
11
|
+
min: 0
|
|
12
|
+
max: "*"
|
|
13
|
+
associations:
|
|
14
|
+
- member_end: AddressComponentProfile
|
|
15
|
+
owner_end_type: aggregation
|
|
16
|
+
owner_end_attribute_name: componentProfile
|
|
17
|
+
owner_end_cardinality:
|
|
18
|
+
min: '0'
|
|
19
|
+
max: "*"
|
|
20
|
+
action:
|
|
21
|
+
verb: defines
|
|
22
|
+
direction: target
|
|
23
|
+
- member_end: AddressClassProfile
|
|
24
|
+
owner_end_type: aggregation
|
|
25
|
+
owner_end_attribute_name: addressProfile
|
|
26
|
+
owner_end_cardinality:
|
|
27
|
+
min: '0'
|
|
28
|
+
max: "*"
|
|
29
|
+
action:
|
|
30
|
+
verb: defines
|
|
31
|
+
direction: target
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
visibility: public
|
|
3
|
+
owner_end: _Curve
|
|
4
|
+
owner_end_xmi_id: EAID_83B2B411_0579_4e2d_823D_D22BF0F06064
|
|
5
|
+
member_end: MultiCurve
|
|
6
|
+
member_end_attribute_name: MultiCurve
|
|
7
|
+
member_end_type: association
|
|
8
|
+
member_end_xmi_id: EAID_B326682E_0384_443a_A119_96FD046071A2
|
|
9
|
+
member_end_cardinality:
|
|
10
|
+
min: '1'
|
|
11
|
+
max: "*"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: _Curve
|
|
3
|
+
xmi_id: EAID_83B2B411_0579_4e2d_823D_D22BF0F06064
|
|
4
|
+
stereotype: Type
|
|
5
|
+
visibility: public
|
|
6
|
+
generalization:
|
|
7
|
+
- id: EAID_97DD0658_254B_46b8_86F2_92CA5FFAE8AC
|
|
8
|
+
type: uml:Generalization
|
|
9
|
+
general: EAID_7FAB8425_4E7D_42e8_94F2_901B0F0C0300
|
|
10
|
+
is_abstract: true
|
|
11
|
+
type: Class
|
|
12
|
+
associations:
|
|
13
|
+
- xmi_id: EAID_35192687_3A64_4b1c_A68E_C5B1D1BB7E8A
|
|
14
|
+
visibility: public
|
|
15
|
+
owner_end: _Curve
|
|
16
|
+
owner_end_xmi_id: EAID_83B2B411_0579_4e2d_823D_D22BF0F06064
|
|
17
|
+
member_end: MultiCurve
|
|
18
|
+
member_end_attribute_name: MultiCurve
|
|
19
|
+
member_end_xmi_id: EAID_B326682E_0384_443a_A119_96FD046071A2
|
|
20
|
+
member_end_type: association
|
|
21
|
+
- xmi_id: EAID_61081D6B_9F19_4108_818A_C69575DC6F41
|
|
22
|
+
visibility: public
|
|
23
|
+
owner_end: _Curve
|
|
24
|
+
owner_end_xmi_id: EAID_83B2B411_0579_4e2d_823D_D22BF0F06064
|
|
25
|
+
member_end: CompositeCurve
|
|
26
|
+
member_end_attribute_name: CompositeCurve
|
|
27
|
+
member_end_xmi_id: EAID_2943D7B6_E646_4e7f_85AA_702C1DF22FBE
|
|
28
|
+
member_end_type: association
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: TestDataType
|
|
3
|
+
namespace:
|
|
4
|
+
name: TestNamespace
|
|
5
|
+
namespace:
|
|
6
|
+
name: NestedNamespace
|
|
7
|
+
definition: |
|
|
8
|
+
This is a test definition.
|
|
9
|
+
It spans multiple lines.
|
|
10
|
+
It should be formatted correctly.
|
|
11
|
+
associations:
|
|
12
|
+
- member_end: TestAssociation
|
|
13
|
+
member_end_cardinality:
|
|
14
|
+
min: '1'
|
|
15
|
+
max: "*"
|
|
16
|
+
operations:
|
|
17
|
+
- name: TestOperation1
|
|
18
|
+
return_type: TestReturnType1
|
|
19
|
+
parameter_type: TestParameter1
|
|
20
|
+
definition: |-
|
|
21
|
+
This is a test definition.
|
|
22
|
+
It spans multiple lines.
|
|
23
|
+
It should be formatted correctly.
|
|
24
|
+
- name: TestOperation2
|
|
25
|
+
return_type: TestReturnType2
|
|
26
|
+
parameter_type: TestParameter2
|
|
27
|
+
definition: |-
|
|
28
|
+
This is a test definition 2.
|
|
29
|
+
It spans multiple lines.
|
|
30
|
+
It should be formatted correctly.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: TestDocument
|
|
3
|
+
title: Test Document Title
|
|
4
|
+
groups:
|
|
5
|
+
- id: TestGroup1
|
|
6
|
+
values:
|
|
7
|
+
- TestGroup1a
|
|
8
|
+
- TestGroup1b
|
|
9
|
+
- id: TestGroup2
|
|
10
|
+
values:
|
|
11
|
+
- TestGroup2a
|
|
12
|
+
- TestGroup2b
|
|
13
|
+
- TestGroup2c
|
|
14
|
+
groups:
|
|
15
|
+
- id: TestSubGroup1
|
|
16
|
+
values:
|
|
17
|
+
- TestSubGroup1a
|
|
18
|
+
- TestSubGroup1b
|
|
19
|
+
enums:
|
|
20
|
+
- name: TestEnum
|
|
21
|
+
definition: |-
|
|
22
|
+
This is a test definition.
|
|
23
|
+
It spans multiple lines.
|
|
24
|
+
It should be formatted correctly.
|
|
25
|
+
attributes:
|
|
26
|
+
- name: TestAttribute
|
|
27
|
+
visibility: private
|
|
28
|
+
cardinality:
|
|
29
|
+
min: '1'
|
|
30
|
+
max: "*"
|
|
31
|
+
values:
|
|
32
|
+
- name: Test value
|
|
33
|
+
packages:
|
|
34
|
+
- name: Package
|
|
35
|
+
contents:
|
|
36
|
+
- This is a nested package content.
|
|
37
|
+
packages:
|
|
38
|
+
- name: NestedPackage
|
|
39
|
+
contents:
|
|
40
|
+
- This is a nested package content.
|
|
41
|
+
packages:
|
|
42
|
+
- name: DeepNestedPackage
|
|
43
|
+
contents:
|
|
44
|
+
- This is a deep nested package content.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: TestDocument
|
|
3
|
+
title: Test Document Title
|
|
4
|
+
groups:
|
|
5
|
+
- id: TestGroup1
|
|
6
|
+
values:
|
|
7
|
+
- TestGroup1a
|
|
8
|
+
- TestGroup1b
|
|
9
|
+
- id: TestGroup2
|
|
10
|
+
values:
|
|
11
|
+
- TestGroup2a
|
|
12
|
+
- TestGroup2b
|
|
13
|
+
- TestGroup2c
|
|
14
|
+
groups:
|
|
15
|
+
- id: TestSubGroup1
|
|
16
|
+
values:
|
|
17
|
+
- TestSubGroup1a
|
|
18
|
+
- TestSubGroup1b
|
|
19
|
+
enums:
|
|
20
|
+
- name: TestEnum
|
|
21
|
+
definition: |-
|
|
22
|
+
This is a test definition.
|
|
23
|
+
It spans multiple lines.
|
|
24
|
+
It should be formatted correctly.
|
|
25
|
+
attributes:
|
|
26
|
+
- name: TestAttribute
|
|
27
|
+
visibility: private
|
|
28
|
+
cardinality:
|
|
29
|
+
min: '1'
|
|
30
|
+
max: "*"
|
|
31
|
+
values:
|
|
32
|
+
- name: Test value
|
|
33
|
+
packages:
|
|
34
|
+
- name: Package
|
|
35
|
+
contents:
|
|
36
|
+
- This is a nested package content.
|
|
37
|
+
packages:
|
|
38
|
+
- name: NestedPackage
|
|
39
|
+
contents:
|
|
40
|
+
- This is a nested package content.
|
|
41
|
+
packages:
|
|
42
|
+
- name: DeepNestedPackage
|
|
43
|
+
contents:
|
|
44
|
+
- This is a deep nested package content.
|
|
45
|
+
fidelity:
|
|
46
|
+
hideMembers: true
|
|
47
|
+
hideOtherClasses: true
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: TestEnum
|
|
3
|
+
definition: |-
|
|
4
|
+
This is a test definition.
|
|
5
|
+
It spans multiple lines.
|
|
6
|
+
It should be formatted correctly.
|
|
7
|
+
attributes:
|
|
8
|
+
- name: TestAttribute
|
|
9
|
+
visibility: private
|
|
10
|
+
cardinality:
|
|
11
|
+
min: '1'
|
|
12
|
+
max: "*"
|
|
13
|
+
values:
|
|
14
|
+
- name: Test value
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
require_relative "../lml_spec_setup"
|
|
5
|
+
require "lutaml/lml"
|
|
6
|
+
require "lutaml/lml/executor"
|
|
7
|
+
require "tmpdir"
|
|
8
|
+
|
|
9
|
+
RSpec.describe "End-to-end instance import/export", type: :integration do
|
|
10
|
+
let(:models_lml) do
|
|
11
|
+
<<~LML
|
|
12
|
+
models Catalog {
|
|
13
|
+
class Product {
|
|
14
|
+
attribute id { type String }
|
|
15
|
+
attribute name { type String }
|
|
16
|
+
attribute price { type String }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
LML
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
let(:input_xml) do
|
|
23
|
+
<<~XML
|
|
24
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
25
|
+
<Products>
|
|
26
|
+
<Product>
|
|
27
|
+
<id>P001</id>
|
|
28
|
+
<name>Widget</name>
|
|
29
|
+
<price>9.99</price>
|
|
30
|
+
</Product>
|
|
31
|
+
<Product>
|
|
32
|
+
<id>P002</id>
|
|
33
|
+
<name>Gadget</name>
|
|
34
|
+
<price>14.50</price>
|
|
35
|
+
</Product>
|
|
36
|
+
</Products>
|
|
37
|
+
XML
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
let(:workdir) { Dir.mktmpdir("lml-integration-") }
|
|
41
|
+
|
|
42
|
+
after do
|
|
43
|
+
FileUtils.rm_rf(workdir)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "compiles models, imports XML, validates, and exports XML" do
|
|
47
|
+
compiled = Lutaml::Lml.compile(StringIO.new(models_lml))
|
|
48
|
+
expect(compiled).to include("Product")
|
|
49
|
+
|
|
50
|
+
product_class = compiled["Product"]
|
|
51
|
+
expect(product_class).to respond_to(:from_xml)
|
|
52
|
+
expect(product_class.instance_method(:to_xml)).to be_an(UnboundMethod)
|
|
53
|
+
|
|
54
|
+
input_path = File.join(workdir, "products.xml")
|
|
55
|
+
output_path = File.join(workdir, "products_out.xml")
|
|
56
|
+
File.write(input_path, input_xml)
|
|
57
|
+
|
|
58
|
+
instances_lml = <<~LML
|
|
59
|
+
instances {
|
|
60
|
+
collection "all_products" {
|
|
61
|
+
validation {
|
|
62
|
+
condition "count >= 2"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
import {
|
|
67
|
+
xml "#{input_path}" {
|
|
68
|
+
map_to Product
|
|
69
|
+
where "/Products/Product"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
format xml {
|
|
75
|
+
file "#{output_path}"
|
|
76
|
+
root "Products"
|
|
77
|
+
indent true
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
LML
|
|
82
|
+
|
|
83
|
+
doc = Lutaml::Lml.parse_document(StringIO.new(instances_lml))
|
|
84
|
+
|
|
85
|
+
instances = Lutaml::Lml::Executor.run(doc, compiled: compiled)
|
|
86
|
+
|
|
87
|
+
expect(instances.length).to eq(2)
|
|
88
|
+
expect(instances[0]).to be_a(product_class)
|
|
89
|
+
expect(instances[0].id).to eq("P001")
|
|
90
|
+
expect(instances[0].name).to eq("Widget")
|
|
91
|
+
expect(instances[1].id).to eq("P002")
|
|
92
|
+
|
|
93
|
+
expect(File.exist?(output_path)).to be true
|
|
94
|
+
output = File.read(output_path)
|
|
95
|
+
expect(output).to include("<Products>")
|
|
96
|
+
expect(output).to include("<id>P001</id>")
|
|
97
|
+
expect(output).to include("<name>Widget</name>")
|
|
98
|
+
expect(output).to include("<id>P002</id>")
|
|
99
|
+
expect(output).to include("<name>Gadget</name>")
|
|
100
|
+
expect(output).to include("</Products>")
|
|
101
|
+
end
|
|
102
|
+
end
|