More then Model Pattern

What is MOPA?

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.

What are Pattern?

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.

How does MOPA try to match Pattern to real data?

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.

What are Semantic Blocks?

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.

What are Trees?

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.

What kind of Trees exist?

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.

I have data that is not supported by MOPA, what can I do?

MOPA actually runs on a abstract tree interface. You simply have to implement this interface for your data structures.

There are no Trees in my data.

This is probably not true. Even if your data is more like a general graph, you still will find spanning trees in those data.

Why is it called MOPA anyway

It was the original intent to write a tool for pattern matching in JMI models.

Version 0.8

We recently released version 0.8 of MOPA; it can be downloaded in the download section. This version supports the following features:

Upcoming Versions

We are continuously extending our meta-modelling tools. It follows a prioritized list of feature that will be available soon:

  1. MOPA tree for A MOF 2.0 for Java
  2. MOPA tree for XML
  3. An Inheritence/Extension mechanism for Pattern methods