Configuring Sphere Composition

Ferret supports integrating many different sources of information about a program in order to provide better answers to conceptual queries. This is accomplished by composing these sources, or spheres, in a principled manner. The composition is specified through the Ferret Sphere Configuration Wizard. This wizard is automatically invoked when Ferret is first used, and can be explicitly summoned through Ferret view menu (). Each instance of Ferret (such as occurs when using multiple windows) is configured separately.

There are five different ways to compose spheres. But to appreciate this requires a small digression into the meaning of a sphere.

Spheres

A sphere is a simple formalism based on the relational algebra to provide a unified view of any source providing information about a software system. A sphere has a set of elements that it knows about, and describes a set of relations between those elements.

The following are examples of spheres:

Static Java sphere:
Elements: classes, interfaces, fields, methods.
Relations extends, implements, calls, accesses, overrides.
Dynamic Java runtime sphere:
Elements: classes, methods.
Relations: calls, instantiates.
Plug-in Development:
Elements: plug-ins, extension points, extensions.
Relations: specifies, extends.

The sphere describes the structure of the source of information, listing the types of information elements available, and the types of relations that may exist between these elements. Each sphere is reified in one or more fact bases. Spheres can be thought of like a database schema, and the fact bases are like individual databases structured according to that schema.

Some spheres may only have a single factbase, such as the static Java sphere, which corresponds to the version of the source code being editted. Other spheres may have multiple fact bases, such as the dynamic Java sphere which creates a separate fact base for each trace.

Composing Spheres

Given that spheres may have some relations in common, we need some way to identify which sphere's relations should have precendence. This is specified using composition functions to compose the spheres. We have identified five different functions for composing spheres:

replacement:
The composed spheres are tried in order until the first matching relation is found.
union:
returns the results of the relation on each of the composed sphere.
intersection:
returns the result of intersecting the results from relation on each of the composed spheres.
disjuction (symmetric difference):
returns the results that are not in common between the relation on each of the composed spheres.
difference:
returns the results from the first sphere that are not returned by any of the other subsequent spheres.

A typical composition is using replacement on spheres of different types, such as:

  {replacement}
  |
  +--> PDE
  |
  +--> {union}
  |      |
  |      +--> Dynamic JDT from trace-1
  |      |
  |      +--> Dynamic JDT from trace-2
  |
  +--> Static JDT

In this example, each sphere is tried in order until a sphere is found providing the desired relation.