Class AbstractIndividualContentIndex<C,U>
java.lang.Object
es.uam.eps.ir.relison.content.index.AbstractIndex<C>
es.uam.eps.ir.relison.content.index.individual.AbstractIndividualContentIndex<C,U>
- Type Parameters:
C- type of the contents.U- type of the users.
- All Implemented Interfaces:
DocumentMap<C>,Index<C>,IndividualContentIndex<C,U>
- Direct Known Subclasses:
WrapperIndividualContentIndex,WrapperIndividualForwardContentIndex
public abstract class AbstractIndividualContentIndex<C,U> extends AbstractIndex<C> implements IndividualContentIndex<C,U>
Abstract implementation of a content index.
-
Field Summary
Fields Modifier and Type Field Description protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<U>contentsToUsersMapping from identifiers to usersprotected it.unimi.dsi.fastutil.objects.Object2ObjectMap<U,it.unimi.dsi.fastutil.ints.IntList>usersToContentsMapping from the users to the identifiers of the user generated contents. -
Constructor Summary
Constructors Constructor Description AbstractIndividualContentIndex() -
Method Summary
Modifier and Type Method Description java.util.List<java.lang.Integer>getContents(U user)Given a user identifier, obtains the list of contents published by the user.UgetUser(int docID)Given a content identifier, obtains the user that created it.protected voidloadUserContentMap(java.lang.String indexPath, org.ranksys.formats.parsing.Parser<U> uParser)Loads a file containing the relation between indexes and user identifiers.Methods inherited from class es.uam.eps.ir.relison.content.index.AbstractIndex
getContent, getContentId, loadContentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface es.uam.eps.ir.relison.content.index.DocumentMap
getContent, getContentId, numDocsMethods inherited from interface es.uam.eps.ir.relison.content.index.Index
getAllTerms, getDocFreq, getPostings, getTotalFreq
-
Field Details
-
contentsToUsers
Mapping from identifiers to users -
usersToContents
protected it.unimi.dsi.fastutil.objects.Object2ObjectMap<U,it.unimi.dsi.fastutil.ints.IntList> usersToContentsMapping from the users to the identifiers of the user generated contents.
-
-
Constructor Details
-
AbstractIndividualContentIndex
public AbstractIndividualContentIndex()
-
-
Method Details
-
getUser
Description copied from interface:IndividualContentIndexGiven a content identifier, obtains the user that created it.- Specified by:
getUserin interfaceIndividualContentIndex<C,U>- Parameters:
docID- the content identifier.- Returns:
- the creator of the content.
-
getContents
Description copied from interface:IndividualContentIndexGiven a user identifier, obtains the list of contents published by the user.- Specified by:
getContentsin interfaceIndividualContentIndex<C,U>- Parameters:
user- the user identifier- Returns:
- the list of identifiers of the contents in the index.
-
loadUserContentMap
protected void loadUserContentMap(java.lang.String indexPath, org.ranksys.formats.parsing.Parser<U> uParser) throws java.io.IOExceptionLoads a file containing the relation between indexes and user identifiers.- Parameters:
indexPath- the path of the index.uParser- parser for reading the users.- Throws:
java.io.IOException- if something fails while writing the map.
-