winery

Reuse the pattern refinement implementation for pattern detection

Context and Problem Statement

To create an executable deployment model, the pattern refinement process replaces a matching subgraph with the Refinement Structure of a PRM. To create a PbDCM, the pattern detection process replaces a matching subgraph with the Detector of a PRM. The replacement procedure is identical for both processes, only the structures used for the replacement differ. Therefore, the implementation of the pattern refinement process should be reused to implement the pattern detection process.

Decision Drivers

Considered Options

Decision Outcome

Chosen option: “Swap the Detector of all PRMs with their Refinement Structures”, because reimplementation introduces too much duplicate code and a common interface requires a lot of boilerplate code while also decreasing readability.

Positive Consequences

Negative consequences

Pros and Cons of the Options

Swap the Detector of all PRMs with their Refinement Structures

In the backend, the elements of the PRMs retrieved from the repository are swapped, .i.e, the Detector of each PRM is set to its Refinement Structure, its Refinement Structure is set to its Detector, and all mappings are adapted accordingly.

Reimplementation

The complete pattern refinement code is reimplemented for pattern detection, i.e., the reimplemented code considers the Detector during the replacement, redirection of Relations using the Relation Mappings, and retaining elements using the Stay Mappings.

Use common interface

Implement an interface which returns the Refinement Structure of a PRM for the replacement procedure of the pattern refinement process and returns the Detector of a PRM during the pattern detection process.

License

Copyright (c) 2021 Contributors to the Eclipse Foundation

See the NOTICE file(s) distributed with this work for additional information regarding copyright ownership.

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 which is available at https://www.apache.org/licenses/LICENSE-2.0.

SPDX-License-Identifier: EPL-2.0 OR Apache-2.0