org.apache.mahout.cf.taste.impl.model.jdbc
Class GenericJDBCDataModel
java.lang.Object
org.apache.mahout.cf.taste.impl.common.jdbc.AbstractJDBCComponent
org.apache.mahout.cf.taste.impl.model.jdbc.AbstractJDBCDataModel
org.apache.mahout.cf.taste.impl.model.jdbc.GenericJDBCDataModel
- All Implemented Interfaces:
- Serializable, Refreshable, DataModel, JDBCDataModel
public final class GenericJDBCDataModel
- extends AbstractJDBCDataModel
A generic DataModel
designed for use with other JDBC data sources;
one just specifies all necessary SQL queries to the constructor here. Optionally, the queries can be
specified from a Properties
object, File
, or InputStream
. This class is most
appropriate when other existing implementations of AbstractJDBCDataModel
are not suitable. If you
are using this class to support a major database, consider contributing a specialized implementation of
AbstractJDBCDataModel
to the project for this database.
- See Also:
- Serialized Form
Methods inherited from class org.apache.mahout.cf.taste.impl.model.jdbc.AbstractJDBCDataModel |
buildPreference, doGetPreferencesForItem, exportWithIDsOnly, exportWithPrefs, getDataSource, getItemIDColumn, getItemIDs, getItemIDsFromUser, getLongColumn, getMaxPreference, getMinPreference, getNumItems, getNumUsers, getNumUsersWithPreferenceFor, getNumUsersWithPreferenceFor, getPreferenceColumn, getPreferencesForItem, getPreferencesFromUser, getPreferenceTable, getPreferenceTime, getPreferenceValue, getUserIDColumn, getUserIDs, hasPreferenceValues, refresh, removePreference, setLongParameter, setPreference |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DATA_SOURCE_KEY
public static final String DATA_SOURCE_KEY
- See Also:
- Constant Field Values
GET_PREFERENCE_SQL_KEY
public static final String GET_PREFERENCE_SQL_KEY
- See Also:
- Constant Field Values
GET_PREFERENCE_TIME_SQL_KEY
public static final String GET_PREFERENCE_TIME_SQL_KEY
- See Also:
- Constant Field Values
GET_USER_SQL_KEY
public static final String GET_USER_SQL_KEY
- See Also:
- Constant Field Values
GET_ALL_USERS_SQL_KEY
public static final String GET_ALL_USERS_SQL_KEY
- See Also:
- Constant Field Values
GET_NUM_USERS_SQL_KEY
public static final String GET_NUM_USERS_SQL_KEY
- See Also:
- Constant Field Values
GET_NUM_ITEMS_SQL_KEY
public static final String GET_NUM_ITEMS_SQL_KEY
- See Also:
- Constant Field Values
SET_PREFERENCE_SQL_KEY
public static final String SET_PREFERENCE_SQL_KEY
- See Also:
- Constant Field Values
REMOVE_PREFERENCE_SQL_KEY
public static final String REMOVE_PREFERENCE_SQL_KEY
- See Also:
- Constant Field Values
GET_USERS_SQL_KEY
public static final String GET_USERS_SQL_KEY
- See Also:
- Constant Field Values
GET_ITEMS_SQL_KEY
public static final String GET_ITEMS_SQL_KEY
- See Also:
- Constant Field Values
GET_PREFS_FOR_ITEM_SQL_KEY
public static final String GET_PREFS_FOR_ITEM_SQL_KEY
- See Also:
- Constant Field Values
GET_NUM_PREFERENCE_FOR_ITEM_KEY
public static final String GET_NUM_PREFERENCE_FOR_ITEM_KEY
- See Also:
- Constant Field Values
GET_NUM_PREFERENCE_FOR_ITEMS_KEY
public static final String GET_NUM_PREFERENCE_FOR_ITEMS_KEY
- See Also:
- Constant Field Values
GET_MAX_PREFERENCE_KEY
public static final String GET_MAX_PREFERENCE_KEY
- See Also:
- Constant Field Values
GET_MIN_PREFERENCE_KEY
public static final String GET_MIN_PREFERENCE_KEY
- See Also:
- Constant Field Values
GenericJDBCDataModel
public GenericJDBCDataModel(Properties props)
throws TasteException
Specifies all SQL queries in a Properties
object. See the *_KEY
constants in this
class (e.g. GET_USER_SQL_KEY
) for a list of all keys which must map to a value in this object.
- Parameters:
props
- Properties
object containing values
- Throws:
TasteException
- if anything goes wrong during initialization
GenericJDBCDataModel
public GenericJDBCDataModel(File propertiesFile)
throws TasteException
See GenericJDBCDataModel(Properties)
. This constructor reads values from a file
instead, as if with Properties.load(InputStream)
. So, the file should be in standard Java
properties file format -- containing key=value
pairs, one per line.
- Parameters:
propertiesFile
- properties file
- Throws:
TasteException
- if anything goes wrong during initialization
GenericJDBCDataModel
public GenericJDBCDataModel(String resourcePath)
throws TasteException
See GenericJDBCDataModel(Properties)
. This constructor reads values from a resource available in
the classpath, as if with Class.getResourceAsStream(String)
and
Properties.load(InputStream)
. This is useful if your configuration file is, for example, packaged
in a JAR file that is in the classpath.
- Parameters:
resourcePath
- path to resource in classpath (e.g. "/com/foo/TasteSQLQueries.properties")
- Throws:
TasteException
- if anything goes wrong during initialization
Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.