SDA SE Wiki

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

User Tools

Site Tools


Factbase Inspector (FBI)

Open a Factbase Inspector

There is more then one way to open a new Factbase Inspector.

Opening the Factbase Inspector from the Package Explorer

Simply right-click on the file you want to open in the Factbase Inspector and choose “Open in Factbase Inspector” from the context menu

Opening the Factbase Inspector from the Java Editor (Source Code)

Select the part of the source code which you want to inspect in the Factbase Inspector and right-click in the Java Editor to open the context menu. Choose “Open in Factbase Inspector”.
The selection doesn't need to be exact.A heuristic will find the first element that includes your selection and open the corresponding fact. As you can see in the screenshot below, we selected a method, so our root in the Factbase Inspector is the corresponding methodT fact.

If you did not select anything, the whole file will be opened in the Factbase Inspector,so the result will be equal to opening the factbase inspector from the Package Explorer.
The linking between Factbase Inspector and Java Editor works also the other way around, meaning that you can select the source code corresponding to a Node from the Factbase Inspector. See context menu - Show Source Code

Opening the Factbase Inspector from the Prolog Console

To open a Factbase Inspector from the Prolog Console we first need an ID. For example you can open a Factbase Inspector from the result of a querry. Consider this simple querry:

?- classT(Id, Pkg, 'B', Members).

This querry matches the class with the name 'B' . The result will be something similar to:

Id = 37953,
Pkg = 37091,
Members = [49394, 49395, 49396, 49397, 49398, 37954, 49399, 49400, 49401|...] ;

Note that the precise IDs might be different on your system.

Now select the returned as the Id for the class “B” and in the context menu select “Open In Factbase Inspector”:


Nodes and Folders

If we expand a Factbase Inspector we will see different types of Nodes. In the first level of expansion we see (for example as in the screenshot above) 3 folders.1) Folders are used to group nodes of the same type, in this example we have:

  • Comments: Includes the comments documenting this class.
  • Defs: Includes all facts that are defined inside this class.
  • Relations: Includes the relations which this class is a part of and also the modifier of this class.

Depending on the type of the expanded node, there can be other groups (for example, “block”, a group that includes all the PEFs inside the block of a loop).

Each node has a symbol that indicates the state of this node.
For example, a green block indicates that the element has a piece of corresponding source code. A red block means, that there is no corresponding source code (for example the implicit constructor). The red greater (“>”) and smaller (“<”) signs in the icon tell you that the shown element has been modified. The following screenshots shows how a Factbase Inspector could look like after a transformation has been applied:

By clicking on the “Factbase Inspector Help” Icon, which is indicated by the red circle in the upper screenshot, you can see a description for all node status icons used in the Factbase Inspector.

Deleted nodes

Presentation of deleted nodes in the FBI

The FBI can also show deleted facts and relations. They are marked with a :-: sign.


Context Menu

You can bring up the context menu of a node by right-clicking on the node. The Context Menu entries are selection-sensitive – depending on the selected node some actions will be active, deactivated or replaced by a node-specific variant. The context menu includes the following entries:

Show Enclosing

A sub menu allowing you to navigate the PEF model “upwards”, to an enclosing element of the currently selected node. In our example, a methodT fact is enclosed by a class, a compilation unit and a package.

Show Source Code

Opens an editor2) and highlights the source code that this fact represents.

Show Reverse Engineered Code

Shows the source code from the selected node, re-engineered from the fact representation. The following screenshot shows a popup with the re-engineered source of a method after an encapsulate Field transformation (see CTs/Encapsulate Field). Above you can see the original source (without getter and setter calls).

Copy Node to Clipboard

Get a textual representation of the selected node, which you can paste into a Prolog file, as a template for a query or transformation. See Source Templates for Conditions and Transformations for detailed information's.

Copy NodeTerm to Clipboard

For example in the screenshot above it would copy the NodeTerm “methodT(17411, 17404, myMethod, [], type(basic, void, 0), [], 17412)” to your clipboard.

Open Factbase Inspector

Displays a dialog for opening a new Factbase Inspector.


Factbase Inspector Options

The Factbase Inspector Options let you customize your Factbase Inspector behavior and appearance.

  • Show references: Some nodes have cross-references to other nodes. If you choose “Current window” the cross-references will be displayed as children of the current node. Default is “New window”, which means that a new Factbase Inspector with the cross-referenced node will be opened when explicitly selecting “Show referenced” from the context Menu of the referencing node (or by using the corresponding button, see button overview).
  • Show arguments: Determines how node text should be displayed. Simply click on the possible options and watch the preview box, which displays the effect of the current choice.
  • Show Node-Groups: If you disable this option, Nodes will not be arranged in Folders anymore (see nodes and folders)
  • Tooltip settings: Determines the appearance of tooltips3) should look like. Simply click on the possible options and watch the preview box, which displays the effect of the current choice.
  • Show source localtion settings: if you enable this option, the information about the source location will be added to the argument. Simply click on the possible options and watch the preview box, which displays the effect of the current choice.
  • Auto-Refresh settings: Auto-refresh automatically updates your Factbase Inspector view if there are changes in the factbase. But if facts are created with a build-in Prolog predicate (e.g. “assert”), circumventing JTransformer, the Factbase Inspector will not be updated for these changes. In such cases you should call the predicate “create_derived_facts” so that the Factbase Inspector will be notified about the changes.
    If you check this box, auto-refresh will automatically call “create_derived_facts” ever so often, ensuring consistency of the display. However, this could have some performance issues in larger projects.

Button Overview

  • Black circle: With these arrows you can browse back and forward through the history of the Factbase Inspector. The Factbase Inspector saves all your selections and expansions and allows you the return to old states of the view.
  • Magenta circle: This button is equal to “Show Referenned” from the Context Menu. This button may be disabled if this action is not available for the selected Node.
  • Orange circle: This button is equal to “Show Source Code” from the Context Menu. This button may be disabled if the selected Node has no source code.
  • Yellow circle: This button is equal to “Open Factbase Inspector” from the Context Menu.
  • Blue circle: This button open the Factbase Inspector Options.
  • Red circle: This button open the Factbase Help, which shows a short information of the used node-icons in the Factbase Inspector.
  • Green circle: This button refreshes the Factbase Inspector. Normally this is done automatically if there are changes done to the source code or the factbase. But in some cases its necessary to do this refresh manually to be able to continue working with this Factbase Inspector instance.
1)
Choose show groups in the factbase inspector options if you don't see the folders but only the PEFs.
2)
or brings it to the front if already open
3)
Tooltips are additional information about the node over which you hold the mouse cursor.
research/jtransformer/tutorial_old/factbase_inspector.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019