de.dfki.mycbr.core.retrieval
Class SequentialRetrieval

java.lang.Object
  extended by de.dfki.mycbr.core.retrieval.RetrievalEngine
      extended by de.dfki.mycbr.core.retrieval.SequentialRetrieval

public class SequentialRetrieval
extends RetrievalEngine

Sequential retrieval computes the similarity of the query and all cases in the case base to get the most similar cases.

Author:
myCBR Team

Constructor Summary
SequentialRetrieval(Project p, Retrieval r)
           
 
Method Summary
 java.util.List<Pair<Instance,Similarity>> retrieve(ICaseBase cb, Instance q)
           
 java.util.List<Pair<Instance,Similarity>> retrieveK(ICaseBase cb, Instance q, int k)
           
 java.util.List<Pair<Instance,Similarity>> retrieveKSorted(ICaseBase cb, Instance q, int k)
           
 java.util.List<Pair<Instance,Similarity>> retrieveSorted(ICaseBase cb, Instance q)
           
 
Methods inherited from class de.dfki.mycbr.core.retrieval.RetrievalEngine
getCurrentCase, setCurrentCase
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequentialRetrieval

public SequentialRetrieval(Project p,
                           Retrieval r)
Parameters:
p - the project this retrieval belongs to
r - the underlying retrieval object
Method Detail

retrieve

public final java.util.List<Pair<Instance,Similarity>> retrieve(ICaseBase cb,
                                                                Instance q)
                                                         throws java.lang.Exception
Specified by:
retrieve in class RetrievalEngine
Parameters:
cb - the case base this retrieval should be run on
q - the current query
Returns:
list of retrieval results including pairs of case and similarity
Throws:
java.lang.Exception - if something goes wrong during similarity computations

retrieveK

public final java.util.List<Pair<Instance,Similarity>> retrieveK(ICaseBase cb,
                                                                 Instance q,
                                                                 int k)
                                                          throws java.lang.Exception
Specified by:
retrieveK in class RetrievalEngine
Parameters:
cb - the case base this retrieval should be run on
q - the current query
k - the number of cases to be returned
Returns:
list of k pairs of case and similarity (if there are enough)
Throws:
java.lang.Exception - if something goes wrong during similarity computations

retrieveKSorted

public final java.util.List<Pair<Instance,Similarity>> retrieveKSorted(ICaseBase cb,
                                                                       Instance q,
                                                                       int k)
                                                                throws java.lang.Exception
Specified by:
retrieveKSorted in class RetrievalEngine
Parameters:
cb - the case base this retrieval should be run on
q - the current query
k - the number of cases to be returned
Returns:
list of k pairs of case and similarity (if there are enough) sorted with respect to the similarities in descending order
Throws:
java.lang.Exception - if something goes wrong during similarity computations

retrieveSorted

public final java.util.List<Pair<Instance,Similarity>> retrieveSorted(ICaseBase cb,
                                                                      Instance q)
                                                               throws java.lang.Exception
Specified by:
retrieveSorted in class RetrievalEngine
Parameters:
cb - the case base this retrieval should be run on
q - the current query
Returns:
list of pairs of case and similarity sorted with respect to the similarities in descending order
Throws:
java.lang.Exception - if something goes wrong during similarity computations