// load ubf/owl
File mebnFile = new File("resources/mebn/prognos.ubf");
UbfIO ubf = UbfIO.getInstance();
MultiEntityBayesianNetwork mebn = ubf.loadMebn(mebnFile);
// initialize kb
KnowledgeBase knowledgeBase = PowerLoomKB.getNewInstanceKB();
knowledgeBase = textModeRunner.createKnowledgeBase(knowledgeBase, mebn);
// load kb
// File kbFile = new File(getClass().getResource("/mebn/prognos.plm").getFile());
// knowledgeBase.loadModule(kbFile, true);
MebnUtil mebnUtil = new MebnUtil(mebn);
mebnUtil.removeAllEntityInstances();
ObjectEntity entity = mebn.getObjectEntityContainer().getObjectEntityByName("Ship");
mebnUtil.createEntityIntance(entity, "ship1");
mebnUtil.createEntityIntance(entity, "ship2");
mebnUtil.createEntityIntance(entity, "ship3");
entity = mebn.getObjectEntityContainer().getObjectEntityByName("Person");
mebnUtil.createEntityIntance(entity, "person1");
entity = mebn.getObjectEntityContainer().getObjectEntityByName("Organization");
mebnUtil.createEntityIntance(entity, "org1");
ResidentNode residentNode = mebn.getDomainResidentNode("IsWithinRadarRange");
ObjectEntityInstance[] arguments = new ObjectEntityInstance[2];
arguments[0] = mebn.getObjectEntityContainer().getEntityInstanceByName("ship1");
arguments[1] = mebn.getObjectEntityContainer().getEntityInstanceByName("ship2");
Entity state = mebn.getBooleanStatesEntityContainer().getTrueStateEntity();
mebnUtil.createRandomVariableFinding(residentNode, arguments, state);
residentNode = mebn.getDomainResidentNode("UnusualRoute");
arguments = new ObjectEntityInstance[1];
arguments[0] = mebn.getObjectEntityContainer().getEntityInstanceByName("ship1");
state = mebn.getBooleanStatesEntityContainer().getTrueStateEntity();
mebnUtil.createRandomVariableFinding(residentNode, arguments, state);
residentNode = mebn.getDomainResidentNode("AreMeeting");
arguments = new ObjectEntityInstance[2];
arguments[0] = mebn.getObjectEntityContainer().getEntityInstanceByName("ship1");
arguments[1] = mebn.getObjectEntityContainer().getEntityInstanceByName("ship3");
state = mebn.getBooleanStatesEntityContainer().getTrueStateEntity();
mebnUtil.createRandomVariableFinding(residentNode, arguments, state);
residentNode = mebn.getDomainResidentNode("IsMemberOfOrganization");
arguments = new ObjectEntityInstance[2];
arguments[0] = mebn.getObjectEntityContainer().getEntityInstanceByName("person1");
arguments[1] = mebn.getObjectEntityContainer().getEntityInstanceByName("org1");
state = mebn.getBooleanStatesEntityContainer().getTrueStateEntity();
mebnUtil.createRandomVariableFinding(residentNode, arguments, state);
residentNode = mebn.getDomainResidentNode("IsTerroristOrganization");
arguments = new ObjectEntityInstance[1];
arguments[0] = mebn.getObjectEntityContainer().getEntityInstanceByName("org1");
state = mebn.getBooleanStatesEntityContainer().getTrueStateEntity();
mebnUtil.createRandomVariableFinding(residentNode, arguments, state);
residentNode = mebn.getDomainResidentNode("ResponsiveAIS");
arguments = new ObjectEntityInstance[1];
arguments[0] = mebn.getObjectEntityContainer().getEntityInstanceByName("ship1");
state = mebn.getBooleanStatesEntityContainer().getFalseStateEntity();
mebnUtil.createRandomVariableFinding(residentNode, arguments, state);
residentNode = mebn.getDomainResidentNode("ResponsiveRadar");
arguments = new ObjectEntityInstance[1];
arguments[0] = mebn.getObjectEntityContainer().getEntityInstanceByName("ship1");
state = mebn.getBooleanStatesEntityContainer().getFalseStateEntity();
mebnUtil.createRandomVariableFinding(residentNode, arguments, state);
residentNode = mebn.getDomainResidentNode("IsCrewMember");
arguments = new ObjectEntityInstance[2];
arguments[0] = mebn.getObjectEntityContainer().getEntityInstanceByName("person1");
arguments[1] = mebn.getObjectEntityContainer().getEntityInstanceByName("ship1");
state = mebn.getBooleanStatesEntityContainer().getTrueStateEntity();
mebnUtil.createRandomVariableFinding(residentNode, arguments, state);
residentNode = mebn.getDomainResidentNode("DetectedECM");
arguments = new ObjectEntityInstance[1];
arguments[0] = mebn.getObjectEntityContainer().getEntityInstanceByName("ship2");
state = mebn.getBooleanStatesEntityContainer().getFalseStateEntity();
mebnUtil.createRandomVariableFinding(residentNode, arguments, state);
knowledgeBase = textModeRunner.fillFindings(mebn,knowledgeBase);
new PrognosFrame("PROGNOS", mebn);