/** * Checks consistency of the current node against all other collections in the group. * * @param comparisonNode The node to check consistency against * @param group The group against whcih to check. * @param cache Disjoint query cache * @return True if the node is consistent with all nodes in the group. False otherwise. */ private boolean isConsistent( DAGNode comparisonNode, Collection<DAGNode> group, Map<String, QueryResult> cache) { String compID = comparisonNode.getIdentifier(); for (DAGNode n : group) { if (n.equals(comparisonNode)) continue; // Create cache string to check for existing results. String nID = n.getIdentifier(); String cacheStr = (nID.compareTo(compID) < 0) ? nID + compID : compID + nID; QueryResult result = null; if (!cache.containsKey(cacheStr)) { // Ask the disjoint query QueryObject qo = new QueryObject( false, false, QueryResult.TRUE, CommonConcepts.DISJOINTWITH.getNode(dag_), comparisonNode, n); result = queryModule_.prove(qo); cache.put(cacheStr, result); } else result = cache.get(cacheStr); if (result == QueryResult.TRUE) return false; } return true; }
private boolean isAlreadyDisjointed(Node targetNode, Node child) { return queryModule_.prove(false, CommonConcepts.DISJOINTWITH.getNode(dag_), targetNode, child) == QueryResult.TRUE; }