Computing marginals in graphical log-linear models