diff --git a/ingrid/anaconda-project.yml b/ingrid/anaconda-project.yml index 438a17e..bd100d3 100644 --- a/ingrid/anaconda-project.yml +++ b/ingrid/anaconda-project.yml @@ -95,8 +95,7 @@ env_specs: inherit_from: - model-processing packages: - - pip: - - gooey + - gooey <1.0.5 docs: packages: - sphinx diff --git a/ingrid/requirements-install.txt b/ingrid/requirements-install.txt index 962e483..0a42b0e 100644 --- a/ingrid/requirements-install.txt +++ b/ingrid/requirements-install.txt @@ -1,4 +1,4 @@ -gooey +gooey <1.0.5 networkx >=2.3 openpyxl pandas diff --git a/ingrid/src/model_processing/commands.py b/ingrid/src/model_processing/commands.py index d2d812e..040949a 100644 --- a/ingrid/src/model_processing/commands.py +++ b/ingrid/src/model_processing/commands.py @@ -262,6 +262,8 @@ def compare_md_model(inputs, input_patterns="", output_path=""): pattern_path.name.split(".")[0].lower(): pattern_path for pattern_path in PATTERNS.glob("*.json") } + if not isinstance(input_patterns, list) and input_patterns: + input_patterns = [input_patterns] if input_patterns: for in_pat in map(Path, input_patterns): if in_pat.is_dir(): diff --git a/ingrid/src/model_processing/graph_creation.py b/ingrid/src/model_processing/graph_creation.py index 40215d5..afc7a50 100644 --- a/ingrid/src/model_processing/graph_creation.py +++ b/ingrid/src/model_processing/graph_creation.py @@ -770,7 +770,9 @@ def sheets_to_dataframe(self, excel_file=None): ] if not excel_file and self.excel_file: excel_file = self.excel_file - excel_sheets = pd.read_excel(excel_file, sheet_name=None, engine="openpyxl") + excel_sheets = pd.read_excel( + excel_file, sheet_name=None, engine="openpyxl" + ) # what if the pattern is zzzzzzz, ids, renames for sheet in sorted(excel_sheets): # Alphabetical sort # Find the Pattern Sheet diff --git a/ingrid/src/model_processing/patterns/Actions.json b/ingrid/src/model_processing/patterns/Actions.json new file mode 100644 index 0000000..dd7a8c6 --- /dev/null +++ b/ingrid/src/model_processing/patterns/Actions.json @@ -0,0 +1,30 @@ +{ + "Columns to Navigation Map": { + "Activity": [ + "activity" + ], + "Action": [ + "action" + ] + }, + "Pattern Graph Edges": [ + [ + "action", + "activity", + "owner" + ] + ], + "Root Node": "action", + "Vertex MetaTypes": { + "activity": "Activity", + "action": "Action" + }, + "Vertex Settings": { + "activity": null, + "action": null + }, + "Vertex Stereotypes": { + "activity": null, + "action": null + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/ActorContext.json b/ingrid/src/model_processing/patterns/ActorContext.json new file mode 100644 index 0000000..c2eb04c --- /dev/null +++ b/ingrid/src/model_processing/patterns/ActorContext.json @@ -0,0 +1,73 @@ +{ + "Columns to Navigation Map": { + "Context": [ + "component", + "owner", + "Composite Thing" + ], + "Actors": [ + "component", + "type", + "Atomic Thing" + ], + "Property": [ + "component" + ] + }, + "Pattern Graph Edges": [ + [ + "composite owner", + "Composite Thing", + "type" + ], + [ + "component", + "Atomic Thing", + "type" + ], + [ + "A_composite owner_component", + "composite owner", + "memberEnd" + ], + [ + "A_composite owner_component", + "component", + "memberEnd" + ], + [ + "component", + "Composite Thing", + "owner" + ], + [ + "composite owner", + "A_composite owner_component", + "owner" + ] + ], + "Root Node": "component", + "Vertex MetaTypes": { + "A_composite owner_component": "Association", + "Atomic Thing": "Actor", + "Composite Thing": "Class", + "component": "Property", + "composite owner": "Property" + }, + "Vertex Settings": { + "A_composite owner_component": null, + "Atomic Thing": null, + "Composite Thing": null, + "component": { + "aggregation": "shared" + }, + "composite owner": null + }, + "Vertex Stereotypes": { + "A_composite owner_component": null, + "Atomic Thing": null, + "Composite Thing": "Block", + "component": null, + "composite owner": null + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/ActorRefiner.json b/ingrid/src/model_processing/patterns/ActorRefiner.json new file mode 100644 index 0000000..e0db13e --- /dev/null +++ b/ingrid/src/model_processing/patterns/ActorRefiner.json @@ -0,0 +1,38 @@ +{ + "Columns to Navigation Map": { + "Block": [ + "block" + ], + "Actor": [ + "actor" + ] + }, + "Pattern Graph Edges": [ + [ + "refiner", + "actor", + "supplier" + ], + [ + "refiner", + "block", + "client" + ] + ], + "Root Node": "refiner", + "Vertex MetaTypes": { + "block": "Class", + "refiner": "Abstraction", + "actor": "Actor" + }, + "Vertex Settings": { + "block": null, + "refiner": null, + "actor": null + }, + "Vertex Stereotypes": { + "block": "Block", + "refiner": "Refine", + "actor": null + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/CBAInputs.json b/ingrid/src/model_processing/patterns/CBAInputs.json new file mode 100644 index 0000000..8fdb5d1 --- /dev/null +++ b/ingrid/src/model_processing/patterns/CBAInputs.json @@ -0,0 +1,41 @@ +{ + "Columns to Navigation Map": { + "Action": [ + "act" + ], + "Input": [ + "inp" + ], + "Activity": [ + "activity" + ] + }, + "Pattern Graph Edges": [ + [ + "act", + "activity", + "owner" + ], + [ + "inp", + "act", + "owner" + ] + ], + "Root Node": "act", + "Vertex MetaTypes": { + "activity": "Activity", + "act": "Action", + "inp": "InputPin" + }, + "Vertex Settings": { + "activity": null, + "act": null, + "inp": null + }, + "Vertex Stereotypes": { + "activity": null, + "act": null, + "inp": null + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/CBAOutputs.json b/ingrid/src/model_processing/patterns/CBAOutputs.json new file mode 100644 index 0000000..f1dbe1c --- /dev/null +++ b/ingrid/src/model_processing/patterns/CBAOutputs.json @@ -0,0 +1,41 @@ +{ + "Columns to Navigation Map": { + "Action": [ + "act" + ], + "Output": [ + "out" + ], + "Activity": [ + "activity" + ] + }, + "Pattern Graph Edges": [ + [ + "act", + "activity", + "owner" + ], + [ + "out", + "act", + "owner" + ] + ], + "Root Node": "act", + "Vertex MetaTypes": { + "activity": "Activity", + "act": "Action", + "out": "OutputPin" + }, + "Vertex Settings": { + "activity": null, + "act": null, + "out": null + }, + "Vertex Stereotypes": { + "activity": null, + "act": null, + "out": null + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/RelSys.json b/ingrid/src/model_processing/patterns/RelSys.json new file mode 100644 index 0000000..8513fda --- /dev/null +++ b/ingrid/src/model_processing/patterns/RelSys.json @@ -0,0 +1,63 @@ +{ + "Columns to Navigation Map": { + "UseCase": [ + "usecase" + ], + "System": [ + "relsys" + ], + "UCPos": [ + "ucend" + ], + "SysPos": [ + "relsysend" + ], + "Assoc": [ + "relation" + ] + }, + "Pattern Graph Edges": [ + [ + "relsysend", + "relsys", + "type" + ], + [ + "ucend", + "usecase", + "type" + ], + [ + "relsysend", + "relation", + "owner" + ], + [ + "ucend", + "relation", + "owner" + ] + ], + "Root Node": "usecase", + "Vertex MetaTypes": { + "usecase": "UseCase", + "relsys": "Class", + "relation": "Association", + "relsysend": "Property", + "ucend": "Property" + }, + "Vertex Settings": { + "usecase": null, + "relsys": null, + "relation": null, + "relsysend": null, + "ucend": null + }, + "Vertex Stereotypes": { + "usecase": "requirementUseCase", + "relsys": "Block", + "relation": null, + "relsysend": null, + "ucend": null + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/UCElements.json b/ingrid/src/model_processing/patterns/UCElements.json new file mode 100644 index 0000000..e29d872 --- /dev/null +++ b/ingrid/src/model_processing/patterns/UCElements.json @@ -0,0 +1,95 @@ +{ + "Columns to Navigation Map": { + "Context": [ + "component", + "owner", + "Composite Thing" + ], + "UseCase": [ + "component", + "type", + "Atomic Thing" + ], + "Position": [ + "component" + ], + "Activity": [ + "activity" + ], + "Element": [ + "element" + ] + }, + "Pattern Graph Edges": [ + [ + "composite owner", + "Composite Thing", + "type" + ], + [ + "component", + "Atomic Thing", + "type" + ], + [ + "A_composite owner_component", + "composite owner", + "memberEnd" + ], + [ + "A_composite owner_component", + "component", + "memberEnd" + ], + [ + "component", + "Composite Thing", + "owner" + ], + [ + "composite owner", + "A_composite owner_component", + "owner" + ], + [ + "element", + "Atomic Thing", + "subject" + ], + [ + "activity", + "element", + "owner" + ] + ], + "Root Node": "component", + "Vertex MetaTypes": { + "A_composite owner_component": "Association", + "Atomic Thing": "Class", + "Composite Thing": "Class", + "component": "Property", + "composite owner": "Property", + "element": "UseCase", + "activity": "Activity" + }, + "Vertex Settings": { + "A_composite owner_component": null, + "Atomic Thing": null, + "Composite Thing": null, + "component": { + "aggregation": "composite" + }, + "composite owner": null, + "element": null, + "activity": null + }, + "Vertex Stereotypes": { + "A_composite owner_component": null, + "Atomic Thing": "Block", + "Composite Thing": "Block", + "component": "PartProperty", + "composite owner": null, + "element": "requirementUseCase", + "activity": null + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/UCOverview.json b/ingrid/src/model_processing/patterns/UCOverview.json new file mode 100644 index 0000000..c99d35b --- /dev/null +++ b/ingrid/src/model_processing/patterns/UCOverview.json @@ -0,0 +1,74 @@ +{ + "Columns to Navigation Map": { + "Context": [ + "context" + ], + "UseCase": [ + "usecase" + ], + "Actor": [ + "actor" + ], + "UCPos": [ + "ucend" + ], + "ActPos": [ + "actorend" + ], + "Assoc": [ + "relation" + ] + }, + "Pattern Graph Edges": [ + [ + "usecase", + "context", + "subject" + ], + [ + "actorend", + "actor", + "type" + ], + [ + "ucend", + "usecase", + "type" + ], + [ + "actorend", + "relation", + "owner" + ], + [ + "ucend", + "relation", + "owner" + ] + ], + "Root Node": "usecase", + "Vertex MetaTypes": { + "context": "Class", + "usecase": "UseCase", + "actor": "Actor", + "relation": "Association", + "actorend": "Property", + "ucend": "Property" + }, + "Vertex Settings": { + "context": null, + "usecase": null, + "actor": null, + "relation": null, + "actorend": null, + "ucend": null + }, + "Vertex Stereotypes": { + "context": "Block", + "usecase": "requirementUseCase", + "actor": null, + "relation": null, + "actorend": null, + "ucend": null + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/UCTriggers.json b/ingrid/src/model_processing/patterns/UCTriggers.json new file mode 100644 index 0000000..3a120f9 --- /dev/null +++ b/ingrid/src/model_processing/patterns/UCTriggers.json @@ -0,0 +1,41 @@ +{ + "Columns to Navigation Map": { + "UseCase": [ + "usecase" + ], + "Activity": [ + "activity" + ], + "Trigger": [ + "trigger" + ] + }, + "Pattern Graph Edges": [ + [ + "activity", + "usecase", + "owner" + ], + [ + "trigger", + "activity", + "owner" + ] + ], + "Root Node": "activity", + "Vertex MetaTypes": { + "usecase": "UseCase", + "activity": "Activity", + "trigger": "Trigger" + }, + "Vertex Settings": { + "usecase": null, + "activity": null, + "trigger": null + }, + "Vertex Stereotypes": { + "usecase": "requirementUseCase", + "activity": null, + "trigger": null + } +} \ No newline at end of file diff --git a/player-piano/player-piano-script.groovy b/player-piano/player-piano-script.groovy index c670368..2137fb2 100644 --- a/player-piano/player-piano-script.groovy +++ b/player-piano/player-piano-script.groovy @@ -307,10 +307,10 @@ try { //set the aggregation of the element to mod (property) equal to the found aggregation enum literal ele_to_mod.setAggregation(aggregation_kind) break - case 'Documentation': + case 'documentation': replace_log.add('(' + attribute_to_hit + ') Element ' + item_to_edit_reported + ' has documentation ' + CoreHelper.getComment(ele_to_mod) + ' to become ' + op_to_execute['value']); - CoreHelper.setComment(ele_to_mod, op_to_execute['value']); + CoreHelper.setCommentElement(ele_to_mod, ele_to_mod.getOwnedComment()[0]); break; case 'association': end_element = null; @@ -692,6 +692,78 @@ try { item_edited_value_reported); ele_to_mod.setRole(role_element); + break; + case 'opposite': + opposite_element = null; + if (op_to_execute['value'].split('_')[0] == 'new') { + opposite_element = temp_elements[op_to_execute['value']]; + } + else { + opposite_element = live_project.getElementByID(op_to_execute['value']); + } + + item_edited_value_reported = opposite_element.getID() + '(' + opposite_element.getHumanName() + ')'; + + replace_log.add('(' + attribute_to_hit + ') Setting opposite on ' + item_to_edit_reported + ' to ' + + item_edited_value_reported); + + ele_to_mod.setRole(opposite_element); + break; + case 'subject': + subject_element = null; + if (op_to_execute['value'].split('_')[0] == 'new') { + subject_element = temp_elements[op_to_execute['value']]; + } + else { + subject_element = live_project.getElementByID(op_to_execute['value']); + } + + item_edited_value_reported = subject_element.getID() + '(' + + subject_element.getHumanName() + ')'; + + replace_log.add('(' + attribute_to_hit + ') Setting method on ' + item_to_edit_reported + ' to ' + + item_edited_value_reported); + + // This is how to set properties that are collections in Groovy + + ele_to_mod.getSubject().add(subject_element); + + break; + case 'client': + element = null; + if (op_to_execute['value'].split('_')[0] == 'new') { + element = temp_elements[op_to_execute['value']]; + } + else { + element = live_project.getElementByID(op_to_execute['value']); + } + + item_edited_value_reported = element.getID() + '(' + + element.getHumanName() + ')'; + + replace_log.add('(' + attribute_to_hit + ') Setting method on ' + item_to_edit_reported + ' to ' + + item_edited_value_reported); + + CoreHelper.setClientElement(ele_to_mod, element); + + break; + case 'supplier': + element = null; + if (op_to_execute['value'].split('_')[0] == 'new') { + element = temp_elements[op_to_execute['value']]; + } + else { + element = live_project.getElementByID(op_to_execute['value']); + } + + item_edited_value_reported = element.getID() + '(' + + element.getHumanName() + ')'; + + replace_log.add('(' + attribute_to_hit + ') Setting method on ' + item_to_edit_reported + ' to ' + + item_edited_value_reported); + + CoreHelper.setSupplierElement(ele_to_mod, element); + break; case 'type': typing_element = null; @@ -915,6 +987,13 @@ try { new_element.setName(new_name); homeless_elements.add(new_element); break; + case 'Abstraction': + new_element = ele_factory.createAbstractionInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; case 'Activity': new_element = ele_factory.createActivityInstance(); temp_ids[item_to_edit] = new_element.getID(); @@ -922,6 +1001,62 @@ try { new_element.setName(new_name); homeless_elements.add(new_element); break; + case 'Trigger': + new_element = ele_factory.createSendSignalActionInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'Action': + new_element = ele_factory.createCallBehaviorActionInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'InputPin': + new_element = ele_factory.createInputPinInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'OutputPin': + new_element = ele_factory.createOutputPinInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'Actor': + new_element = ele_factory.createActorInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'Requirement': + new_element = ele_factory.createRequirementInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'UseCase': + new_element = ele_factory.createUseCaseInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'Comment': + new_element = ele_factory.createCommentInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setBody(new_name); + homeless_elements.add(new_element); + break; case 'Property': new_element = ele_factory.createPropertyInstance(); temp_ids[item_to_edit] = new_element.getID();