| Skip to content. |
Lehrstuhl Systemanalyse |
| Language Modelling HomeA MOF 2.0 for JavaTextual Editing FrameworkModel Pattern | |
MOPA is a Java extension. Every Java program is also a MOPA program; but in MOPA you can define special Pattern methods. In those methods you define Pattern and specify what happens, when such a pattern matches.
In case of MOPA, patterns are partial data structures that act as templates, or like we prefer to call them patterns. MOPA will try to locate instances (matches) for those patterns in your real data. Those patterns can be define using abstract data structures to act as polymorphic patterns. When you have object-oriented data structures, you can write MOPA patterns at different abstraction levels.
MOPA needs a tree structure in the data. MOPA will traverse these trees from their roots to their leaves, and at every node it "holds the patterns over the node" and checks whether the data at that node matches a pattern or not.
Semantic blocks are pieces of Java code that will be executed when ever a pattern matches. Within a pattern you can bind parts of the matching data to local variables and use these variable in the semantic block. You can use a few additional keywords in semantic blocks to control MOPA's tree traversal.
Trees are basically graphs without circles. Many data structures induce a tree structure; in some trees are more obvious then in other. XML documents or abstract syntax trees are some of the more obvious tree data structures. But also UML/MOF based models contain trees, induces by container-content relationships.
MOPA currently supports JMI models and Javacc ASTs. It is planned to also support models in A MOF 2.0 for Java, and XML-DOM trees.
MOPA actually runs on a abstract tree interface. You simply have to implement this interface for your data structures.
This is probably not true. Even if your data is more like a general graph, you still will find spanning trees in those data.
It was the original intent to write a tool for pattern matching in JMI models.
We recently released version 0.8 of MOPA; it can be downloaded in the download section. This version supports the following features:
We are continuously extending our meta-modelling tools. It follows a prioritized list of feature that will be available soon: