private static ReasonerQuery combinedRuleQuery(TransactionOLTP graph, Rule rule) {
        ReasonerQuery bodyQuery = ReasonerQueries.create(Graql.and(rule.when().getDisjunctiveNormalForm().getPatterns().stream().flatMap(conj -> conj.getPatterns().stream()).collect(Collectors.toSet())), graph);
        ReasonerQuery headQuery = ReasonerQueries.create(Graql.and(rule.then().getDisjunctiveNormalForm().getPatterns().stream().flatMap(conj -> conj.getPatterns().stream()).collect(Collectors.toSet())), graph);
        return headQuery.conjunction(bodyQuery);
    }
private static ReasonerQuery combinedRuleQuery ( TransactionOLTP graph , Rule rule ) { ReasonerQuery bodyQuery = ReasonerQueries . create ( Graql . and ( rule . when ( ) . getDisjunctiveNormalForm ( ) . getPatterns ( ) . stream ( ) . flatMap ( conj -> conj . getPatterns ( ) . stream ( ) ) . collect ( Collectors . toSet ( ) ) ) , graph ) ; ReasonerQuery headQuery = ReasonerQueries . create ( Graql . and ( rule . then ( ) . getDisjunctiveNormalForm ( ) . getPatterns ( ) . stream ( ) . flatMap ( conj -> conj . getPatterns ( ) . stream ( ) ) . collect ( Collectors . toSet ( ) ) ) , graph ) ; return headQuery . conjunction ( bodyQuery ) ; }
@param graph graph (tx) of interest
@param rule  the rule to be cast into a combined conjunction query
@return a combined conjunction created from statements from both the body and the head of the rule