Package org.apache.mahout.cf.taste.common

Examples of org.apache.mahout.cf.taste.common.TasteException


      } else {
        return null;
      }
    } catch (SQLException sqle) {
      log.warn("Exception while retrieving diff", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }
  }
View Full Code Here


        result[i] = new FixedRunningAverageAndStdDev(rs.getDouble(2), rs.getDouble(3), rs.getInt(1));
        i++;
      }
    } catch (SQLException sqle) {
      log.warn("Exception while retrieving diff", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }
    return result;
  }
View Full Code Here

        }
      }
      return null;
    } catch (SQLException sqle) {
      log.warn("Exception while retrieving average item pref", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }
  }
View Full Code Here

        unupdatedItemIDs.remove(otherItemID);
      }

    } catch (SQLException sqle) {
      log.warn("Exception while adding item diff", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }

    // Catch antyhing that wasn't already covered in the diff table
    try {
      conn = dataSource.getConnection();
      stmt = conn.prepareStatement(addDiffSQL);
      for (long unupdatedItemID : unupdatedItemIDs) {
        if (unupdatedItemID < itemID) {
          stmt.setLong(1, unupdatedItemID);
          stmt.setLong(2, itemID);
          stmt.setFloat(3, prefValue);
        } else {
          stmt.setLong(1, itemID);
          stmt.setLong(2, unupdatedItemID);
          stmt.setFloat(3, -prefValue);
        }
        log.debug("Executing SQL query: {}", getDiffsAffectedByUserSQL);
        stmt.executeUpdate();
      }
    } catch (SQLException sqle) {
      log.warn("Exception while adding item diff", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(null, stmt, conn);
    }
  }
View Full Code Here

      conn = dataSource.getConnection();
      doPartialUpdate(updateDiffSQLs[0], itemID, prefDelta, conn);
      doPartialUpdate(updateDiffSQLs[1], itemID, prefDelta, conn);
    } catch (SQLException sqle) {
      log.warn("Exception while updating item diff", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(conn);
    }
  }
View Full Code Here

          updateOneDiff(conn, count - 1, newAverage, itemIDA, itemIDB);
        }
      }
    } catch (SQLException sqle) {
      log.warn("Exception while removing item diff", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }
  }
View Full Code Here

        itemIDs.add(rs.getLong(1));
      }
      return itemIDs;
    } catch (SQLException sqle) {
      log.warn("Exception while retrieving recommendable items", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }
  }
View Full Code Here

      } finally {
        IOUtils.quietClose(stmt);
      }
    } catch (SQLException sqle) {
      log.warn("Exception while updating/deleting diffs", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(conn);
    }
  }
View Full Code Here

      rs = stmt.executeQuery(diffsExistSQL);
      rs.next();
      return rs.getInt(1) > 0;
    } catch (SQLException sqle) {
      log.warn("Exception while deleting diffs", sqle);
      throw new TasteException(sqle);
    } finally {
      IOUtils.quietClose(rs, stmt, conn);
    }
  }
View Full Code Here

  public LongPrimitiveIterator getUserIDs() throws TasteException {
    log.debug("Retrieving all users...");
    try {
      return new ResultSetIDIterator(getUsersSQL);
    } catch (SQLException sqle) {
      throw new TasteException(sqle);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.common.TasteException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.