Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools



Follow the installation instructions for LogicAJ and set up the LogicAJ Demo Project.

Getting Started

Assign a Factbase to your Java Project To activate JTransformer for an existing Java project switch to the Java Perspective, right-click on the Java project in the context menu and select Assign JTranformer Factbase.
A Background job generating the fact representation should start immediately, as indicated by a progress bar in the lower right corner of the window. As usual you can open the Progress View (Window→Show View→Basic→Progress), to get more detailed information. Note that this initial fact generation may take a while on large projects, but it only happens once. From this point on, the fact representation will be updated on every change to the Java source, as long as there are no compilation problems.

By assigning the jtransformer factbase a project with the name <project name>-output is created and your project is marked with a green JT in the upper left corner of the project icon. See screenshot on the right.

Overview of the LogicAJ Eclipse Integration

Now the project is ready for use with LogicAJ aspects. Import the LogicAJ demo project into your workspace (File→Import). Open an aspect from the directory aspects. The screenshot below shows the integration of the LogicAJ compiler into Eclipse. The LogicAJ editor provides highlighting and an outline for the aspect constructs. Errors in the LogicAJ aspects and the blame assignment of the declare error / warning statements are shown in the standard problems view:

LogicAJ Editor

Compile and Weave an Aspect

Aspect compilation and weaving are two different steps in LogicAJ. Compilation checks the syntactic correctness of the aspect and the type safety of aspect code that does not depend on logic-meta variables.

The compilation is done automatically on every save of a file or if you press the cCompile Aspect button (see toolbar on the right).

Weave Aspect ActionWeave Aspect Context Menu Item

Select Aspects to Weave

To weave/deactivate an aspect toggle the Weave Aspect item in navigator's context menu. This item will add resp. remove the aspect from the /lajbuild file in the project's root folder. It contains project relative paths to the selected aspects:


Here you may change the order of the aspects. The order is important if you refer to an introduces class member from another introduced element of advice. The introducing aspect must come first in the lajbuild file in this case.

LogicAJ ToolbarLogicAJ Toolbar


To weave the selected aspects press the Weave aspects button in the LogicAJ toolbar (see screenshot on the right). Make sure that the file currently open in the editor is contained in the project you want to weave. The button only weaves the aspects for the enclosing project.

OutlineLogicAJ Outline

Weaving Results

Weaving results will be shown in the outline. In the outline you can click on the rows below the aspect construct to show the join point shadow in the editor. It is underlined in the source code.

Alternatively you may open the the weaving results view which shows an aggregation of all aspect outlines in on view: LogicAJ→Show Weaving Results

Starting a woven application

The LogicAJ compiler realizes aspect weaving as a source-to-source transformation. The weaving step generates all (woven) classes into the corresponding output project.

That's why you run your main classes (Html2Wiki in case of the LogicAJDemo project) only from the output project.

research/logicaj/tutorial.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024