@Test public void orConjunctionTest() { QueryHandler query = new QueryHandler("MATCH (a),(b),(c) WHERE a=b AND b=c"); CNF cnf1 = query.getPredicates(); query = new QueryHandler("MATCH (n),(m),(o) WHERE n=m AND m=o"); CNF cnf2 = query.getPredicates(); assertEquals( "((a = b OR n = m) AND (a = b OR m = o) AND (b = c OR n = m) AND (b = c OR m = o))", cnf1.or(cnf2).toString() ); }
public CNF or(CNF other) { ArrayList<CNFElement> newPredicates = new ArrayList<>(); for (CNFElement p : predicates) { for (CNFElement q : other.getPredicates()) { CNFElement newCNFElement = new CNFElement(); newCNFElement.addPredicates(p.getPredicates()); newCNFElement.addPredicates(q.getPredicates()); newPredicates.add(newCNFElement); } } predicates = newPredicates; return this; }
CNF extends PredicateCollection<CNFElement> { public CNF or(CNF other) { ArrayList<CNFElement> newPredicates = new ArrayList<>(); for (CNFElement p : predicates) { for (CNFElement q : other.getPredicates()) { CNFElement newCNFElement = new CNFElement(); newCNFElement.addPredicates(p.getPredicates()); newCNFElement.addPredicates(q.getPredicates()); newPredicates.add(newCNFElement); } } predicates = newPredicates; return this; } }
CNF extends PredicateCollection<CNFElement> { public CNF or(CNF other) { ArrayList<CNFElement> newPredicates = new ArrayList<>(); for (CNFElement p : predicates) { for (CNFElement q : other.getPredicates()) { CNFElement newCNFElement = new CNFElement(); newCNFElement.addPredicates(p.getPredicates()); newCNFElement.addPredicates(q.getPredicates()); newPredicates.add(newCNFElement); } } predicates = newPredicates; return this; } CNF();  CNF(List<CNFElement> predicates);  CNF(CNF copyValue); }
CNF extends PredicateCollection<CNFElement> { public CNF or(CNF other) { ArrayList<CNFElement> newPredicates = new ArrayList<>(); for (CNFElement p : predicates) { for (CNFElement q : other.getPredicates()) { CNFElement newCNFElement = new CNFElement(); newCNFElement.addPredicates(p.getPredicates()); newCNFElement.addPredicates(q.getPredicates()); newPredicates.add(newCNFElement); } } predicates = newPredicates; return this; } CNF();  CNF(List<CNFElement> predicates);  CNF(CNF copyValue); CNF and(CNF other); CNF or(CNF other); @Override boolean evaluate(Embedding embedding, EmbeddingMetaData metaData); @Override boolean evaluate(GraphElement graphElement); @Override String operatorName(); CNF getSubCNF(String variable); CNF getSubCNF(Set<String> variables); CNF removeSubCNF(String variable); CNF removeSubCNF(Set<String> variables); @Override Set<String> getVariables(); @Override Set<String> getPropertyKeys(String variable); }
CNF extends PredicateCollection<CNFElement> { public CNF or(CNF other) { ArrayList<CNFElement> newPredicates = new ArrayList<>(); for (CNFElement p : predicates) { for (CNFElement q : other.getPredicates()) { CNFElement newCNFElement = new CNFElement(); newCNFElement.addPredicates(p.getPredicates()); newCNFElement.addPredicates(q.getPredicates()); newPredicates.add(newCNFElement); } } predicates = newPredicates; return this; } CNF();  CNF(List<CNFElement> predicates);  CNF(CNF copyValue); CNF and(CNF other); CNF or(CNF other); @Override boolean evaluate(Embedding embedding, EmbeddingMetaData metaData); @Override boolean evaluate(GraphElement graphElement); @Override String operatorName(); CNF getSubCNF(String variable); CNF getSubCNF(Set<String> variables); CNF removeSubCNF(String variable); CNF removeSubCNF(Set<String> variables); @Override Set<String> getVariables(); @Override Set<String> getPropertyKeys(String variable);  }