Bx Examples Repository
Title: LibraryToBibliography
Version: 0.1
Type: Sketch
Overview
This is a simple example demonstrating an interesting kind of information loss in the forward direction and corresponding freedom of choice in the backward direction.
Library models representing the content of a library are transformed to a bibliography model representing the structure of a bibtex-like file.
Models
The diagram below depicts a concrete library model to the left and a corresponding bibliography model.
Library models consist of a single root Library containing all Authors and Books. Bibliography models are isomorphic with respect to this structure, i.e., consist of a single root Bibliography containing Researchers and Publications.
The interesting twist is that every Researcher has their own Publications and do not "share" Publications.
In the library model, however, Books can be written by multiple Authors. This means that even though two different books might have the same title (a common title in the diagram below), it is still clear that these books are connected to different authors and are thus distinguishable.
In the corresponding bibliography model, this information is lost in the sense that every researcher now has a publication a common title and it is impossible to know if they resulted from the same book, from two (as is the case here), or from 3 or 4 books.
Consistency
Consistency Restoration
Properties [optional section]
Variants [optional section]
Depending on how the details concerning consistency restoration are hammered out, there can be many variants of the same example expressing different preferences of a user.
Discussion
Propagating changes to the bibliography model can be challenging: Adding a new publication can lead to a adding a new book to the library or, if books with the appropriate title already exist, can be attributed to any one of them (the user has to intervene here). How about renaming a publication? This is clear if there is a 1-1 correspondence to a book (just rename the book appropriately). If it is not the only publication that corresponds to its book a reasonable expectation might be to break the correspondence and handle the renamed publication as if it were newly added (as already discussed).
This is, however, not the only possible way of handling the change… Maybe the user actually wanted to rename the book and just forgot to rename every single corresponding publication?
The point here is the example appears very simple but is actually very hard to get right. The provided TGG implementation in the Artefacts section is very unsatisfactory and highlights various problems and possibly missing language features required to express the desired consistency relation.
References [optional section]
I really can't remember where we got this example from. Please feel free to add a reference here if you know the example (or a variant of it) from somewhere else.
Author(s)
Anthony Anjorin
Reviewer(s)
Comments
Artefacts [optional section]
A virtual machine hosted on Share is available with a workspace containing both (Ecore) metamodels, the concrete example used above, and a TGG formalizing the consistency relation as a set of rules: