org.apache.mahout.cf.taste.impl.model.jdbc
Class ReloadFromJDBCDataModel
java.lang.Object
org.apache.mahout.cf.taste.impl.model.jdbc.ReloadFromJDBCDataModel
- All Implemented Interfaces:
- Serializable, Refreshable, DataModel
public final class ReloadFromJDBCDataModel
- extends Object
- implements DataModel
A DataModel
which loads, and can re-load, data from a JDBC-backed JDBCDataModel
into memory, as a
GenericDataModel
or GenericBooleanPrefDataModel
. It is intended to provide the speed
advantage of in-memory representation but be able to update periodically to pull in new data from a database source.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReloadFromJDBCDataModel
public ReloadFromJDBCDataModel(JDBCDataModel delegate)
throws TasteException
- Throws:
TasteException
refresh
public void refresh(Collection<Refreshable> alreadyRefreshed)
- Specified by:
refresh
in interface Refreshable
getDelegate
public JDBCDataModel getDelegate()
getDelegateInMemory
public DataModel getDelegateInMemory()
getUserIDs
public LongPrimitiveIterator getUserIDs()
throws TasteException
- Specified by:
getUserIDs
in interface DataModel
- Throws:
TasteException
getPreferencesFromUser
public PreferenceArray getPreferencesFromUser(long id)
throws TasteException
- Specified by:
getPreferencesFromUser
in interface DataModel
- Throws:
TasteException
getItemIDsFromUser
public FastIDSet getItemIDsFromUser(long id)
throws TasteException
- Specified by:
getItemIDsFromUser
in interface DataModel
- Throws:
TasteException
getPreferenceValue
public Float getPreferenceValue(long userID,
long itemID)
throws TasteException
- Specified by:
getPreferenceValue
in interface DataModel
- Throws:
TasteException
getPreferenceTime
public Long getPreferenceTime(long userID,
long itemID)
throws TasteException
- Specified by:
getPreferenceTime
in interface DataModel
- Throws:
TasteException
getItemIDs
public LongPrimitiveIterator getItemIDs()
throws TasteException
- Specified by:
getItemIDs
in interface DataModel
- Throws:
TasteException
getPreferencesForItem
public PreferenceArray getPreferencesForItem(long itemID)
throws TasteException
- Specified by:
getPreferencesForItem
in interface DataModel
- Throws:
TasteException
getNumItems
public int getNumItems()
throws TasteException
- Specified by:
getNumItems
in interface DataModel
- Throws:
TasteException
getNumUsers
public int getNumUsers()
throws TasteException
- Specified by:
getNumUsers
in interface DataModel
- Throws:
TasteException
getNumUsersWithPreferenceFor
public int getNumUsersWithPreferenceFor(long itemID)
throws TasteException
- Specified by:
getNumUsersWithPreferenceFor
in interface DataModel
- Throws:
TasteException
getNumUsersWithPreferenceFor
public int getNumUsersWithPreferenceFor(long itemID1,
long itemID2)
throws TasteException
- Specified by:
getNumUsersWithPreferenceFor
in interface DataModel
- Throws:
TasteException
setPreference
public void setPreference(long userID,
long itemID,
float value)
throws TasteException
- Specified by:
setPreference
in interface DataModel
- Throws:
TasteException
removePreference
public void removePreference(long userID,
long itemID)
throws TasteException
- Specified by:
removePreference
in interface DataModel
- Throws:
TasteException
hasPreferenceValues
public boolean hasPreferenceValues()
- Specified by:
hasPreferenceValues
in interface DataModel
getMaxPreference
public float getMaxPreference()
- Specified by:
getMaxPreference
in interface DataModel
getMinPreference
public float getMinPreference()
- Specified by:
getMinPreference
in interface DataModel
Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.