On Modularizing Triple Graph Grammars with Rule Refinement
Anthony Anjorin, Karsten Saller, Malte Lochau, Andy Schürr · Software Engineering & Management · 2015
A Triple Graph Grammar (TGG) is a set of declarative rules describing how consistent triples of graph structures in a source, target, and correspondence domain are to be generated. This generative and high-level specification of consistency can be automatically operationalized and used to derive model generators for test case generation, forward and backward translators, and incremental model synchronizers. As with any domain specific language, a means to modularize TGG specifications is an important requirement, especially for practical applications. We formalized an extended concept of rule refinement for TGGs in previous work and now report on our experience from using rule refinements intensively in a recent industrial project. 1 Rule Refinement for Triple Graph Grammars in a Nutshell Restoring and maintaining consistency amongst multiple artefacts is an important challenge towards supporting concurrent engineering. This is a primary application of bidirectional languages, which support incremental change propagation with a precise semantics. Triple Graph Grammars (TGGs) [Sch94] are a prominent example for a bidirectional language, with various implementations and success stories. In large TGG specifications, a means of avoiding redundancy and enabling a reuse of rule fragments becomes crucial for maintainability. In previous work [ASLS14], we formalized a flexible concept of rule refinement for TGGs, extending existing ideas from various authors. In this paper, we report on our experience using rule refinement in practice. We describe usage patterns that have evolved, and suggest possible improvements and extensions. As we can only provide a high-level intuition in this paper, the reader is referred to [ASLS14] for further details. TGG rules are essentially graph patterns describing how consistent triples of graph structures in a source, target, and correspondence domain are to be generated. The basic idea of enabling a refinement of TGG rules is to (1) provide a merge operator with which multiple basis rules can be combined, and (2) allow an overriding of certain parts of the merged basis rules in a sub-rule. In our implementation of rule refinement, the labels of the nodes and edges in each rule serve as identifiers. A merge of rules is realized as a union followed by a gluing of elements with the same name. Repeating elements with the same name in a sub-rule equates to overriding the corresponding element in the merged basis rule. All restrictions required to guarantee a well-defined process are presented in [ASLS14].