Skip to content

Discovery DCR

Dependency

To use these algorithms in your Java Maven project it is necessary to include, in the pom.xml file, the dependency:

<dependency>
    <groupId>com.github.beamline</groupId>
    <artifactId>discovery-dcr</artifactId>
    <version>beamline-framework-SNAPSHOT</version>
</dependency>
See the introduction page for further instructions.

Usage

To construct a DCR miner it is possible to construct it with the following code:

Reflections reflections = new Reflections("beamline");
DFGBasedMiner miner = new DFGBasedMiner(reflections.getTypesAnnotatedWith(ExposedDcrPattern.class));
In this case we use Reflections to identify and provide all the classes annoted with the @ExposedDcrPattern.

It is possible (though not necessary) to configure the miner with the following parameters:

// configuration of the refresh rate (i.e., how many events between models update)
model.setModelRefreshRate(1);

// configuration of list of patters
miner.setDcrPatternsForMining("Response", "Condition", "Include", "Exclude");

// configuration of the miner type
miner.setStreamMinerType(new UnlimitedStreamMiner());
//miner.setStreamMinerType(new SlidingWindowStreamMiner(15, 500));

// configure which constraints to visualize
miner.setDcrConstraintsForVisualization(RELATION.CONDITION, RELATION.RESPONSE);

// configure the threshold
miner.setRelationsThreshold(0);

// configure the transitive reduction
miner.setTransitiveReductionList(RELATION.CONDITION, RELATION.RESPONSE);

Once the miner is properly configured, it can be used as any other consumer. For example, using the following code:

StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env
    .addSource(new StringTestSource("ABCDF", "ABCEF"))
    .keyBy(BEvent::getProcessName)
    .flatMap(miner)
    .addSink(new SinkFunction<DeclareModelView>(){
        public void invoke(DeclareModelView value, Context context) throws Exception {
            value.generateDot().exportToSvg(new File("output.svg"));
        };
    });
env.execute();

An example of the output produced is:

G e578f0930-aba5-467e-880d-bca6ba0b097a B e67c9c115-c541-48e8-80e5-6901bb8b4734 C e578f0930-aba5-467e-880d-bca6ba0b097a->e67c9c115-c541-48e8-80e5-6901bb8b4734 e578f0930-aba5-467e-880d-bca6ba0b097a->e67c9c115-c541-48e8-80e5-6901bb8b4734 e3677451c-681d-46aa-94c8-b6a991735be3 D e67c9c115-c541-48e8-80e5-6901bb8b4734->e3677451c-681d-46aa-94c8-b6a991735be3 e67c9c115-c541-48e8-80e5-6901bb8b4734->e3677451c-681d-46aa-94c8-b6a991735be3 ec24f6d71-e3be-4240-8cc5-18467c2ba26e K e67c9c115-c541-48e8-80e5-6901bb8b4734->ec24f6d71-e3be-4240-8cc5-18467c2ba26e e67c9c115-c541-48e8-80e5-6901bb8b4734->ec24f6d71-e3be-4240-8cc5-18467c2ba26e eba1a3825-bd6b-4990-bb2a-9995b74ff782 E e3677451c-681d-46aa-94c8-b6a991735be3->eba1a3825-bd6b-4990-bb2a-9995b74ff782 e3677451c-681d-46aa-94c8-b6a991735be3->eba1a3825-bd6b-4990-bb2a-9995b74ff782 e4b48c5a5-016c-458c-b830-243e25a8c96d A e4b48c5a5-016c-458c-b830-243e25a8c96d->e578f0930-aba5-467e-880d-bca6ba0b097a e4b48c5a5-016c-458c-b830-243e25a8c96d->e578f0930-aba5-467e-880d-bca6ba0b097a

Scientific literature

The techniques implemented in this package are described in: