xmi 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +14 -0
- data/.github/workflows/release.yml +22 -0
- data/.rubocop.yml +6 -0
- data/README.adoc +87 -2
- data/lib/xmi/documentation.rb +6 -6
- data/lib/xmi/ea_root.rb +316 -0
- data/lib/xmi/extension.rb +5 -5
- data/lib/xmi/root.rb +43 -20
- data/lib/xmi/root13.rb +0 -1
- data/lib/xmi/sparx.rb +368 -154
- data/lib/xmi/uml.rb +422 -131
- data/lib/xmi/uml13/abstraction.rb +90 -88
- data/lib/xmi/uml13/action.rb +86 -84
- data/lib/xmi/uml13/action_sequence.rb +76 -74
- data/lib/xmi/uml13/action_sequenceaction.rb +23 -21
- data/lib/xmi/uml13/action_sequencestate.rb +7 -5
- data/lib/xmi/uml13/action_sequencestate2.rb +7 -5
- data/lib/xmi/uml13/action_sequencetransition.rb +7 -5
- data/lib/xmi/uml13/action_state.rb +89 -87
- data/lib/xmi/uml13/actionaction_sequence.rb +7 -5
- data/lib/xmi/uml13/actionactual_argument.rb +7 -5
- data/lib/xmi/uml13/actionis_asynchronous.rb +6 -4
- data/lib/xmi/uml13/actionmessage.rb +7 -5
- data/lib/xmi/uml13/actionrecurrence.rb +15 -13
- data/lib/xmi/uml13/actionrequest.rb +7 -5
- data/lib/xmi/uml13/actionscript.rb +7 -5
- data/lib/xmi/uml13/actiontarget.rb +7 -5
- data/lib/xmi/uml13/activity_model.rb +77 -75
- data/lib/xmi/uml13/activity_modelpartition.rb +7 -5
- data/lib/xmi/uml13/activity_state.rb +88 -86
- data/lib/xmi/uml13/actor.rb +113 -111
- data/lib/xmi/uml13/argument.rb +17 -15
- data/lib/xmi/uml13/argumentaction.rb +7 -5
- data/lib/xmi/uml13/argumentvalue.rb +15 -13
- data/lib/xmi/uml13/association.rb +90 -88
- data/lib/xmi/uml13/association_class.rb +120 -118
- data/lib/xmi/uml13/association_end.rb +100 -98
- data/lib/xmi/uml13/association_end_role.rb +106 -104
- data/lib/xmi/uml13/association_end_roleassociation_role.rb +7 -5
- data/lib/xmi/uml13/association_end_rolebase.rb +7 -5
- data/lib/xmi/uml13/association_endaggregation.rb +6 -4
- data/lib/xmi/uml13/association_endassociation.rb +7 -5
- data/lib/xmi/uml13/association_endassociation_end_role.rb +7 -5
- data/lib/xmi/uml13/association_endchangeable.rb +6 -4
- data/lib/xmi/uml13/association_endis_navigable.rb +6 -4
- data/lib/xmi/uml13/association_endis_ordered.rb +6 -4
- data/lib/xmi/uml13/association_endlink_end.rb +7 -5
- data/lib/xmi/uml13/association_endmultiplicity.rb +7 -5
- data/lib/xmi/uml13/association_endqualifier.rb +7 -5
- data/lib/xmi/uml13/association_endspecification.rb +7 -5
- data/lib/xmi/uml13/association_endtarget_scope.rb +6 -4
- data/lib/xmi/uml13/association_endtype.rb +7 -5
- data/lib/xmi/uml13/association_role.rb +95 -93
- data/lib/xmi/uml13/association_rolebase.rb +7 -5
- data/lib/xmi/uml13/association_rolemultiplicity.rb +7 -5
- data/lib/xmi/uml13/association_rolenamespace.rb +7 -5
- data/lib/xmi/uml13/associationassociation_end.rb +7 -5
- data/lib/xmi/uml13/associationconnection.rb +9 -7
- data/lib/xmi/uml13/associationlink.rb +7 -5
- data/lib/xmi/uml13/attribute.rb +94 -92
- data/lib/xmi/uml13/attribute_link.rb +74 -72
- data/lib/xmi/uml13/attribute_linkattribute.rb +7 -5
- data/lib/xmi/uml13/attribute_linkinstance.rb +7 -5
- data/lib/xmi/uml13/attribute_linkvalue.rb +7 -5
- data/lib/xmi/uml13/attributeassociation_end.rb +7 -5
- data/lib/xmi/uml13/attributeattribute_link.rb +7 -5
- data/lib/xmi/uml13/attributeinitial_value.rb +15 -13
- data/lib/xmi/uml13/auxiliary_elements.rb +28 -26
- data/lib/xmi/uml13/behavioral_elements.rb +18 -16
- data/lib/xmi/uml13/behavioral_feature.rb +82 -80
- data/lib/xmi/uml13/behavioral_featureis_query.rb +6 -4
- data/lib/xmi/uml13/behavioral_featureparameter.rb +7 -5
- data/lib/xmi/uml13/behavioral_featureraised_exception.rb +7 -5
- data/lib/xmi/uml13/binding.rb +81 -79
- data/lib/xmi/uml13/bindingargument.rb +175 -173
- data/lib/xmi/uml13/boolean_expression.rb +18 -16
- data/lib/xmi/uml13/call_action.rb +89 -87
- data/lib/xmi/uml13/call_actionmode.rb +6 -4
- data/lib/xmi/uml13/call_event.rb +74 -72
- data/lib/xmi/uml13/call_eventoperation.rb +7 -5
- data/lib/xmi/uml13/change_event.rb +73 -71
- data/lib/xmi/uml13/change_eventchange_expression.rb +7 -5
- data/lib/xmi/uml13/class.rb +116 -114
- data/lib/xmi/uml13/classifier.rb +113 -111
- data/lib/xmi/uml13/classifier_in_state.rb +122 -120
- data/lib/xmi/uml13/classifier_in_statein_state.rb +7 -5
- data/lib/xmi/uml13/classifier_in_stateobject_flow_state.rb +7 -5
- data/lib/xmi/uml13/classifier_in_statetype.rb +7 -5
- data/lib/xmi/uml13/classifier_role.rb +130 -128
- data/lib/xmi/uml13/classifier_roleassociation_end_role.rb +7 -5
- data/lib/xmi/uml13/classifier_roleavailable_feature.rb +7 -5
- data/lib/xmi/uml13/classifier_rolebase.rb +7 -5
- data/lib/xmi/uml13/classifier_rolemessage.rb +7 -5
- data/lib/xmi/uml13/classifier_rolemessage2.rb +7 -5
- data/lib/xmi/uml13/classifier_rolemultiplicity.rb +7 -5
- data/lib/xmi/uml13/classifier_rolenamespace.rb +7 -5
- data/lib/xmi/uml13/classifierassociation_end.rb +7 -5
- data/lib/xmi/uml13/classifierclassifier_in_state.rb +7 -5
- data/lib/xmi/uml13/classifierclassifier_role.rb +7 -5
- data/lib/xmi/uml13/classifiercollaboration.rb +7 -5
- data/lib/xmi/uml13/classifiercreate_action.rb +7 -5
- data/lib/xmi/uml13/classifierfeature.rb +19 -17
- data/lib/xmi/uml13/classifierinstance.rb +7 -5
- data/lib/xmi/uml13/classifierparameter.rb +7 -5
- data/lib/xmi/uml13/classifierparticipant.rb +7 -5
- data/lib/xmi/uml13/classifierrealization.rb +7 -5
- data/lib/xmi/uml13/classifierspecification.rb +7 -5
- data/lib/xmi/uml13/classifierstructural_feature.rb +7 -5
- data/lib/xmi/uml13/classis_active.rb +6 -4
- data/lib/xmi/uml13/collaboration.rb +78 -76
- data/lib/xmi/uml13/collaborationconstraining_element.rb +7 -5
- data/lib/xmi/uml13/collaborationinteraction.rb +7 -5
- data/lib/xmi/uml13/collaborationrepresented_classifier.rb +7 -5
- data/lib/xmi/uml13/collaborationrepresented_operation.rb +7 -5
- data/lib/xmi/uml13/collaborations.rb +22 -20
- data/lib/xmi/uml13/comment.rb +65 -63
- data/lib/xmi/uml13/common_behavior.rb +56 -54
- data/lib/xmi/uml13/component.rb +119 -117
- data/lib/xmi/uml13/componentdeployment.rb +7 -5
- data/lib/xmi/uml13/componentimplements.rb +7 -5
- data/lib/xmi/uml13/composite_state.rb +94 -92
- data/lib/xmi/uml13/composite_stateis_concurrent.rb +6 -4
- data/lib/xmi/uml13/composite_statesubstate.rb +23 -21
- data/lib/xmi/uml13/constraint.rb +73 -71
- data/lib/xmi/uml13/constraintbody.rb +7 -5
- data/lib/xmi/uml13/constraintconstrained_element.rb +7 -5
- data/lib/xmi/uml13/constraintconstrained_stereotype.rb +7 -5
- data/lib/xmi/uml13/core.rb +52 -50
- data/lib/xmi/uml13/create_action.rb +89 -87
- data/lib/xmi/uml13/create_actioninstantiation.rb +7 -5
- data/lib/xmi/uml13/data_type.rb +113 -111
- data/lib/xmi/uml13/data_types.rb +36 -34
- data/lib/xmi/uml13/data_value.rb +85 -83
- data/lib/xmi/uml13/dependency.rb +79 -77
- data/lib/xmi/uml13/dependencyclient.rb +7 -5
- data/lib/xmi/uml13/dependencydescription.rb +7 -5
- data/lib/xmi/uml13/dependencyowning_dependency.rb +7 -5
- data/lib/xmi/uml13/dependencysub_dependencies.rb +15 -13
- data/lib/xmi/uml13/dependencysupplier.rb +7 -5
- data/lib/xmi/uml13/destroy_action.rb +86 -84
- data/lib/xmi/uml13/diagram.rb +25 -23
- data/lib/xmi/uml13/diagram_compositions.rb +7 -5
- data/lib/xmi/uml13/diagram_element.rb +20 -18
- data/lib/xmi/uml13/diagram_element_properties.rb +9 -7
- data/lib/xmi/uml13/diagram_elementdiagram.rb +7 -5
- data/lib/xmi/uml13/diagram_elementgeometry.rb +7 -5
- data/lib/xmi/uml13/diagram_elementstyle.rb +7 -5
- data/lib/xmi/uml13/diagram_properties.rb +13 -11
- data/lib/xmi/uml13/diagramdiagram_type.rb +7 -5
- data/lib/xmi/uml13/diagramelement.rb +7 -5
- data/lib/xmi/uml13/diagramname.rb +7 -5
- data/lib/xmi/uml13/diagramowner.rb +157 -155
- data/lib/xmi/uml13/diagramstyle.rb +7 -5
- data/lib/xmi/uml13/diagramtool_name.rb +7 -5
- data/lib/xmi/uml13/element.rb +12 -10
- data/lib/xmi/uml13/element_reference.rb +24 -22
- data/lib/xmi/uml13/element_referencealias.rb +7 -5
- data/lib/xmi/uml13/element_referencepackage.rb +7 -5
- data/lib/xmi/uml13/element_referencereferenced_element.rb +7 -5
- data/lib/xmi/uml13/element_referencevisibility.rb +6 -4
- data/lib/xmi/uml13/enumeration.rb +115 -113
- data/lib/xmi/uml13/enumeration_literal.rb +18 -16
- data/lib/xmi/uml13/enumeration_literalenumeration.rb +7 -5
- data/lib/xmi/uml13/enumeration_literalname.rb +7 -5
- data/lib/xmi/uml13/enumerationliteral.rb +7 -5
- data/lib/xmi/uml13/event.rb +71 -69
- data/lib/xmi/uml13/eventstate.rb +7 -5
- data/lib/xmi/uml13/eventtransition.rb +7 -5
- data/lib/xmi/uml13/exception.rb +99 -97
- data/lib/xmi/uml13/exceptioncontext.rb +7 -5
- data/lib/xmi/uml13/expression.rb +18 -16
- data/lib/xmi/uml13/expressionbody.rb +7 -5
- data/lib/xmi/uml13/expressionlanguage.rb +7 -5
- data/lib/xmi/uml13/extension_mechanisms.rb +14 -12
- data/lib/xmi/uml13/feature.rb +74 -72
- data/lib/xmi/uml13/featureclassifier_role.rb +7 -5
- data/lib/xmi/uml13/featureowner.rb +7 -5
- data/lib/xmi/uml13/featureowner_scope.rb +6 -4
- data/lib/xmi/uml13/foundation.rb +18 -16
- data/lib/xmi/uml13/generalizable_element.rb +82 -80
- data/lib/xmi/uml13/generalizable_elementgeneralization.rb +7 -5
- data/lib/xmi/uml13/generalizable_elementis_abstract.rb +6 -4
- data/lib/xmi/uml13/generalizable_elementis_leaf.rb +6 -4
- data/lib/xmi/uml13/generalizable_elementis_root.rb +6 -4
- data/lib/xmi/uml13/generalizable_elementspecialization.rb +7 -5
- data/lib/xmi/uml13/generalization.rb +74 -72
- data/lib/xmi/uml13/generalizationdiscriminator.rb +7 -5
- data/lib/xmi/uml13/generalizationsubtype.rb +7 -5
- data/lib/xmi/uml13/generalizationsupertype.rb +7 -5
- data/lib/xmi/uml13/geometry.rb +15 -13
- data/lib/xmi/uml13/geometrybody.rb +7 -5
- data/lib/xmi/uml13/graphic_marker.rb +15 -13
- data/lib/xmi/uml13/graphic_markerbody.rb +7 -5
- data/lib/xmi/uml13/guard.rb +70 -68
- data/lib/xmi/uml13/guardexpression.rb +7 -5
- data/lib/xmi/uml13/guardtransition.rb +7 -5
- data/lib/xmi/uml13/instance.rb +85 -83
- data/lib/xmi/uml13/instanceattribute_link.rb +7 -5
- data/lib/xmi/uml13/instanceclassifier.rb +7 -5
- data/lib/xmi/uml13/instancelink_end.rb +7 -5
- data/lib/xmi/uml13/instancemessage_instance.rb +7 -5
- data/lib/xmi/uml13/instancemessage_instance2.rb +7 -5
- data/lib/xmi/uml13/instancemessage_instance3.rb +7 -5
- data/lib/xmi/uml13/instanceslot.rb +7 -5
- data/lib/xmi/uml13/interaction.rb +70 -68
- data/lib/xmi/uml13/interactioncontext.rb +7 -5
- data/lib/xmi/uml13/interactionmessage.rb +7 -5
- data/lib/xmi/uml13/interface.rb +113 -111
- data/lib/xmi/uml13/link.rb +70 -68
- data/lib/xmi/uml13/link_end.rb +74 -72
- data/lib/xmi/uml13/link_endassociation_end.rb +7 -5
- data/lib/xmi/uml13/link_endinstance.rb +7 -5
- data/lib/xmi/uml13/link_endlink.rb +7 -5
- data/lib/xmi/uml13/link_object.rb +90 -88
- data/lib/xmi/uml13/linkassociation.rb +7 -5
- data/lib/xmi/uml13/linklink_role.rb +7 -5
- data/lib/xmi/uml13/local_invocation.rb +86 -84
- data/lib/xmi/uml13/mapping.rb +15 -13
- data/lib/xmi/uml13/mappingbody.rb +7 -5
- data/lib/xmi/uml13/message.rb +89 -87
- data/lib/xmi/uml13/message_instance.rb +77 -75
- data/lib/xmi/uml13/message_instanceargument.rb +7 -5
- data/lib/xmi/uml13/message_instancereceiver.rb +7 -5
- data/lib/xmi/uml13/message_instancesender.rb +7 -5
- data/lib/xmi/uml13/message_instancespecification.rb +7 -5
- data/lib/xmi/uml13/messageaction.rb +7 -5
- data/lib/xmi/uml13/messageactivator.rb +7 -5
- data/lib/xmi/uml13/messageinteraction.rb +7 -5
- data/lib/xmi/uml13/messagemessage.rb +7 -5
- data/lib/xmi/uml13/messagemessage2.rb +7 -5
- data/lib/xmi/uml13/messagepredecessor.rb +7 -5
- data/lib/xmi/uml13/messagereceiver.rb +7 -5
- data/lib/xmi/uml13/messagesender.rb +7 -5
- data/lib/xmi/uml13/method.rb +87 -85
- data/lib/xmi/uml13/methodbody.rb +7 -5
- data/lib/xmi/uml13/methodspecification.rb +7 -5
- data/lib/xmi/uml13/model.rb +81 -79
- data/lib/xmi/uml13/model_element.rb +65 -63
- data/lib/xmi/uml13/model_element_owns_diagramowned_diagram.rb +7 -5
- data/lib/xmi/uml13/model_elementbehavior.rb +7 -5
- data/lib/xmi/uml13/model_elementbinding.rb +7 -5
- data/lib/xmi/uml13/model_elementcollaboration.rb +7 -5
- data/lib/xmi/uml13/model_elementconstraint.rb +7 -5
- data/lib/xmi/uml13/model_elementelement_reference.rb +7 -5
- data/lib/xmi/uml13/model_elementimplementation.rb +7 -5
- data/lib/xmi/uml13/model_elementname.rb +7 -5
- data/lib/xmi/uml13/model_elementnamespace.rb +7 -5
- data/lib/xmi/uml13/model_elementpartition.rb +7 -5
- data/lib/xmi/uml13/model_elementpresentation.rb +7 -5
- data/lib/xmi/uml13/model_elementprovision.rb +7 -5
- data/lib/xmi/uml13/model_elementrequirement.rb +7 -5
- data/lib/xmi/uml13/model_elementstereotype.rb +7 -5
- data/lib/xmi/uml13/model_elementtagged_value.rb +7 -5
- data/lib/xmi/uml13/model_elementtemplate.rb +7 -5
- data/lib/xmi/uml13/model_elementtemplate_parameter.rb +7 -5
- data/lib/xmi/uml13/model_elementview.rb +7 -5
- data/lib/xmi/uml13/model_elementvisibility.rb +6 -4
- data/lib/xmi/uml13/model_management.rb +18 -16
- data/lib/xmi/uml13/multiplicity_range.rb +18 -16
- data/lib/xmi/uml13/multiplicity_rangelower.rb +7 -5
- data/lib/xmi/uml13/multiplicity_rangeupper.rb +7 -5
- data/lib/xmi/uml13/namespace.rb +67 -65
- data/lib/xmi/uml13/namespaceowned_element.rb +175 -173
- data/lib/xmi/uml13/node.rb +116 -114
- data/lib/xmi/uml13/nodecomponent.rb +7 -5
- data/lib/xmi/uml13/object.rb +85 -83
- data/lib/xmi/uml13/object_flow_state.rb +92 -90
- data/lib/xmi/uml13/object_flow_statetype_state.rb +7 -5
- data/lib/xmi/uml13/object_set_expression.rb +18 -16
- data/lib/xmi/uml13/operation.rb +102 -100
- data/lib/xmi/uml13/operationcollaboration.rb +7 -5
- data/lib/xmi/uml13/operationconcurrency.rb +6 -4
- data/lib/xmi/uml13/operationis_polymorphic.rb +6 -4
- data/lib/xmi/uml13/operationmethod.rb +7 -5
- data/lib/xmi/uml13/operationoccurrence.rb +7 -5
- data/lib/xmi/uml13/operationspecification.rb +7 -5
- data/lib/xmi/uml13/package.rb +81 -79
- data/lib/xmi/uml13/packageelement_reference.rb +7 -5
- data/lib/xmi/uml13/parameter.rb +79 -77
- data/lib/xmi/uml13/parameterbehavioral_feature.rb +7 -5
- data/lib/xmi/uml13/parameterdefault_value.rb +15 -13
- data/lib/xmi/uml13/parameterkind.rb +6 -4
- data/lib/xmi/uml13/parametersignal.rb +7 -5
- data/lib/xmi/uml13/parametertype.rb +7 -5
- data/lib/xmi/uml13/partition.rb +71 -69
- data/lib/xmi/uml13/partitionactivity_model.rb +7 -5
- data/lib/xmi/uml13/partitioncontents.rb +7 -5
- data/lib/xmi/uml13/presentation.rb +22 -20
- data/lib/xmi/uml13/presentationgeometry.rb +7 -5
- data/lib/xmi/uml13/presentationmodel.rb +7 -5
- data/lib/xmi/uml13/presentationstyle.rb +7 -5
- data/lib/xmi/uml13/presentationview_element.rb +7 -5
- data/lib/xmi/uml13/primitive.rb +113 -111
- data/lib/xmi/uml13/procedure_expression.rb +18 -16
- data/lib/xmi/uml13/pseudo_state.rb +77 -75
- data/lib/xmi/uml13/pseudo_statekind.rb +6 -4
- data/lib/xmi/uml13/reception.rb +91 -89
- data/lib/xmi/uml13/receptionis_polymorphic.rb +6 -4
- data/lib/xmi/uml13/receptionsignal.rb +7 -5
- data/lib/xmi/uml13/receptionspecification.rb +7 -5
- data/lib/xmi/uml13/refinement.rb +81 -79
- data/lib/xmi/uml13/refinementmapping.rb +7 -5
- data/lib/xmi/uml13/request.rb +71 -69
- data/lib/xmi/uml13/requestaction.rb +7 -5
- data/lib/xmi/uml13/requestmessage_instance.rb +7 -5
- data/lib/xmi/uml13/return_action.rb +86 -84
- data/lib/xmi/uml13/send_action.rb +86 -84
- data/lib/xmi/uml13/signal.rb +96 -94
- data/lib/xmi/uml13/signal_event.rb +74 -72
- data/lib/xmi/uml13/signal_eventsignal.rb +7 -5
- data/lib/xmi/uml13/signaloccurrence.rb +7 -5
- data/lib/xmi/uml13/signalparameter.rb +7 -5
- data/lib/xmi/uml13/signalreception.rb +7 -5
- data/lib/xmi/uml13/simple_state.rb +89 -87
- data/lib/xmi/uml13/state.rb +89 -87
- data/lib/xmi/uml13/state_machine.rb +75 -73
- data/lib/xmi/uml13/state_machinecontext.rb +7 -5
- data/lib/xmi/uml13/state_machines.rb +50 -48
- data/lib/xmi/uml13/state_machinesubmachine_state.rb +7 -5
- data/lib/xmi/uml13/state_machinetop.rb +19 -17
- data/lib/xmi/uml13/state_machinetransitions.rb +7 -5
- data/lib/xmi/uml13/state_vertex.rb +74 -72
- data/lib/xmi/uml13/state_vertexincoming.rb +7 -5
- data/lib/xmi/uml13/state_vertexoutgoing.rb +7 -5
- data/lib/xmi/uml13/state_vertexparent.rb +7 -5
- data/lib/xmi/uml13/stateclassifier_in_state.rb +7 -5
- data/lib/xmi/uml13/statedeferred_event.rb +7 -5
- data/lib/xmi/uml13/stateentry.rb +7 -5
- data/lib/xmi/uml13/stateexit.rb +7 -5
- data/lib/xmi/uml13/stateinternal_transition.rb +7 -5
- data/lib/xmi/uml13/statestate_machine.rb +7 -5
- data/lib/xmi/uml13/stereotype.rb +95 -93
- data/lib/xmi/uml13/stereotypebase_class.rb +7 -5
- data/lib/xmi/uml13/stereotypeextended_element.rb +7 -5
- data/lib/xmi/uml13/stereotypeicon.rb +7 -5
- data/lib/xmi/uml13/stereotyperequired_tag.rb +7 -5
- data/lib/xmi/uml13/stereotypestereotype_constraint.rb +7 -5
- data/lib/xmi/uml13/structural_feature.rb +86 -84
- data/lib/xmi/uml13/structural_featurechangeable.rb +6 -4
- data/lib/xmi/uml13/structural_featuremultiplicity.rb +7 -5
- data/lib/xmi/uml13/structural_featuretarget_scope.rb +6 -4
- data/lib/xmi/uml13/structural_featuretype.rb +7 -5
- data/lib/xmi/uml13/structure.rb +113 -111
- data/lib/xmi/uml13/submachine_state.rb +88 -86
- data/lib/xmi/uml13/submachine_statestate_machine.rb +7 -5
- data/lib/xmi/uml13/subsystem.rb +115 -113
- data/lib/xmi/uml13/subsystemis_instantiable.rb +6 -4
- data/lib/xmi/uml13/tagged_value.rb +24 -22
- data/lib/xmi/uml13/tagged_valuemodel_element.rb +7 -5
- data/lib/xmi/uml13/tagged_valuestereotype.rb +7 -5
- data/lib/xmi/uml13/tagged_valuetag.rb +7 -5
- data/lib/xmi/uml13/tagged_valuevalue.rb +7 -5
- data/lib/xmi/uml13/terminate_action.rb +86 -84
- data/lib/xmi/uml13/time_event.rb +73 -71
- data/lib/xmi/uml13/time_eventduration.rb +7 -5
- data/lib/xmi/uml13/time_expression.rb +18 -16
- data/lib/xmi/uml13/trace.rb +79 -77
- data/lib/xmi/uml13/transition.rb +84 -82
- data/lib/xmi/uml13/transitioneffect.rb +7 -5
- data/lib/xmi/uml13/transitionguard.rb +7 -5
- data/lib/xmi/uml13/transitionsource.rb +7 -5
- data/lib/xmi/uml13/transitionstate.rb +7 -5
- data/lib/xmi/uml13/transitionstatemachine.rb +7 -5
- data/lib/xmi/uml13/transitiontarget.rb +7 -5
- data/lib/xmi/uml13/transitiontrigger.rb +7 -5
- data/lib/xmi/uml13/uninterpreted_action.rb +89 -87
- data/lib/xmi/uml13/uninterpreted_actionbody.rb +7 -5
- data/lib/xmi/uml13/usage.rb +79 -77
- data/lib/xmi/uml13/use_case.rb +116 -114
- data/lib/xmi/uml13/use_case_instance.rb +85 -83
- data/lib/xmi/uml13/use_caseextension_point.rb +7 -5
- data/lib/xmi/uml13/use_cases.rb +16 -14
- data/lib/xmi/uml13/view_element.rb +18 -16
- data/lib/xmi/uml13/view_elementmodel.rb +7 -5
- data/lib/xmi/uml13/view_elementpresentation.rb +7 -5
- data/lib/xmi/uml13/xm_iextension.rb +11 -9
- data/lib/xmi/uml13/xm_ireference.rb +6 -4
- data/lib/xmi/uml13.rb +2 -0
- data/lib/xmi/version.rb +1 -1
- data/lib/xmi.rb +10 -0
- data/xmi.gemspec +2 -2
- metadata +10 -22
- data/.github/workflows/main.yml +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6e11e8807b6e645ac8d6a3316ad055e34214aaa747925ee134ed6b5fd3a1cae
|
4
|
+
data.tar.gz: 0515d55369b0d206204e957d0cf0f835784d527fb8d658cdb06a1a43b66c2f8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aa1d6b95aecb8e28587b8072268ad3b058bb3db819ec5fd3fe9d1d05a74affe81ddd1dfe7be9314a5e275f4e21db7006a2980c1687284a437ccaaf9d3e1c62a
|
7
|
+
data.tar.gz: d423ab53b4a06d9de7728a4c301d4861b218c1c512ab6745b51a2e3ecc0f18ac0335f8ee4ad157412576d28245188d69c1c87e590b47317de8207b54023a2602
|
@@ -0,0 +1,14 @@
|
|
1
|
+
name: rake
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master, main ]
|
6
|
+
tags: [ v* ]
|
7
|
+
pull_request:
|
8
|
+
workflow_dispatch:
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
rake:
|
12
|
+
uses: metanorma/ci/.github/workflows/graphviz-rake.yml@main
|
13
|
+
secrets:
|
14
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: release
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
inputs:
|
6
|
+
next_version:
|
7
|
+
description: |
|
8
|
+
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
9
|
+
required: true
|
10
|
+
default: 'skip'
|
11
|
+
push:
|
12
|
+
tags: [ v* ]
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
release:
|
16
|
+
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
17
|
+
with:
|
18
|
+
next_version: ${{ github.event.inputs.next_version }}
|
19
|
+
secrets:
|
20
|
+
rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
|
21
|
+
pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
|
22
|
+
|
data/.rubocop.yml
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 3.0
|
3
|
+
Exclude:
|
4
|
+
- "lib/xmi/uml13/**/*.rb"
|
5
|
+
- "vendor/bundle/**/*"
|
3
6
|
|
4
7
|
Style/StringLiterals:
|
5
8
|
EnforcedStyle: double_quotes
|
6
9
|
|
7
10
|
Style/StringLiteralsInInterpolation:
|
8
11
|
EnforcedStyle: double_quotes
|
12
|
+
|
13
|
+
Documentation:
|
14
|
+
Enabled: false
|
data/README.adoc
CHANGED
@@ -1,5 +1,90 @@
|
|
1
|
-
= XMI
|
1
|
+
= XMI
|
2
2
|
|
3
3
|
== Purpose
|
4
4
|
|
5
|
-
This
|
5
|
+
This Ruby object mapper is a module designed to convert XMI (XML Metadata Interchange) files into Ruby objects. It can also leverage the `nokogiri` gem for XML parsing and provides methods to dynamically generate Ruby classes and modules based on the XML structure, particularly those related to EA (Enterprise Architect) MDG (Model Driven Generation) extensions.
|
6
|
+
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
[source,ruby]
|
12
|
+
----
|
13
|
+
gem "xmi"
|
14
|
+
----
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
[source,shell]
|
19
|
+
----
|
20
|
+
$ bundle install
|
21
|
+
----
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
[source,shell]
|
26
|
+
----
|
27
|
+
$ gem install xmi
|
28
|
+
----
|
29
|
+
|
30
|
+
== Usage
|
31
|
+
|
32
|
+
=== Convert XMI file into Ruby objects
|
33
|
+
|
34
|
+
To convert XMI file into Ruby objects, run:
|
35
|
+
|
36
|
+
[source,ruby]
|
37
|
+
----
|
38
|
+
xml = "path/to/your/file.xmi"
|
39
|
+
xml_content = File.read(xml)
|
40
|
+
xmi_root_model = Xmi::Sparx::SparxRoot2013.from_xml(xml_content)
|
41
|
+
----
|
42
|
+
|
43
|
+
This method takes the path to an XMI file and generate the Ruby objects.
|
44
|
+
|
45
|
+
=== Loading MDG Extensions and Generate Ruby Classes and Modules Dynamically
|
46
|
+
|
47
|
+
To load an MDG extension from an XML file, use the `load_mdg_extension` method:
|
48
|
+
|
49
|
+
[source,ruby]
|
50
|
+
----
|
51
|
+
Xmi::EaRoot.load_mdg_extension("path/to/your/mdg_extension.xml")
|
52
|
+
|
53
|
+
xml = "path/to/your/file.xmi"
|
54
|
+
xml_content = File.read(xml)
|
55
|
+
xmi_root_model = Xmi::Sparx::SparxRoot2013.from_xml(xml_content)
|
56
|
+
----
|
57
|
+
|
58
|
+
`Xmi::EaRoot.load_mdg_extension` takes the path to an XML file and generate the
|
59
|
+
Ruby classes and modules defined in XML file dynamically.
|
60
|
+
Then, you can generate Ruby objects by `Xmi::Sparx::SparxRoot2013.from_xml`.
|
61
|
+
|
62
|
+
=== Output Classes and Modules Generated from Extension into Ruby Files
|
63
|
+
|
64
|
+
You can also generate Ruby files directly from the XMI content:
|
65
|
+
|
66
|
+
[source,ruby]
|
67
|
+
----
|
68
|
+
Xmi::EaRoot.load_extension(
|
69
|
+
input_xml_path: 'path/to/your/custom_extension.xml',
|
70
|
+
module_name: 'CustomModule'
|
71
|
+
)
|
72
|
+
Xmi::EaRoot.output_rb_file('path/to/output_file.rb')
|
73
|
+
----
|
74
|
+
|
75
|
+
This approach allows you to save the dynamically generated Ruby code to a file for further use.
|
76
|
+
|
77
|
+
== Development
|
78
|
+
|
79
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
80
|
+
|
81
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
82
|
+
|
83
|
+
|
84
|
+
== Contributing
|
85
|
+
|
86
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/xmi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/xmi/blob/master/CODE_OF_CONDUCT.md).
|
87
|
+
|
88
|
+
== Code of Conduct
|
89
|
+
|
90
|
+
Everyone interacting in the Xmi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/xmi/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/xmi/documentation.rb
CHANGED
@@ -25,14 +25,14 @@ module Xmi
|
|
25
25
|
|
26
26
|
xml do
|
27
27
|
root "Documentation"
|
28
|
-
namespace "http://www.omg.org/spec/XMI/20131001", "
|
28
|
+
namespace "http://www.omg.org/spec/XMI/20131001", "xmi"
|
29
29
|
|
30
|
-
map_attribute "id", to: :id
|
31
|
-
map_attribute "label", to: :label
|
32
|
-
map_attribute "uuid", to: :uuid
|
30
|
+
map_attribute "id", to: :id
|
31
|
+
map_attribute "label", to: :label
|
32
|
+
map_attribute "uuid", to: :uuid
|
33
33
|
map_attribute "href", to: :href
|
34
|
-
map_attribute "idref", to: :idref
|
35
|
-
map_attribute "type", to: :type
|
34
|
+
map_attribute "idref", to: :idref
|
35
|
+
map_attribute "type", to: :type
|
36
36
|
map_attribute "exporter", to: :exporter
|
37
37
|
map_attribute "exporterVersion", to: :exporter_version
|
38
38
|
map_attribute "exporterID", to: :exporter_id
|
data/lib/xmi/ea_root.rb
ADDED
@@ -0,0 +1,316 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "nokogiri"
|
4
|
+
|
5
|
+
module Xmi
|
6
|
+
class EaRoot # rubocop:disable Metrics/ClassLength
|
7
|
+
MODULE_TEMPLATE = <<~TEXT
|
8
|
+
module Xmi
|
9
|
+
class EaRoot
|
10
|
+
module #MODULE_NAME#
|
11
|
+
#KLASSES#
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
TEXT
|
16
|
+
|
17
|
+
KLASS_TEMPLATE = <<~TEXT
|
18
|
+
class #KLASS_NAME# < #FROM_KLASS#
|
19
|
+
#ROOT_TAG_LINE#
|
20
|
+
|
21
|
+
#ATTRIBUTES##XML_MAPPING#
|
22
|
+
end
|
23
|
+
TEXT
|
24
|
+
|
25
|
+
XML_MAPPING = <<~TEXT
|
26
|
+
xml do
|
27
|
+
root "#ROOT_TAG#"
|
28
|
+
#MAP_ATTRIBUTES#
|
29
|
+
end
|
30
|
+
TEXT
|
31
|
+
|
32
|
+
ATTRIBUTE_LINE = <<~TEXT
|
33
|
+
attribute :#TAG_NAME#, #ATTRIBUTE_TYPE#
|
34
|
+
TEXT
|
35
|
+
|
36
|
+
MAP_ATTRIBUTES = <<~TEXT
|
37
|
+
map_attribute "#ATTRIBUTE_NAME#", to: :#ATTRIBUTE_METHOD#
|
38
|
+
TEXT
|
39
|
+
|
40
|
+
MAP_ELEMENT = <<~TEXT
|
41
|
+
map_element "#ELEMENT_NAME#",
|
42
|
+
to: :#ELEMENT_METHOD#,
|
43
|
+
namespace: "#NAMESPACE#",
|
44
|
+
prefix: "#PREFIX#"
|
45
|
+
TEXT
|
46
|
+
|
47
|
+
class << self
|
48
|
+
def load_mdg_extension(xml_path)
|
49
|
+
options = {}
|
50
|
+
options[:input_xml_path] = xml_path
|
51
|
+
options[:module_name] = "Mdg"
|
52
|
+
load_extension(options)
|
53
|
+
update_mdg_mappings
|
54
|
+
end
|
55
|
+
|
56
|
+
def load_extension(options)
|
57
|
+
@content = gen_content(options)
|
58
|
+
Object.class_eval @content
|
59
|
+
end
|
60
|
+
|
61
|
+
def output_rb_file(output_rb_path)
|
62
|
+
File.open(output_rb_path, "w") { |file| file.write(@content) }
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def update_mdg_mappings
|
68
|
+
mdg_klasses = all_mdg_klasses
|
69
|
+
map_elements = construct_shale_xml_mappings(mdg_klasses)
|
70
|
+
sparx_roots.each do |sparx_root|
|
71
|
+
update_shale_attributes(mdg_klasses, sparx_root)
|
72
|
+
update_shale_xml_mappings(map_elements, sparx_root)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def construct_shale_xml_mappings(mdg_klasses)
|
77
|
+
map_elements = []
|
78
|
+
mdg_klasses.each do |klass|
|
79
|
+
next unless Xmi::EaRoot::Mdg.const_get(klass).respond_to? :root_tag
|
80
|
+
|
81
|
+
map_elements << MAP_ELEMENT
|
82
|
+
.gsub("#ELEMENT_NAME#", Xmi::EaRoot::Mdg.const_get(klass).root_tag)
|
83
|
+
.gsub("#ELEMENT_METHOD#", Shale::Utils.snake_case(klass.to_s))
|
84
|
+
.gsub("#NAMESPACE#", @mdg_namespace[:uri])
|
85
|
+
.gsub("#PREFIX#", @mdg_namespace[:name])
|
86
|
+
end
|
87
|
+
|
88
|
+
map_elements
|
89
|
+
end
|
90
|
+
|
91
|
+
def update_shale_attributes(mdg_klasses, sparx_root)
|
92
|
+
mdg_klasses.each do |klass|
|
93
|
+
method_name = Shale::Utils.snake_case(klass)
|
94
|
+
full_klass_name = "Xmi::EaRoot::Mdg::#{klass}"
|
95
|
+
|
96
|
+
attr_line = "#{ATTRIBUTE_LINE.rstrip}, collection: true"
|
97
|
+
attr_line = attr_line
|
98
|
+
.gsub("#TAG_NAME#", method_name)
|
99
|
+
.gsub("#ATTRIBUTE_TYPE#", full_klass_name)
|
100
|
+
|
101
|
+
sparx_root.class_eval(attr_line)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def update_shale_xml_mappings(map_elements, sparx_root)
|
106
|
+
new_mapping = sparx_root.class_variable_get("@@default_mapping")
|
107
|
+
new_mapping += map_elements.join("\n")
|
108
|
+
sparx_root.class_variable_set("@@mapping", new_mapping) # rubocop:disable Style/ClassVars
|
109
|
+
|
110
|
+
new_mapping_block = proc do
|
111
|
+
eval sparx_root.class_variable_get("@@mapping") # rubocop:disable Security/Eval
|
112
|
+
end
|
113
|
+
new_mapping = proc { xml(&new_mapping_block) }
|
114
|
+
sparx_root.class_eval(&new_mapping)
|
115
|
+
end
|
116
|
+
|
117
|
+
def sparx_roots
|
118
|
+
[Xmi::Sparx::SparxRoot, Xmi::Sparx::SparxRoot2013]
|
119
|
+
end
|
120
|
+
|
121
|
+
def all_mdg_klasses
|
122
|
+
Xmi::EaRoot::Mdg.constants.select do |c|
|
123
|
+
Xmi::EaRoot::Mdg.const_get(c).is_a? Class
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def get_abstract_klass_node(xmi_doc)
|
128
|
+
xmi_doc.at_xpath(
|
129
|
+
"//UMLProfiles//Stereotypes//Stereotype[@isAbstract='true']"
|
130
|
+
)
|
131
|
+
end
|
132
|
+
|
133
|
+
def get_klass_name_from_node(node)
|
134
|
+
node.attribute_nodes.find { |attr| attr.name == "name" }.value
|
135
|
+
end
|
136
|
+
|
137
|
+
def gen_map_attribute_line(attr_name, attr_method)
|
138
|
+
space_before = " " * 10
|
139
|
+
method_name = Shale::Utils.snake_case(attr_method)
|
140
|
+
|
141
|
+
map_attributes = MAP_ATTRIBUTES
|
142
|
+
.gsub("#ATTRIBUTE_NAME#", attr_name)
|
143
|
+
.gsub("#ATTRIBUTE_METHOD#", method_name)
|
144
|
+
|
145
|
+
"#{space_before}#{map_attributes}"
|
146
|
+
end
|
147
|
+
|
148
|
+
def gen_attribute_line(tag_name, attribute_type = "Shale::Type::String")
|
149
|
+
tag_name = Shale::Utils.snake_case(tag_name)
|
150
|
+
space_before = " " * 8
|
151
|
+
|
152
|
+
attribute_line = ATTRIBUTE_LINE
|
153
|
+
.gsub("#TAG_NAME#", tag_name)
|
154
|
+
.gsub("#ATTRIBUTE_TYPE#", attribute_type)
|
155
|
+
|
156
|
+
"#{space_before}#{attribute_line}"
|
157
|
+
end
|
158
|
+
|
159
|
+
def get_tag_name(tag)
|
160
|
+
tag.attribute_nodes.find { |attr| attr.name == "name" }.value
|
161
|
+
end
|
162
|
+
|
163
|
+
def gen_tags(node)
|
164
|
+
tags = node.search("Tag")
|
165
|
+
attributes_lines = ""
|
166
|
+
|
167
|
+
tags.each do |tag|
|
168
|
+
tag_name = get_tag_name(tag)
|
169
|
+
attributes_lines += gen_attribute_line(tag_name)
|
170
|
+
end
|
171
|
+
|
172
|
+
[attributes_lines, tags]
|
173
|
+
end
|
174
|
+
|
175
|
+
def gen_abstract_klass
|
176
|
+
attributes_lines = ""
|
177
|
+
tags_lines, @abstract_tags = gen_tags(@abstract_klass_node)
|
178
|
+
attributes_lines += tags_lines
|
179
|
+
klass_name = get_klass_name_from_node(@abstract_klass_node)
|
180
|
+
|
181
|
+
KLASS_TEMPLATE
|
182
|
+
.gsub("#KLASS_NAME#", Shale::Utils.classify(klass_name))
|
183
|
+
.gsub("#FROM_KLASS#", "Shale::Mapper")
|
184
|
+
.gsub("#ATTRIBUTES#", attributes_lines.rstrip)
|
185
|
+
.gsub("#XML_MAPPING#", "")
|
186
|
+
.gsub("#ROOT_TAG_LINE#", "")
|
187
|
+
end
|
188
|
+
|
189
|
+
def gen_apply_types(node)
|
190
|
+
apply_types_lines = ""
|
191
|
+
apply_types_nodes = node.search("Apply")
|
192
|
+
apply_types_nodes.each do |n|
|
193
|
+
apply_types = n.attribute_nodes.map(&:value)
|
194
|
+
apply_types.each do |apply_type|
|
195
|
+
tag_name = "base_#{apply_type}"
|
196
|
+
apply_types_lines += gen_attribute_line(tag_name)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
[apply_types_lines, apply_types_nodes]
|
201
|
+
end
|
202
|
+
|
203
|
+
def gen_generic_klass(node)
|
204
|
+
node_name = get_klass_name_from_node(node)
|
205
|
+
attributes_lines, map_attributes_lines = gen_klass_tags(node)
|
206
|
+
apply_types_lines, apply_types_nodes = gen_apply_types(node)
|
207
|
+
attributes_lines, map_attributes_lines = gen_klass_apply_types(
|
208
|
+
attributes_lines, map_attributes_lines,
|
209
|
+
apply_types_lines, apply_types_nodes
|
210
|
+
)
|
211
|
+
|
212
|
+
xml_mapping = replace_xml_mapping(node_name, map_attributes_lines)
|
213
|
+
|
214
|
+
replace_klass_template(node_name, attributes_lines, xml_mapping)
|
215
|
+
end
|
216
|
+
|
217
|
+
def gen_klass_apply_types(attributes_lines, map_attributes_lines, apply_types_lines, apply_types_nodes)
|
218
|
+
unless apply_types_nodes.empty?
|
219
|
+
attributes_lines += apply_types_lines
|
220
|
+
apply_types_nodes.each do |n|
|
221
|
+
apply_types = n.attribute_nodes.map(&:value)
|
222
|
+
apply_types.each do |apply_type|
|
223
|
+
map_attributes_lines += gen_map_attribute_line("base_#{apply_type}", "base_#{apply_type}")
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
[attributes_lines, map_attributes_lines]
|
229
|
+
end
|
230
|
+
|
231
|
+
def gen_klass_tags(node)
|
232
|
+
attributes_lines = ""
|
233
|
+
map_attributes_lines = ""
|
234
|
+
|
235
|
+
tags_lines, tags = gen_tags(node)
|
236
|
+
attributes_lines += tags_lines
|
237
|
+
(@abstract_tags + tags).each do |tag|
|
238
|
+
tag_name = get_tag_name(tag)
|
239
|
+
map_attributes_lines += gen_map_attribute_line(tag_name, tag_name)
|
240
|
+
end
|
241
|
+
|
242
|
+
[attributes_lines, map_attributes_lines]
|
243
|
+
end
|
244
|
+
|
245
|
+
def replace_xml_mapping(node_name, map_attributes_lines)
|
246
|
+
XML_MAPPING
|
247
|
+
.gsub("#ROOT_TAG#", node_name)
|
248
|
+
.gsub("#MAP_ATTRIBUTES#", "\n#{map_attributes_lines.rstrip}")
|
249
|
+
.rstrip
|
250
|
+
end
|
251
|
+
|
252
|
+
def replace_klass_template(node_name, attributes_lines, xml_mapping)
|
253
|
+
abstract_klass_name = get_klass_name_from_node(@abstract_klass_node)
|
254
|
+
root_tag_line = "def self.root_tag; \"#{node_name}\"; end"
|
255
|
+
|
256
|
+
KLASS_TEMPLATE
|
257
|
+
.gsub("#KLASS_NAME#", Shale::Utils.classify(node_name))
|
258
|
+
.gsub("#FROM_KLASS#", Shale::Utils.classify(abstract_klass_name))
|
259
|
+
.gsub("#ROOT_TAG_LINE#", root_tag_line)
|
260
|
+
.gsub("#ATTRIBUTES#", attributes_lines.rstrip)
|
261
|
+
.gsub("#XML_MAPPING#", "\n\n#{xml_mapping}")
|
262
|
+
end
|
263
|
+
|
264
|
+
def gen_generic_klasses(xmi_doc)
|
265
|
+
nodes = xmi_doc.xpath("//UMLProfiles//Stereotypes//Stereotype[not(contains(@isAbstract, 'true'))]")
|
266
|
+
klasses_lines = ""
|
267
|
+
|
268
|
+
nodes.each do |node|
|
269
|
+
# check baseStereotypes is abstract class
|
270
|
+
base_stereotypes = node.attribute_nodes.find do |attr|
|
271
|
+
attr.name == "baseStereotypes" && attr.value == get_klass_name_from_node(@abstract_klass_node)
|
272
|
+
end
|
273
|
+
next if base_stereotypes.nil?
|
274
|
+
|
275
|
+
klasses_lines += "#{gen_generic_klass(node)}\n"
|
276
|
+
end
|
277
|
+
|
278
|
+
klasses_lines
|
279
|
+
end
|
280
|
+
|
281
|
+
def gen_klasses(xmi_doc)
|
282
|
+
@abstract_klass_node = get_abstract_klass_node(xmi_doc)
|
283
|
+
klasses_lines = ""
|
284
|
+
klasses_lines += "#{gen_abstract_klass}\n"
|
285
|
+
klasses_lines += gen_generic_klasses(xmi_doc).rstrip
|
286
|
+
klasses_lines
|
287
|
+
end
|
288
|
+
|
289
|
+
def gen_module(xmi_doc, module_name)
|
290
|
+
MODULE_TEMPLATE
|
291
|
+
.gsub("#MODULE_NAME#", module_name)
|
292
|
+
.gsub("#KLASSES#", gen_klasses(xmi_doc))
|
293
|
+
end
|
294
|
+
|
295
|
+
def get_mdg_namespace(xmi_doc)
|
296
|
+
node = xmi_doc.at_xpath("//UMLProfile/Documentation")
|
297
|
+
namespace_key = node.attribute_nodes.find do |attr|
|
298
|
+
attr.name == "name"
|
299
|
+
end.value
|
300
|
+
namespace_uri = node.attribute_nodes.find do |attr|
|
301
|
+
attr.name == "URI"
|
302
|
+
end.value
|
303
|
+
|
304
|
+
{ name: namespace_key, uri: namespace_uri }
|
305
|
+
end
|
306
|
+
|
307
|
+
def gen_content(options)
|
308
|
+
xml = options[:input_xml_path]
|
309
|
+
module_name = options[:module_name].capitalize
|
310
|
+
xmi_doc = Nokogiri::XML(File.open(xml).read)
|
311
|
+
@mdg_namespace = get_mdg_namespace(xmi_doc)
|
312
|
+
gen_module(xmi_doc, module_name)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
data/lib/xmi/extension.rb
CHANGED
@@ -17,12 +17,12 @@ module Xmi
|
|
17
17
|
root "Extension"
|
18
18
|
namespace "http://www.omg.org/spec/XMI/20131001", "xmi"
|
19
19
|
|
20
|
-
map_attribute "id", to: :id
|
21
|
-
map_attribute "label", to: :label
|
22
|
-
map_attribute "uuid", to: :uuid
|
20
|
+
map_attribute "id", to: :id
|
21
|
+
map_attribute "label", to: :label
|
22
|
+
map_attribute "uuid", to: :uuid
|
23
23
|
map_attribute "href", to: :href
|
24
|
-
map_attribute "idref", to: :idref
|
25
|
-
map_attribute "type", to: :type
|
24
|
+
map_attribute "idref", to: :idref
|
25
|
+
map_attribute "type", to: :type
|
26
26
|
map_attribute "extender", to: :extender
|
27
27
|
map_attribute "extenderID", to: :extender_id
|
28
28
|
end
|
data/lib/xmi/root.rb
CHANGED
@@ -5,38 +5,61 @@ require_relative "documentation"
|
|
5
5
|
require_relative "uml"
|
6
6
|
|
7
7
|
module Xmi
|
8
|
+
module RootAttributes
|
9
|
+
def self.included(klass)
|
10
|
+
klass.class_eval do
|
11
|
+
attribute :id, Shale::Type::String
|
12
|
+
attribute :label, Shale::Type::String
|
13
|
+
attribute :uuid, Shale::Type::String
|
14
|
+
attribute :href, Shale::Type::String
|
15
|
+
attribute :idref, Shale::Type::String
|
16
|
+
attribute :type, Shale::Type::String
|
17
|
+
attribute :documentation, Documentation
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
8
22
|
class Root < Shale::Mapper
|
9
|
-
|
10
|
-
attribute :label, Shale::Type::String
|
11
|
-
attribute :uuid, Shale::Type::String
|
12
|
-
attribute :href, Shale::Type::String
|
13
|
-
attribute :idref, Shale::Type::String
|
14
|
-
attribute :type, Shale::Type::String
|
15
|
-
attribute :documentation, Documentation
|
23
|
+
include RootAttributes
|
16
24
|
attribute :model, Uml::UmlModel
|
17
|
-
attribute :extension, Extension
|
18
25
|
|
19
26
|
xml do
|
20
27
|
root "XMI"
|
21
28
|
namespace "http://www.omg.org/spec/XMI/20131001", "xmi"
|
22
29
|
|
23
|
-
map_attribute "id", to: :id
|
24
|
-
map_attribute "label", to: :label
|
25
|
-
map_attribute "uuid", to: :uuid
|
26
|
-
map_attribute "href", to: :href
|
27
|
-
map_attribute "idref", to: :idref
|
28
|
-
map_attribute "type", to: :type
|
29
|
-
|
30
|
-
map_element "Documentation", to: :documentation,
|
31
|
-
prefix: "xmi", namespace: "http://www.omg.org/spec/XMI/20131001"
|
30
|
+
map_attribute "id", to: :id
|
31
|
+
map_attribute "label", to: :label
|
32
|
+
map_attribute "uuid", to: :uuid
|
33
|
+
map_attribute "href", to: :href, namespace: nil, prefix: nil
|
34
|
+
map_attribute "idref", to: :idref
|
35
|
+
map_attribute "type", to: :type
|
32
36
|
|
37
|
+
map_element "Documentation", to: :documentation
|
33
38
|
map_element "Model", to: :model,
|
34
39
|
namespace: "http://www.omg.org/spec/UML/20161101",
|
35
40
|
prefix: "uml"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Root2013 < Shale::Mapper
|
45
|
+
include RootAttributes
|
46
|
+
attribute :model, Uml::UmlModel2013
|
36
47
|
|
37
|
-
|
38
|
-
|
39
|
-
|
48
|
+
xml do
|
49
|
+
root "XMI"
|
50
|
+
namespace "http://www.omg.org/spec/XMI/20131001", "xmi"
|
51
|
+
|
52
|
+
map_attribute "id", to: :id
|
53
|
+
map_attribute "label", to: :label
|
54
|
+
map_attribute "uuid", to: :uuid
|
55
|
+
map_attribute "href", to: :href, namespace: nil, prefix: nil
|
56
|
+
map_attribute "idref", to: :idref
|
57
|
+
map_attribute "type", to: :type
|
58
|
+
|
59
|
+
map_element "Documentation", to: :documentation
|
60
|
+
map_element "Model", to: :model,
|
61
|
+
namespace: "http://www.omg.org/spec/UML/20131001",
|
62
|
+
prefix: "uml"
|
40
63
|
end
|
41
64
|
end
|
42
65
|
end
|