public class MySQLJDBCItemSimilarity extends SQL92JDBCItemSimilarity
An ItemSimilarity backed by a MySQL database
and accessed via JDBC. It may work with other JDBC
databases. By default, this class assumes that there is a DataSource available under the JNDI name
"jdbc/taste", which gives access to a database with a "taste_item_similarity" table with the following
schema:
| item_id_a | item_id_b | similarity |
|---|---|---|
| ABC | DEF | 0.9 |
| DEF | EFG | 0.1 |
For example, the following command sets up a suitable table in MySQL, complete with primary key and indexes:
CREATE TABLE taste_item_similarity ( item_id_a BIGINT NOT NULL, item_id_b BIGINT NOT NULL, similarity FLOAT NOT NULL, PRIMARY KEY (item_id_a, item_id_b), )
Note that for each row, item_id_a should be less than item_id_b. It is redundant to store it both ways, so the pair is always stored as a pair with the lesser one first.
MySQLJDBCDiffStorage,
MySQLJDBCDataModelDEFAULT_DATASOURCE_NAME| Constructor and Description |
|---|
MySQLJDBCItemSimilarity() |
MySQLJDBCItemSimilarity(DataSource dataSource) |
MySQLJDBCItemSimilarity(DataSource dataSource,
String similarityTable,
String itemAIDColumn,
String itemBIDColumn,
String similarityColumn) |
MySQLJDBCItemSimilarity(String dataSourceName) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
getFetchSize() |
allSimilarItemIDs, getItemAIDColumn, getItemBIDColumn, getSimilarityColumn, getSimilarityTable, itemSimilarities, itemSimilarity, refreshcheckNotNullAndLog, checkNotNullAndLog, lookupDataSourcepublic MySQLJDBCItemSimilarity()
throws TasteException
TasteExceptionpublic MySQLJDBCItemSimilarity(String dataSourceName) throws TasteException
TasteExceptionpublic MySQLJDBCItemSimilarity(DataSource dataSource)
public MySQLJDBCItemSimilarity(DataSource dataSource, String similarityTable, String itemAIDColumn, String itemBIDColumn, String similarityColumn)
protected int getFetchSize()
getFetchSize in class AbstractJDBCComponentCopyright © 2008–2013 The Apache Software Foundation. All rights reserved.