6.2.5.51. Architecture-ReengineeringEACodeEngineering

Generate UML-based Architecture from RFG representation of code

Required inputs: RFG

Use an architecture and mapping initially generated from code information to do architecture verification. Models generated using this rule represent an Enterprise Architect (EA) model similar to the code engineering feature of EA.
  • A class is mapped to an EA Class
  • A class with Element.Is_Enum is mapped to an EA Class with stereotype «enumeration»
  • A class with Element.Is_Union is mapped to an EA Class with stereotype «union»
  • A class with Element.Is_Struct is mapped to an EA Class with stereotype «struct»
  • A class with Element.Is_Struct and Element.Is_Typedef_To_Anonymous is mapped to an EA class with stereotype «struct».
  • A class with Element.Is_Abstract and Element.Is_Interface is translated to an EA «interface».
  • Methods are translated to EA Operations with the visibility being set to either Element.Is_Public_Visibility or Element.Is_Private_Visibility.
  • Namespaces are translated to EA Packages
  • Constants are translated to EA attributes
Other predefined model representations can be obtained by using the rules whose name start with Architecture-Reengineering. If you require a customized model representation, use rule Architecture-Reengineering (see also additional documentation there).

Possible Messages

This rule has no predefined messages.

Options

base_view_name

base_view_name : str = 'Declaration Facts'

Base view used for generating architecture view.
 

export_warnings

export_warnings : bool = True

Export output messages to the analysis database.
 

external_architecture_view_name

external_architecture_view_name : str | None = None

Existing external architecture view for preparing an architecture check. If the value is not None, the view V having name external_architecture_view_name is treated as architecture view given from outside. The rule then checks, after creating the generated architecture view and mapping view, whether the code structure matches the hierarchical structure of elements in V (using the rules specified by the config option transformation). If this check succeeds, a view "NAME Mapping" and a view "NAME for check" are created, which represent mapping view and architecture view that is transformed to be used in the actual architecture check (e.g., UML dependency edges are transformed into source dependency edges).
 

generated_architecture_view_name

generated_architecture_view_name : str = 'Generated Architecture'

Name of the generated architecture view, created from the contents of hierarchy view and base view (whose names are given by config options hierarchy_view_name) and base_view_name, respectively.
 

generated_mapping_view_name

generated_mapping_view_name : str = 'Generated Mapping'

Name of the generated mapping view, created from the contents of the hierarchy view, whose name is given by config option hierarchy_view_name.
 

hierarchy_view_name

hierarchy_view_name : str = 'File'

Hierarchy view used for generating architecture and mapping views, and, if config option external_architecture_view_name is set, for checking the hierarchical consistency of the external architecture view.
 

loglevel

loglevel : LogLevel = 'WARNING'

Logging mode. WARNING only outputs errors and warnings, INFO additionally prints info messages, DEBUG additionally outputs info and debug messages.
 

transformation

Configuration settings for architecture meta model, defining how information from hierarchy and base view is transformed into architecture and mapping view.
 

transformation.advanced_node_translation

Type: dict[str, typing.Callable[[_dg.Node, _dg.View, bauhaus.architecture.reengineering.nodes.GenArchNode, bauhaus.architecture.reengineering.config.Code2ArchTransformConfig], bauhaus.architecture.reengineering.nodes.GenArchNode]]

Default:

{
   'Class': <function bauhaus.rules.axivion.architecture.architecture_reengineering.class_translation(code_node: _dg.Node, _: _dg.View, parent: bauhaus.architecture.reengineering.nodes.GenArchNode, transformation_config: bauhaus.architecture.reengineering.config.Code2ArchTransformConfig) -> bauhaus.architecture.reengineering.nodes.GenArchNode>,
   'Method': <function bauhaus.rules.axivion.architecture.architecture_reengineering.method_translation(code_node: _dg.Node, _: _dg.View, parent: bauhaus.architecture.reengineering.nodes.GenArchNode, transformation_config: bauhaus.architecture.reengineering.config.Code2ArchTransformConfig) -> bauhaus.architecture.reengineering.nodes.GenArchNode>,
   'Type': <function bauhaus.rules.axivion.architecture.architecture_reengineering.type_translation(code_node: _dg.Node, _: _dg.View, parent: bauhaus.architecture.reengineering.nodes.GenArchNode, transformation_config: bauhaus.architecture.reengineering.config.Code2ArchTransformConfig) -> bauhaus.architecture.reengineering.nodes.GenArchNode>
}
Rules for translating single nodes. Keys are type names, values specify how a node of the given node type should be translated into an architecture node. Values are given in form of callables having signature

(node: rfg.Node, view: rfg.View, parent: reengineering.GenArchNode, transformation_config: Code2ArchTransformConfig) -> GenArchNode.

This option allows for a more refined translation rule than the one given in node_translation. The entries in node_translation take precedence when looking for a translation of a node: If e.g. the translation rule of a node of type Class has to be determined, first a lookup is done in node_translation. If there is no entry specified there with Class as key, another lookup is done in advanced_node_translation. If no matching translation rule is found, then the node is not represented in the architecture.
 

transformation.annotate_dependency_counts : str | None = None

If set to a type name typename (e.g. Call): Adds a tagged value UML:taggedValue:typename:Count that counts the number of summarized dependency edges of the given type. Only added if the count is greater than 0.
 

transformation.dependency_lift : typing.Callable[[_dg.Edge, _dg.View], typing.Optional[typing.Tuple[_dg.Node, _dg.Node]]] | None = None

If specified, the function returns the desired source and target node that should represent the given dependency, or None if no dependency should be generated. In most cases, the nodes will be parent nodes relative to the given (hierarchy) view. If this option is specified, node_types_with_dependencies has no effect.
 

transformation.detailed_dependencies : bool = False

If set to False, every generated dependency will be of the most general source dependency type Source_Dependency; otherwise, the dependencies will be exactly the type they are in the base view (e.g. Type_Of, Direct_Call.
 

transformation.excluded_source_names : list[str] = ['src', 'inc', 'include']

Do not translate source entities (files or directories) having one of the names given here. Only used if advanced_node_translation is set to None.
 

transformation.ignored_dependencies : set[str] = set()

These dependencies will not be modelled and therefore are implicitly always allowed in the resulting architecture.
 

transformation.level_restriction : int = 0

Only descend to code entities of this depth level for generating model elements. If e.g. level_restriction = 2, the directory src/app is still separately modeled, but not src/app/internal. If set to 0: no level restriction.
 

transformation.node_translation

Type: dict[str, NodeTransformConfig]

Default:

{
   'Class_Template':    bauhaus.architecture.reengineering.config.NodeTransformConfig(
      name_provider='IDENTICAL',
      node_type='Class'
   ),
   'Constant':    bauhaus.architecture.reengineering.config.NodeTransformConfig(
      name_provider='IDENTICAL',
      node_type='Attribute'
   ),
   'Member':    bauhaus.architecture.reengineering.config.NodeTransformConfig(
      name_provider='IDENTICAL',
      node_type='Attribute'
   ),
   'Namespace':    bauhaus.architecture.reengineering.config.NodeTransformConfig(
      name_provider='IDENTICAL',
      node_type='Package'
   )
}
Rules for translating single nodes. Keys are type names, values specify how a node of the given node type should be translated into an architecture node. Node types have to match exactly (so e.g. a node of type Class does not match a translation rule having Source_Entity as key). The default translates nodes of type Directory into packages and nodes of type File or Module into components. If there is no entry given for the type of the node, a translation is searched for in advanced_node_translation (this option allows for a more refined translation rule if needed). The entries in node_translation take precedence when looking for a translation of a node: If e.g. the translation rule of a node of type Class has to be determined, first a lookup is done in node_translation. If there is no entry specified there with Class as key, another lookup is done in advanced_node_translation. If no matching translation rule is found, then the node is not represented in the architecture.
 

transformation.node_types_with_dependencies : set[str] = {'Component', 'Package'}

Only from nodes of this type there will be outgoing / incoming dependencies. Dependencies from nodes of different type are lifted to the nearest parent node having one of those types, and are not represented if no such parent exists. Default is Component and Package. Only used when lift_dependencies is not specified (None).
 

transformation.root_name : str = 'Model'

Name of the architecture root in the generated architecture view
 

transformation.root_type

Type: ArchitectureNodeType

Default: 'Package'

Node type of the architecture root
 

transformation.skipped_root_paths : list[str] = ['/', 'c:', 'C:', 'd:', 'D:', '']

Do not generate architecture representation for these code parts.
 

transformation.transferable_attributes

Type: set[str]

Default: {'Element.Has_Private_Visibility', 'Element.Has_Public_Visibility', 'Element.Is_Abstract', 'Element.Is_Static', 'Element.Is_Virtual_Method'}

Set of attributes for various architecture nodes that are transferred from the code view. Only used if advanced_node_translation is set to None.
 

transformation.treat_dependencies_as_optional : bool = True

Generated dependencies will be marked as optional if set to True. This can be useful e.g. if an architecture for multiple product variants has to be created and certain parts of the project are only used in certain project variants.
 

Option Types

These types are used by options listed above:

ArchitectureNodeType

An enumeration.
 
  • None

  • Attribute

  • Class

  • Component

  • Operation

  • Package

LogLevel

An enumeration.
 
  • WARNING

  • INFO

  • DEBUG

NodeNameProvider

An enumeration.
 
  • IDENTICAL

  • STRIP_FILE_EXTENSION

NodeTransformConfig

NodeTransformConfig(node_type: 'ArchitectureNodeType' = , name_provider: 'NodeNameProvider' = )
 

name_provider

Type: NodeNameProvider

Default: 'IDENTICAL'

node_type

Type: ArchitectureNodeType

Default: 'Component'