info.ephyra.search
Class Search

java.lang.Object
  extended by info.ephyra.search.Search

public class Search
extends java.lang.Object

The Search component queries several unstructured and (semi)structured knowledge sources in parallel and aggregate the results.

Queries are instances of the class info.ephyra.querygeneration.Query, results are instances of the Result class in this package.

Version:
2007-05-29
Author:
Nico Schlaefer

Field Summary
private static java.util.ArrayList<KnowledgeAnnotator> kas
          KnowledgeAnnotators used to query (semi)structured knowledge sources.
private static java.util.ArrayList<KnowledgeMiner> kms
          KnowledgeMiners used to query unstructured knowledge sources.
private static int MAX_PENDING
          The maximum number of parallel queries.
private static int pending
          Number pending of queries.
private static java.util.ArrayList<Result> results
          Results from different searches are aggregated in this field.
 
Constructor Summary
Search()
           
 
Method Summary
static void addKnowledgeAnnotator(KnowledgeAnnotator ka)
          Registers a KnowledgeAnnotator for a (semi)structured knowledge source.
static void addKnowledgeMiner(KnowledgeMiner km)
          Registers a KnowledgeMiner for an unstructured knowledge source.
static void addResults(Result[] results)
          Used by Searchers to return the results found in the knowledge sources.
static void clearKnowledgeAnnotators()
          Unregisters all KnowledgeAnnotators.
static void clearKnowledgeMiners()
          Unregisters all KnowledgeMiners.
static Result[] doSearch(Query[] queries)
          Sends several alternative queries to all the searchers that have been registered and returns the aggregated results.
private static java.util.ArrayList<Result> dropDuplicates(java.util.ArrayList<Result> results)
          Drops duplicates among results from KnowledgeMiners.
static void incPending()
          Increments the number of pending queries by 1.
private static void queryKAs(Query query)
          Searches the (semi)structured knowledge sources.
private static void queryKMs(Query query)
          Searches the unstructured knowledge sources.
static void waitForPending()
          Delays a thread until there are less than MAX_PENDING pending queries.
private static void waitForResults()
          Delays the main thread until all queries have been completed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_PENDING

private static final int MAX_PENDING
The maximum number of parallel queries.

See Also:
Constant Field Values

kas

private static java.util.ArrayList<KnowledgeAnnotator> kas
KnowledgeAnnotators used to query (semi)structured knowledge sources.


kms

private static java.util.ArrayList<KnowledgeMiner> kms
KnowledgeMiners used to query unstructured knowledge sources.


results

private static java.util.ArrayList<Result> results
Results from different searches are aggregated in this field.


pending

private static int pending
Number pending of queries.

Constructor Detail

Search

public Search()
Method Detail

queryKAs

private static void queryKAs(Query query)
Searches the (semi)structured knowledge sources.

Parameters:
query - query to be processed

queryKMs

private static void queryKMs(Query query)
Searches the unstructured knowledge sources.

Parameters:
query - query to be processed

waitForResults

private static void waitForResults()
Delays the main thread until all queries have been completed.


dropDuplicates

private static java.util.ArrayList<Result> dropDuplicates(java.util.ArrayList<Result> results)
Drops duplicates among results from KnowledgeMiners.

Parameters:
results - results with duplicates
Returns:
results without duplicates

addKnowledgeAnnotator

public static void addKnowledgeAnnotator(KnowledgeAnnotator ka)
Registers a KnowledgeAnnotator for a (semi)structured knowledge source.

Parameters:
ka - KnowledgeAnnotator to add

addKnowledgeMiner

public static void addKnowledgeMiner(KnowledgeMiner km)
Registers a KnowledgeMiner for an unstructured knowledge source.

Parameters:
km - KnowledgeMiner to add

clearKnowledgeAnnotators

public static void clearKnowledgeAnnotators()
Unregisters all KnowledgeAnnotators.


clearKnowledgeMiners

public static void clearKnowledgeMiners()
Unregisters all KnowledgeMiners.


doSearch

public static Result[] doSearch(Query[] queries)
Sends several alternative queries to all the searchers that have been registered and returns the aggregated results.

Parameters:
queries - queries to be processed
Returns:
results returned by the searchers

waitForPending

public static void waitForPending()
Delays a thread until there are less than MAX_PENDING pending queries.


incPending

public static void incPending()
Increments the number of pending queries by 1.


addResults

public static void addResults(Result[] results)
Used by Searchers to return the results found in the knowledge sources.

Parameters:
results - results found in the knowledge sources