Skip to content

Behavioural Patterns

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>conformance-behavioural-patterns</artifactId>
    <version>master-SNAPSHOT</version>
</dependency>
See the introduction page for further instructions.

Usage

To use the technique you need to create the conformance checker object using:

Petrinet net = ...;
Marking marking = ...;
int maxCasesToStore = 1000; // max expected number of parallel process instances

BehavioralConformance conformance = new BehavioralConformance(net, marking, maxCasesToStore);
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env
    .addSource(source)
    .keyBy(BEvent::getTraceName)
    .flatMap(conformance)
    .addSink(new SinkFunction<OnlineConformanceScore>(){
        public void invoke(OnlineConformanceScore value) throws Exception {
            System.out.println(
                value.getConformance() + " - " +
                value.getCompleteness() + " - " +
                value.getConfidence());
        };
    });
env.execute();

It is worth highlighting that since each trace can be processed independently from the others, it is possible to increase the parallelism by keying the stream based on the case identifier (BEvent::getTraceName, line 9).

In the current version, the reference model must be provided as a Petri Net.

Importing a Petri net

To import a Petri net it is possible to use the simple-pnml library:

1
2
3
Object[] i = PnmlImportNet.importFromStream(new FileInputStream(new File("petri-net-model.pnml")));
Petrinet net = (Petrinet) i[0];
Marking marking = (Marking) i[1];

Scientific literature

The techniques implemented in this package are described in: