use of org.iobserve.service.behavior.analysis.model.BehaviorModelGED in project iobserve-analysis by research-iobserve.
the class TestHelper method createBehaviorModelA.
public static BehaviorModelGED createBehaviorModelA() {
final BehaviorModelGED model = new BehaviorModelGED();
TestHelper.addNode(model, "Init");
TestHelper.addNode(model, "A");
TestHelper.addNode(model, "B");
TestHelper.addNode(model, "C");
final String[] parameters = {};
final String[] values = {};
final BehaviorModelEdge edge1 = TestHelper.addEdge(model, "Init", "A");
edge1.addEvent(TestHelper.createEvent(0, "A", parameters, values));
final BehaviorModelEdge edge2 = TestHelper.addEdge(model, "A", "B");
edge2.addEvent(TestHelper.createEvent(1, "A", parameters, values));
final BehaviorModelEdge edge3 = TestHelper.addEdge(model, "B", "C");
edge3.addEvent(TestHelper.createEvent(2, "C", parameters, values));
return model;
}
use of org.iobserve.service.behavior.analysis.model.BehaviorModelGED in project iobserve-analysis by research-iobserve.
the class TestHelper method createBehaviorModelB.
// only difference to A: different values
public static BehaviorModelGED createBehaviorModelB() {
final BehaviorModelGED model = new BehaviorModelGED();
TestHelper.addNode(model, "Init");
TestHelper.addNode(model, "A");
TestHelper.addNode(model, "B");
TestHelper.addNode(model, "C");
final String[] parameters = {};
final String[] values = { "different value" };
final BehaviorModelEdge edge1 = TestHelper.addEdge(model, "Init", "A");
edge1.addEvent(TestHelper.createEvent(0, "A", parameters, values));
final BehaviorModelEdge edge2 = TestHelper.addEdge(model, "A", "B");
edge2.addEvent(TestHelper.createEvent(1, "A", parameters, values));
final BehaviorModelEdge edge3 = TestHelper.addEdge(model, "B", "C");
edge3.addEvent(TestHelper.createEvent(2, "C", parameters, values));
return model;
}
use of org.iobserve.service.behavior.analysis.model.BehaviorModelGED in project iobserve-analysis by research-iobserve.
the class OpticsStageTest method setup.
@Before
public void setup() {
final List<BehaviorModelGED> behaviorModels = new ArrayList<>();
behaviorModels.add(TestHelper.createBehaviorModelA());
behaviorModels.add(TestHelper.createBehaviorModelA());
behaviorModels.add(TestHelper.createBehaviorModelA());
behaviorModels.add(TestHelper.createBehaviorModelA());
behaviorModels.add(TestHelper.createBehaviorModelA());
behaviorModels.add(TestHelper.createBehaviorModelB());
behaviorModels.add(TestHelper.createBehaviorModelB());
behaviorModels.add(TestHelper.createBehaviorModelB());
behaviorModels.add(TestHelper.createBehaviorModelB());
behaviorModels.add(TestHelper.createBehaviorModelB());
behaviorModels.add(TestHelper.createBehaviorModelC());
behaviorModels.add(TestHelper.createBehaviorModelC());
behaviorModels.add(TestHelper.createBehaviorModelC());
behaviorModels.add(TestHelper.createBehaviorModelC());
behaviorModels.add(TestHelper.createBehaviorModelC());
behaviorModels.add(TestHelper.createBehaviorModelD());
behaviorModels.add(TestHelper.createBehaviorModelD());
behaviorModels.add(TestHelper.createBehaviorModelD());
behaviorModels.add(TestHelper.createBehaviorModelD());
behaviorModels.add(TestHelper.createBehaviorModelD());
// noise
behaviorModels.add(TestHelper.createBehaviorModelE());
behaviorModels.add(TestHelper.createBehaviorModelE());
this.models = new ArrayList<>();
for (final BehaviorModelGED model : behaviorModels) {
this.models.add(new OpticsData(model));
}
this.mTree = TestHelper.generateMTree(this.models);
}
use of org.iobserve.service.behavior.analysis.model.BehaviorModelGED in project iobserve-analysis by research-iobserve.
the class UserSessionToModelConverter method eventsToModel.
/**
* Converts a list of events into a behavior model
*
* @param events
* The list of events
* @return The behavior model
*/
public static BehaviorModelGED eventsToModel(final List<EntryCallEvent> events) {
final BehaviorModelGED model = new BehaviorModelGED();
final Iterator<EntryCallEvent> iterator = events.iterator();
// start with the node "init"
BehaviorModelNode currentNode = new BehaviorModelNode("Init");
model.getNodes().put("Init", currentNode);
BehaviorModelNode lastNode = currentNode;
// for all events
while (iterator.hasNext()) {
final PayloadAwareEntryCallEvent event = (PayloadAwareEntryCallEvent) iterator.next();
// current node is an existing node with the same name or if non-existing a new node
currentNode = model.getNodes().get(event.getOperationSignature());
if (currentNode == null) {
currentNode = new BehaviorModelNode(event.getOperationSignature());
}
// add node to model
model.getNodes().put(event.getOperationSignature(), currentNode);
// add edge to model
UserSessionToModelConverter.addEdge(event, model, lastNode, currentNode);
lastNode = currentNode;
}
return model;
}
use of org.iobserve.service.behavior.analysis.model.BehaviorModelGED in project iobserve-analysis by research-iobserve.
the class GraphEditDistanceTest method edgeRelevantTest.
@Test
public void edgeRelevantTest() {
final BehaviorModelGED model1 = TestHelper.createBehaviorModelA();
final BehaviorModelGED model2 = TestHelper.createBehaviorModelD();
Assert.assertTrue(this.ged.calculate(model1, model2) > 0);
}
Aggregations