code: @Override
      public int coalesceKamEdges() throws SQLException {
          PreparedStatement eps = getPreparedStatement(SELECTED_ORDERED_EDGES);
          PreparedStatement kesps = getPreparedStatement(UPDATE_KAM_EDGE_STATEMENT);
          ResultSet rset = null;
          int coalesced = 0;
          try {
              rset = eps.executeQuery();
              if (rset.next()) {
                  int xSource = rset.getInt(2);
                  int xRel = rset.getInt(3);
                  int xTarget = rset.getInt(4);
  
                  int xEdgeId = rset.getInt(1);
                  int[] xTriple = new int[] {xSource, xRel, xTarget};
                  while (rset.next()) {
                      int edgeId = rset.getInt(1);
                      int source = rset.getInt(2);
                      int rel = rset.getInt(3);
                      int target = rset.getInt(4);
                      int[] triple = new int[] {source, rel, target};
  
                      if (Arrays.equals(triple, xTriple)) {
                          // duplicate triple, move over statements
                          kesps.setInt(1, xEdgeId);
                          kesps.setInt(2, edgeId);
                          kesps.executeUpdate();
  
                          // remove duplicate
                          removeKamEdges(new int[] {edgeId});
  
                          coalesced++;
                      } else {
                          // move to next unseen triple
                          xTriple = triple;
                          xEdgeId = edgeId;
                      }
                  }
              }
          } finally {
              if (rset != null) {
                  try {
                      rset.close();
                  } catch (Exception e) {
                      // ignored
                  }
              }
          }
          return coalesced;
      }
docs: {@inheritDoc}