How to link your DSL with a Wiki

It is reasonable to document model objects within a standard Wiki. This tutorial shows how to connect elements of your DSL to Wiki pages in Atlassian Confluence.

Illustrating the linking feature

This feature can be instantly illustrated with a standard OOMEGA model repository - even without creating a DSL in the first place. OOMEGA Core contains a concept called URIRef that covers links to other resources like websites or e.g. Wiki pages in Atlassian Confluence. Let's demonstrate how to create a link to a Wiki page in your model repository.

  • Switch to the OOMEGA perspective.
  • Create a model repository by selecting e.g. File > New > Text-based Repository Project. Choose the name Tutorial.
  • Create your first URIRef object by choosing Create ... as entry > URIRef in the context menu of ModelFolder Models.
  • Select the newly created object and enter the following in the Properties view:

Now you can double-click on the URIRef object and you will notice that the web browser will be opened and shows the Quick Start Tutorial wiki page. Please note: you can manage a hierarchy of documents in Atlassian Confluence. Anyway the name of a document within a Wiki space (e.g. TUT/Tutorials) is unique and thus the URI always has the same structure: Wiki URI + "/display/" + space name + "/" + page name.

Extending the concept AbstractURIRef

In practice you probably won't choose to enter static URIs in order to create links to Wiki pages in the workspace. Rather you will introduce some naming convention and automatically derive the wiki page URI from other informations in your model.

For this purpose you can extend the concept org.oomega.base.AbstractURIRef and overload the inferred property String uri. Here's an example.

package org.metamodels.softwareengineering.common;

import org.oomega.base.*;
import org.metamodels.softwareengineering.component.*;

@entity (weak=true, cid=10364) class WikiPage
  extends org.oomega.base.AbstractURIRef
{
  @association (foreign="wikiPage") Subsystem belongsToSubsystem;
  @association (foreign="wikiPage") Component belongsToComponent;
	
  @inferred String uri() {
    if (getBelongsToSubsystem() != null) {
      return getBelongsToSubsystem().getWikiPageURI();
    }
    else if (getBelongsToComponent() != null) {
      return getBelongsToComponent().getWikiPageURI();
    }

    return null;
  }
}

This sample code is an excerpt of the metamodel org.metamodels.softwareengineering. The URI is actually calculated.

The source of this example can be found in metaMODELS.org's SVN repository.

  • Repository location: https://svn.metamodels.org/repository
  • Path to project: /Metamodels/Modelling Languages/Software and Systems Engineering/SoftwareEngineering/trunk/org.metamodels.softwareengineering
  • Relevant model files: org.metamodels.softwareengineering.common.WikiPage, org.metamodels.softwareengineering.component.Subsystem

Finally, let's show the result. When you browse a software engineering model, you can follow a hyperlink in the text editor by clicking "CTRL + Left Mouse Button" on the respective text. In the example beneath you would click on S2. Again, the web browser will be opened and shows the appropriate Wiki page.


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.