add a test to compute marginal distributions
add public method filterRelationsByAttribute
implement countEntityInRelations