# Introduction

This is a public instance of the ClaferWiki to serve as a model repository. We are publishing example models that showcase Clafer as a lightweight structural modeling language. For installation, visit Software.

Each wiki page contains a single Clafer model. The model can be split into model fragments and interwoven with rich-text contents (literate modeling). The model is compiled using the Clafer compiler and rendered as HTML, which provides syntax and error highlighting and hyperlinking, and as a Graph, which provides a different view on the model that emphasizes inheritance and references. Double click on the graph shows/hides references.

## Release announcements and changes

| 0.5.0 (Behavioral clafer). See Behavioral Modeling for examples.

# Learning Clafer

Clafer Cheat Sheet

## Domain concept modeling using Clafer

This tutorial presents basics of Clafer using few examples, introduces Clafer a bit more precisely (but not formally), and finishes with a modeling exercise with two alternative reference solutions.

Contents:

## Guidelines for feature modeling using Clafer

Feature Modeling using Clafer

Inheritance of Group Cardinality

## “Train Station Layout” domain modeling tutorial

Go to Interactive Tutorial

## “Traffic Lights” domain modeling tutorial

Interactive Tutorial

## Micro-level and macro-level modeling patterns

Some methodological advice on modeling in Clafer from Alexandr Murashkin’s MMath Thesis (University of Waterloo, 2014) “Automotive Electronic/Electric Architecture Modeling, Design Exploration and Optimization using Clafer”.

# Clafer usage scenarios

Clafer can be used in a number of scenarios:

## Product-line architecture modeling

Modeling features of products in a product line and their realization as components.

## Multi-objective optimization of product lines

Modeling features of products in a product line with their quality attributes. Multi-objective optimization discovers which products are optimal given the optimization goals such as “minimize total mass” and “maximize total performance”.

## Data center resource allocation problems

Modeling and multi-objectively optimizing resource allocations. Models created by Alexandr Murashkin.

• Allocate services with the given requirements on machines. Maximize the number of free machines.

ISAP Optimization

• Like ISAP but customized to handle time-varied requirements

TSAP Optimization

## Domain modeling

Feature-based modeling of domain concepts and business rules.

## Model transformation

An example FamiliesToPersons inspired by ATL/Tutorials - Create a simple ATL transformation. We let the reader appreciate the simplicity, conciseness, and declarative nature of this transformation in Clafer.

## Other cool examples

Clafer is a general-purpose structural modeling language but it’s strengths make it particularly useful in modeling scenarios whereby containment hierarchies and model evolution are very important.

Below are some other examples:

## Behavioral modeling

As of version 0.5.0, Clafer can be used for specifying how the structures evolve over time. In this setting, a static Clafer model describes the possible states of the system, whereas, the temporal aspects specify how the states can change.

## Demo spaces

Here are pages for the different tool demos:

# ClaferWiki-specific help

Below is the Clafer-specific markup that can be used in the wiki pages. On the right is the screenshot of the ClaferWiki-Specific Help page which demonstrates the usage of the markup shown on the left.

 Add a Clafer code fragment as follows: clafer abstract A c -> C * A1 : A [ #c = 2 ] abstract B : A abstract C  Top-level clafers can be placed into separate code fragments but they cannot be split in the middle. That is all children of a top-level clafer must belong to the same code fragment. or in the full code block notation {.clafer} C1 : C C2 : C  Add the Analyze with ClaferMooViz button {.clafer .mooviz}  Add a graph in the simplified notation: {.clafer .graph}  Double click on the graph in the simplified notation to show/hide references. By default, the graph only shows inheritance relationships allowing for quick inspection of the inheritance hierarchy which is not directly visible in Clafer’s textual notation. Add a graph in the CVL notation: {.clafer .cvlGraph}  Add statistics: {.clafer .stats}  Add download links for a complete model file (.cfr) and a self-contained HTML rendering of the model file (.html): {.clafer .links}  Add summary, which includes 1) a graph in the simplified notation, 2) module statistics, and 3) the download links: {.clafer .summary} 

Use the Preview button to compile the model and see parsing and compilation errors, if any. At most one error is reported for each code block. If a parsing error is reported, compilation is not executed and therefore no compilation errors are reported.

Use the Save button to commit your edits to the Git repository.

# Gitit Wiki general help

For instructions on how to make a link to another wiki page, see the Help page. To create a new wiki page, just create a link to it and follow the link.

Help is always available through the “Help” link in the sidebar. More details on installing and configurating gitit are available in the Gitit User’s Guide.