class FunctionalDependency { LinkedList LeftHandSide; LinkedList RightHandSide; ... class Relation { LinkedList FDs; ... public Relation elimRedundantAttributes() { Relation R = new Relation(FDs); for (FunctionalDependency fd: R.getFDs()) { if (fd.getLHS().size() > 1) { for (Iterator AttrList = fd.getLHS().iterator(); AttrList.hasNext(); ) { String A = AttrList.next(); // can we eliminate this attribute from the LHS? FunctionalDependency smallerFD = fd.removeLHS(A); Relation altRel = R.removeFD(fd); altRel = altRel.addFD(smallerFD); if (altRel.closureOfAttributeSet(smallerFD.getLHS()).containsAll(fd.getLHS()) // apparently yes System.out.println(A+" is redundant in "+fd); // remove it from the original LHS somehow... } } } } return R; }