Package es.uam.eps.ir.relison.links.data
Class TerrierIndex
java.lang.Object
es.uam.eps.ir.relison.links.data.TerrierIndex
public class TerrierIndex
extends java.lang.Object
Class for generating Terrier indexes and queries from graphs.
-
Field Summary
Fields Modifier and Type Field Description private EdgeOrientation
dSel
Orientation for the "document" users.private FastGraph<?>
graph
The graph.private org.terrier.realtime.memory.MemoryIndex
index
The Terrier index.static java.lang.String
NODEID
Identifier for the id of the nodes in the index.private EdgeOrientation
qSel
Orientation for the "query" users.private java.util.Map<java.lang.Integer,java.lang.String>
queries
A structure for storing the different queries. -
Constructor Summary
Constructors Constructor Description TerrierIndex(FastGraph<?> graph, EdgeOrientation qSel, EdgeOrientation dSel)
Constructor.TerrierIndex(FastGraph<?> graph, EdgeOrientation qSel, EdgeOrientation dSel, org.terrier.realtime.memory.MemoryIndex memIndex, java.util.Map<java.lang.Integer,java.lang.String> queries)
Constructor. -
Method Summary
Modifier and Type Method Description private void
generateUnweightedIndex()
Generates the index and queries for a weighted graph.private void
generateWeightedIndex()
Generates the index and queries for an unweighted graph.EdgeOrientation
getDocumentOrientation()
Obtains the orientation for the "document" users.(package private) org.terrier.realtime.memory.MemoryIndex
getMemoryIndex()
(package private) java.util.Map<java.lang.Integer,java.lang.String>
getQueries()
EdgeOrientation
getQueryOrientation()
Obtains the orientation for the "query" users.org.terrier.querying.ScoredDocList
query(int uidx, java.lang.String model, java.util.Optional<java.lang.Double> c)
Executes a query over the collection.org.terrier.structures.CollectionStatistics
stats()
Obtains the statistics of the collection.
-
Field Details
-
index
private final org.terrier.realtime.memory.MemoryIndex indexThe Terrier index. -
queries
private final java.util.Map<java.lang.Integer,java.lang.String> queriesA structure for storing the different queries. -
qSel
Orientation for the "query" users. -
dSel
Orientation for the "document" users. -
graph
The graph. -
NODEID
public static final java.lang.String NODEIDIdentifier for the id of the nodes in the index.- See Also:
- Constant Field Values
-
-
Constructor Details
-
TerrierIndex
public TerrierIndex(FastGraph<?> graph, EdgeOrientation qSel, EdgeOrientation dSel, org.terrier.realtime.memory.MemoryIndex memIndex, java.util.Map<java.lang.Integer,java.lang.String> queries)Constructor.- Parameters:
graph
- the social network graph.qSel
- orientation for "query" users.dSel
- orientation for the "document" users.memIndex
- memory index.queries
- a set of queries (indexed by node id)
-
TerrierIndex
Constructor.- Parameters:
graph
- the graph.qSel
- orientation for the "query" users.dSel
- orientation for the "document" users.
-
-
Method Details
-
generateUnweightedIndex
private void generateUnweightedIndex()Generates the index and queries for a weighted graph. -
generateWeightedIndex
private void generateWeightedIndex()Generates the index and queries for an unweighted graph. -
query
public org.terrier.querying.ScoredDocList query(int uidx, java.lang.String model, java.util.Optional<java.lang.Double> c)Executes a query over the collection.- Parameters:
uidx
- identifier of the "query" user.model
- identifier of the weighting model.c
- c value of the weighting model (ex. the b param. in BM25).- Returns:
- a list of results if everything is OK, null otherwise.
-
stats
public org.terrier.structures.CollectionStatistics stats()Obtains the statistics of the collection.- Returns:
- the statistics.
-
getQueryOrientation
Obtains the orientation for the "query" users.- Returns:
- the orientation for the query users.
-
getDocumentOrientation
Obtains the orientation for the "document" users.- Returns:
- the orientation for the document users.
-
getMemoryIndex
org.terrier.realtime.memory.MemoryIndex getMemoryIndex() -
getQueries
java.util.Map<java.lang.Integer,java.lang.String> getQueries()
-