String shipName;
String ship2Name;
String personName;
String organizationName;
EvidenceInfo evidence;
ArgumentInfo argument;
// TODO - Make sure to use a unique id later on
shipName = "ship" + db.getShips().indexOf(ship);
// Ship characteristics
if (ship.getShipType() != null) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasTypeOfShip");
argument = new ArgumentInfo();
argument.setType("Ship");
argument.setName(shipName);
evidence.getArguments().add(argument);
if (ship.getShipType() == ShipType.FISHING) {
evidence.setState("Fishing");
} else {
evidence.setState("Merchant");
}
evidenceList.add(evidence);
}
// Evidence that support the hypothesis hasEvasiveBehavior(ship)
if (!ship.hasResponsiveAIS()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasResponsiveAIS");
argument = new ArgumentInfo();
argument.setType("Ship");
argument.setName(shipName);
evidence.getArguments().add(argument);
evidence.setState("false");
evidenceList.add(evidence);
}
if (!ship.hasResponsiveRadio()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasResponsiveRadio");
argument = new ArgumentInfo();
argument.setType("Ship");
argument.setName(shipName);
evidence.getArguments().add(argument);
evidence.setState("false");
evidenceList.add(evidence);
}
// Evidence (report) that supports the hypothesis hasUnusualRoute(ship)
if (ship.isOnUnusualRoute()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasUnusualRouteReport");
argument = new ArgumentInfo();
argument.setType("Ship");
argument.setName(shipName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
}
// Load all ships that possibly met
// Also evidence (report) that supports the hypothesis hasUnusualRoute(ship)
if (ship.getPossibleMeeting().size() > 0) {
for (ShipEntity shipMeeting : ship.getPossibleMeeting()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("areMeetingReport");
ship2Name = "ship" + db.getShips().indexOf(shipMeeting);
argument = new ArgumentInfo();
argument.setType("Ship");
argument.setName(shipName);
evidence.getArguments().add(argument);
argument = new ArgumentInfo();
argument.setType("Ship");
argument.setName(ship2Name);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
}
}
// Evidence that support the hypothesis hasErraticBehavior(ship)
if (ship.isCrewVisible()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("isCrewVisible");
argument = new ArgumentInfo();
argument.setType("Ship");
argument.setName(shipName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
}
// Evidence that support the hypothesis hasAggressiveBehavior(ship)
if (ship.hasWeaponVisible()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasWeaponVisible");
argument = new ArgumentInfo();
argument.setType("Ship");
argument.setName(shipName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
}
if (ship.isJettisoningCargo()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("isJettisoningCargo");
argument = new ArgumentInfo();
argument.setType("Ship");
argument.setName(shipName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
}
// Load all crew members
for (PersonEntity person : ship.getCrew()) {
// TODO - Make sure to use a unique id later on
personName = "person" + db.getPeople().indexOf(person);
// Adding finding stating that this person is a crew member of this ship
evidence = new EvidenceInfo();
evidence.setResidentNode("hasCrewMember");
argument = new ArgumentInfo();
argument.setType("Ship");
argument.setName(shipName);
evidence.getArguments().add(argument);
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
// Add information about the terrorist organizations associated to this crew member
if (person.isPartOfTerroristOrganisation()) {
for (OrganizationEntity organization : person
.getRelatedOrganizations()) {
if (organization.isTerroristOrganisation()) {
// TODO - Make sure to use a unique id later on
organizationName = "organization"
+ db.getOrganizations().indexOf(organization);
// Add this crew member as member of this organization
evidence = new EvidenceInfo();
evidence.setResidentNode("isMemberOfOrganization");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
argument = new ArgumentInfo();
argument.setType("Organization");
argument.setName(organizationName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
// Add the information that this is a terrorist organization
evidence = new EvidenceInfo();
evidence.setResidentNode("isTerroristOrganization");
argument = new ArgumentInfo();
argument.setType("Organization");
argument.setName(organizationName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
}
}
}
// Evidence that support the hypothesis communicatesWithTerrorist(person)
if (person.isUsesCellular()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("usesCellular");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
}
if (person.isUsesEmail()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("usesEmail");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
}
if (person.isUsesWeblog()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("usesWeblog");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
}
if (person.isUsesChatroom()) {
evidence = new EvidenceInfo();
evidence.setResidentNode("usesChatroom");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
evidence.setState("true");
evidenceList.add(evidence);
}
// Evidence that support the hypothesis hasInfluencePartition(person)
if (person.getKnowsPersonImprisionedInOIForOEF() != null) {
evidence = new EvidenceInfo();
evidence.setResidentNode("knowsPersonImprisionedInOIForOEF");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
Quantity quantity = person.getKnowsPersonImprisionedInOIForOEF();
evidence.setState(quantity.toString());
evidenceList.add(evidence);
}
if (person.getKnowsPersonKilledinOIForOEF() != null) {
evidence = new EvidenceInfo();
evidence.setResidentNode("knowsPersonKilledInOIForOEF");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
Quantity quantity = person.getKnowsPersonKilledinOIForOEF();
evidence.setState(quantity.toString());
evidenceList.add(evidence);
}
if (person.getHasFamilyStatus() != null) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasFamilyStatus");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
FamilyStatus status = person.getHasFamilyStatus();
evidence.setState(status.toString());
evidenceList.add(evidence);
}
// Evidence that support the hypothesis hasTerroristBeliefs(person)
if (person.getHasFriendshipWithTerrorist() != null) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasFriendshipWithTerrorist");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
Quantity quantity = person.getHasFriendshipWithTerrorist();
evidence.setState(quantity.toString());
evidenceList.add(evidence);
}
if (person.getHasKinshipToTerrorist() != null) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasKinshipToTerrorist");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
Quantity quantity = person.getHasKinshipToTerrorist();
evidence.setState(quantity.toString());
evidenceList.add(evidence);
}
// Evidence that support the hypothesis hasClusterPartition(person)
if (person.getHasNationality() != null) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasNationality");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
Nationality stateValue = person.getHasNationality();
evidence.setState(stateValue.toString());
evidenceList.add(evidence);
}
if (person.getHasEconomicStanding() != null) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasEconomicStanding");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
EconomicStanding stateValue = person.getHasEconomicStanding();
evidence.setState(stateValue.toString());
evidenceList.add(evidence);
}
if (person.getHasEducationLevel() != null) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasEducationLevel");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
EducationLevel stateValue = person.getHasEducationLevel();
evidence.setState(stateValue.toString());
evidenceList.add(evidence);
}
if (person.getHasOccupation() != null) {
evidence = new EvidenceInfo();
evidence.setResidentNode("hasOccupation");
argument = new ArgumentInfo();
argument.setType("Person");
argument.setName(personName);
evidence.getArguments().add(argument);
Occupation stateValue = person.getHasOccupation();
evidence.setState(stateValue.toString());
evidenceList.add(evidence);
}
}
}