Wiki

Clone wiki

morel / XMU3

XGU: bidirectional graph update library

Introduction

XGU (XMU core) is a bidirectional graph update Java library. It contains a set of primitives to bidirectionally convert graphs. It employs a model-merge-based BX combinator to handle shared node issues. XGU contains a miniset of BiGUL to achieve the BX over values.

The goal of XGU is to provide a foundation for BXs over graph-like data, such as models. XGU is intended to be integrated with other high-level languages.

KNOWN LIMITATION: The dynamic check discussed in our paper is not fully implemented in our tool for the performance consideration. We are trying to find a more efficient way of checking the well-behavedness of a XMU core program.

XGU Library

The core library is independent of EMF but is built on a general graph interface. It realizes the following BX constructs:

  1. MatchSource patS b: find a match of patS in the source and go on synchronizing the source and the view with b and the match. Note that the match should be unique.
  2. MatchView patV b: find a match of patV in the view and go on synchronizing the source and the view with b and the match. Note that there may be many matches, however only one of them can be used to trigger b successfully.
  3. ExpandSource patS b: do synchronization with b, and then ensure that there is a match of patS (if the match does not exist, create a new one). In the forward direction, it behaves like MatchSource.
  4. ExpandView patV b: in backward direction, it is similar to MatchView. In the forward direction, it creates a new match of patV and merges the match into the result of b.
  5. Align patS patV a b c d: update the matches of patS with the matches of patV. "a" is the alignment condition; "b" is the bx to be executed for each alignment; "c" is the creation action for unmatched view; "d" is the deletion action for unmatched source.
  6. ParallelComposition b1 b2 ...: merge the results of b1, b2, ...
  7. Switch cases adaptions: the bidirectional switch-case construct.
  8. GraphReplace patS patV bigul: update a match of patS with a match of patV. The primitive value synchronization is performed by using the bigul function (XMU core supports a reduced set of BiGUL primitives).
  9. Indexing indexSig <s1,s2...|v1,v2...> b: append an index to the result of b.
  10. ContextSource v<-expr-with-source b: register a new view variable v in the view context and bind a source value (computed by expr-with-source) to v; then execute b. Note that after executing b, the primitive will re-evaluate expr-with-source to check if the value changes (it is not allowed to change the value).
  11. Derive s<-expr-with-source b: register a new view variable s in the source context and bind a source value (computed by expr-with-source) to v; then execute b.
  12. Dependency v<-expr-with-view b-without-v: it first claims that the view variable v in the current view context can be derived from other view variables, and then goes on doing synchronization without v.
  13. ForEachMatchSource patS b: do synchronization for each match of patS.
  14. Invocation b varMappings: it is the rule call statement.

Core Editor

Core Editor

We provide a core editor that is based on Xtext. The core editor has the following features:

  • Integration with Java. XMU core editor integrates Xtend, a dialect of Java, to define unidirectional actions. The core editor also extends Xtend with some model navigation and modification expressions. At last, the core editor is able to generate Java code to realize the bidirectional transformation.
  • Type inference and validation. XMU core is a strong typed language (regarding model types). Each BX primitive in XMU core must be annotated with a type. The core editor provides a type inferencer which can automatically infer the type of the BX primitive. Developers may also explicitly define the type if the inferred type is not suitable (since there may be many possible types).
  • Pattern Matching. XMU core now supports complex pattern matching semantics, including grouping, filtering, and value derivation. Grouping allows to match collection-based values (by grouping a set of matches). Filtering provides an extra condition to filter the matches of a pattern. Value derivation enables us to derive some values from a match of a pattern (those values are also viewed as part of the match, however they do not contribute the graph structure).

Examples

  1. Bag2Bag
  2. Institutional Address Book
  3. Family2Person
  4. List2List

More Information about XMU

Updated