ParseProbability parse = new ParseProbability(this);
ParsedProbability parsedProbability = parse.parse(line);
// create a temp query
BayesianQuery q = this.query.clone();
// first, mark all events as hidden
q.reset();
// deal with evidence (input)
for( ParsedEvent parsedEvent : parsedProbability.getGivenEvents() ) {
BayesianEvent event = this.requireEvent(parsedEvent.getLabel());
q.defineEventType(event, EventType.Evidence);
q.setEventValue(event, parsedEvent.resolveValue(event));
}
// deal with outcome (output)
for( ParsedEvent parsedEvent : parsedProbability.getBaseEvents() ) {
BayesianEvent event = requireEvent(parsedEvent.getLabel());
q.defineEventType(event, EventType.Outcome);
q.setEventValue(event, parsedEvent.resolveValue(event));
}
q.locateEventTypes();
q.execute();
return q.getProbability();
}