com.sun.labs.minion.lextax
Class DiskTaxonomy

java.lang.Object
  extended by com.sun.labs.minion.lextax.Taxonomy
      extended by com.sun.labs.minion.lextax.DiskTaxonomy

public class DiskTaxonomy
extends Taxonomy


Nested Class Summary
protected  class DiskTaxonomy.HE
           
 
Field Summary
protected  DiskDictionary dict
          The dictionary for this partition.
protected  java.io.RandomAccessFile file
          The file containing the taxonomy.
protected static java.lang.String logTag
          The tag for log messages.
protected  int morphDepthLimit
          Subsumption search parameter: Limits number of morphological steps total along the path to a possible child node to explore.
protected  long[] offsets
          The offsets of the concepts.
protected  boolean useAbbreviations
          Subsumption search parameter: If true abbreviations find their target and full names also find the abbreviated version.
protected  boolean useEntailments
          Subsumption search parameter: If true the inverse entailments of the taxonomy will be followed when doing subsumption.
protected  boolean useMisspellings
          Subsumption search parameter: If true, marked known possible misspellings are used in subsumption in both directions.
protected  boolean useNicknames
          Subsumption search parameter: If true nicknames find the full name and full name queries also return marked nicknames, such as "chuck" for "Charles"
 
Fields inherited from class com.sun.labs.minion.lextax.Taxonomy
ABBREVIATION_OF, CHILDREN, ENTAILS, INSTANCE_OF, INV_ABBREVIATION_OF, INV_ENTAILS, INV_INSTANCE_OF, INV_KIND_OF, INV_MISSPELLING_OF, INV_MORPH_OF, INV_NICKNAME_OF, INV_SENSE_OF, INV_VARIANT_OF, KIND_OF, LINKCHARS, MISSPELLING_OF, MORPH_OF, NICKNAME_OF, NLINKS, NLINKTYPES, PARENTS, SENSE_OF, TOP, TOP_NAME, VARIANT_OF
 
Constructor Summary
DiskTaxonomy(java.io.File f, DiskPartition p)
          Instantiates a taxonomy from a file.
 
Method Summary
 void close()
           
 java.util.Set getChildren(int id)
          Gets all the children for a given concept.
 java.util.Set getChildren(java.lang.String name)
          Gets the children for a given name.
 ConceptEntry getConcept(int id)
          Gets the given concept.
 ConceptEntry getConcept(java.lang.String name)
          Gets the concept associated with a name.
 DiskDictionary getDict()
           
 java.util.Set getInstanceOfChildren(int id)
          Gets the instanceof children for a given concept.
 java.util.Set getInstanceOfParents(int id)
          Gets the instanceof parents for a given concept.
 java.util.Set getKindOfChildren(int id)
          Gets the kindof children for a given concept.
 java.util.Set getKindOfParents(int id)
          Gets the kindof parents for a given concept.
 java.util.Set getMorphChildren(int id)
          Gets the morphological children for a given concept.
 java.util.Set getMorphParents(int id)
          Gets the morphological parents for a given concept.
 java.util.Set getParents(int id)
          Gets all the parents for a given concept.
 java.util.Set getParents(java.lang.String name)
          Gets the parents for a given name.
 java.util.Set getSubsumed(Entry entry, int maxTerms)
          Gets all the concepts subsumed by a given concept.
 java.util.Set getSubsumed(java.lang.String name, int maxTerms)
          Gets all the concepts subsumed by a given concept.
 void merge(DiskTaxonomy[] taxonomies, java.lang.String indexDir, java.io.File f)
          Merges a number of taxonomies into a single one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

protected java.io.RandomAccessFile file
The file containing the taxonomy.


dict

protected DiskDictionary dict
The dictionary for this partition.


offsets

protected long[] offsets
The offsets of the concepts.


logTag

protected static java.lang.String logTag
The tag for log messages.


morphDepthLimit

protected int morphDepthLimit
Subsumption search parameter: Limits number of morphological steps total along the path to a possible child node to explore. Zero blocks morphology, -1 means no limit.


useAbbreviations

protected boolean useAbbreviations
Subsumption search parameter: If true abbreviations find their target and full names also find the abbreviated version.


useNicknames

protected boolean useNicknames
Subsumption search parameter: If true nicknames find the full name and full name queries also return marked nicknames, such as "chuck" for "Charles"


useMisspellings

protected boolean useMisspellings
Subsumption search parameter: If true, marked known possible misspellings are used in subsumption in both directions. The misspelling will find the true one and a query spelled correctly will also find the misspelled data.


useEntailments

protected boolean useEntailments
Subsumption search parameter: If true the inverse entailments of the taxonomy will be followed when doing subsumption. So if the taxonomy said that "harmony" entails "good", a search on "good" would include harmony as subsumption children.

Constructor Detail

DiskTaxonomy

public DiskTaxonomy(java.io.File f,
                    DiskPartition p)
             throws java.io.IOException
Instantiates a taxonomy from a file.

Parameters:
f - The file to read the taxonomy from.
p - The partition that this taxonomy is for
Throws:
java.io.IOException
Method Detail

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

getConcept

public ConceptEntry getConcept(java.lang.String name)
Gets the concept associated with a name.


getConcept

public ConceptEntry getConcept(int id)
Gets the given concept.

Parameters:
id - The id of the concept we want.

getMorphChildren

public java.util.Set getMorphChildren(int id)
Gets the morphological children for a given concept. Or null if there are none


getKindOfChildren

public java.util.Set getKindOfChildren(int id)
Gets the kindof children for a given concept. Or null of there are none


getInstanceOfChildren

public java.util.Set getInstanceOfChildren(int id)
Gets the instanceof children for a given concept. Or null if there are none


getChildren

public java.util.Set getChildren(java.lang.String name)
Gets the children for a given name. Or null if there are none


getChildren

public java.util.Set getChildren(int id)
Gets all the children for a given concept. Or null if there are none


getMorphParents

public java.util.Set getMorphParents(int id)
Gets the morphological parents for a given concept. Or none if there are none


getKindOfParents

public java.util.Set getKindOfParents(int id)
Gets the kindof parents for a given concept. Or null if there are none


getInstanceOfParents

public java.util.Set getInstanceOfParents(int id)
Gets the instanceof parents for a given concept. Or null if there are none


getParents

public java.util.Set getParents(java.lang.String name)
Gets the parents for a given name. Or null if there are none


getParents

public java.util.Set getParents(int id)
Gets all the parents for a given concept. Or null if the concept doesn't exist


getSubsumed

public java.util.Set getSubsumed(java.lang.String name,
                                 int maxTerms)
Gets all the concepts subsumed by a given concept.

Parameters:
name - The name of the term we want subsumed terms for
maxTerms - The maximum number of terms to return

getSubsumed

public java.util.Set getSubsumed(Entry entry,
                                 int maxTerms)
Gets all the concepts subsumed by a given concept. Modified Paul Martin 25nov02 to return only non-sensename concepts, so that retrieval will find the base "name" Further modified pmartin 5dec02 to follow all the other kinds of links that are possibly useful for subsumption

Parameters:
entry - the Entry for the term we want subsumed terms for
maxTerms - the maximum number of terms to return
Returns:
all the concepts subsumed by the given concept

merge

public void merge(DiskTaxonomy[] taxonomies,
                  java.lang.String indexDir,
                  java.io.File f)
           throws java.io.IOException
Merges a number of taxonomies into a single one.

Throws:
java.io.IOException

getDict

public DiskDictionary getDict()
Returns:
Returns the dict.