simplify_query function

Simplify output query to a Bayesian network