## org.apache.mahout.cf.taste.impl.similarity.jdbc
Class AbstractJDBCItemSimilarity

    java.lang.Object
      org.apache.mahout.cf.taste.impl.common.jdbc.AbstractJDBCComponent
          org.apache.mahout.cf.taste.impl.similarity.jdbc.AbstractJDBCItemSimilarity

All Implemented Interfaces:
  Refreshable, ItemSimilarity

Direct Known Subclasses:
  SQL92JDBCItemSimilarity

    public abstract class AbstractJDBCItemSimilarity

extends AbstractJDBCComponent
implements ItemSimilarity

An `ItemSimilarity` which draws pre-computed item-item similarities from a database table via JDBC.

Field Summary

Fields inherited from class org.apache.mahout.cf.taste.impl.common.jdbc.AbstractJDBCComponent
`DEFAULT_DATASOURCE_NAME`

Constructor Summary
`protected` `AbstractJDBCItemSimilarity(DataSource dataSource, String getItemItemSimilaritySQL, String getAllSimilarItemIDsSQL)`
`protected` `AbstractJDBCItemSimilarity(DataSource dataSource, String similarityTable, String itemAIDColumn, String itemBIDColumn, String similarityColumn, String getItemItemSimilaritySQL, String getAllSimilarItemIDsSQL)`

Method Summary
`long[]` `allSimilarItemIDs(long itemID)`
`protected String` `getItemAIDColumn()`
`protected String` `getItemBIDColumn()`
`protected String` `getSimilarityColumn()`
`protected String` `getSimilarityTable()`
`double[]` `itemSimilarities(long itemID1, long[] itemID2s)`
`double` `itemSimilarity(long itemID1, long itemID2)`
`void` `refresh(Collection<Refreshable> alreadyRefreshed)`

Methods inherited from class org.apache.mahout.cf.taste.impl.common.jdbc.AbstractJDBCComponent
`checkNotNullAndLog, checkNotNullAndLog, getFetchSize, lookupDataSource`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractJDBCItemSimilarity

    protected AbstractJDBCItemSimilarity(DataSource dataSource,
                                         String getItemItemSimilaritySQL,
                                         String getAllSimilarItemIDsSQL)

### AbstractJDBCItemSimilarity

    protected AbstractJDBCItemSimilarity(DataSource dataSource,
                                         String similarityTable,
                                         String itemAIDColumn,
                                         String itemBIDColumn,
                                         String similarityColumn,
                                         String getItemItemSimilaritySQL,
                                         String getAllSimilarItemIDsSQL)

Method Detail

### getSimilarityTable

    protected String getSimilarityTable()

### getItemAIDColumn

    protected String getItemAIDColumn()

### getItemBIDColumn

    protected String getItemBIDColumn()

### getSimilarityColumn

    protected String getSimilarityColumn()

### itemSimilarity

    public double itemSimilarity(long itemID1,
                                 long itemID2)
                          throws TasteException

  Specified by:
    `itemSimilarity` in interface `ItemSimilarity`
  Throws:
    `TasteException`

### itemSimilarities

    public double[] itemSimilarities(long itemID1,
                                     long[] itemID2s)
                              throws TasteException

  Specified by:
    `itemSimilarities` in interface `ItemSimilarity`
  Throws:
    `TasteException`

### allSimilarItemIDs

    public long[] allSimilarItemIDs(long itemID)
                             throws TasteException

  Specified by:
    `allSimilarItemIDs` in interface `ItemSimilarity`
  Throws:
    `TasteException`

### refresh

    public void refresh(Collection<Refreshable> alreadyRefreshed)

  Specified by:
    `refresh` in interface `Refreshable`

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.