gov.nih.nlm.umls.io
Class RichMRFilesIndexLookup

java.lang.Object
  extended by gov.nih.nlm.umls.io.RichMRFilesIndexLookup
All Implemented Interfaces:
LocalNullValueSupport

public class RichMRFilesIndexLookup
extends Object
implements LocalNullValueSupport

Peforms a lookup in the index files to locate the Concepts that contain given words.

Author:
Deborah Shapiro

Field Summary
protected  boolean null_value_flag
           
protected  String regex_null_value
           
 
Constructor Summary
RichMRFilesIndexLookup(String dir)
          Instantiates an RichMRFilesIndexLookup from the specified input directory.
 
Method Summary
 void close()
          Release resources being used by this class.
 int countChildContexts(Context cxt)
          Looks up the given Context in the appropriate index files and returns the count of Contexts whose ptr matches the given one + the aui.
 int countSiblingContexts(Context cxt)
          Looks up the given Context in the appropriate index files and returns the count of Contexts whose ptr matches the given one.
 Context findAncestorContext(Context cxt, String ptr)
          Looks up the given ptr in the appropriate index files and returns the matching ancestor.
 Atom findAtomByAui(String aui)
          Looks up the given aui in the AUI_MRCONSO.x index file and returns the Atom that contains the given aui.
 Context[] findChildContexts(Context cxt)
          Looks up the given Context's ptr + aui in the appropriate index files and returns the Contexts with matching ptrs.
 Concept findConceptByAui(String aui)
          Looks up the given aui in the AUI_MRCONSO.x index file and returns the Concept that contains the given aui.
 Concept findConceptByCui(String cui)
          Looks up the given cui in MRCONSO and returns the Concept associated with the given cui.
 Context[] findSiblingContexts(Context cxt)
          Looks up the given Context's ptr in the appropriate index files and returns the Contexts with matching ptrs.
 String getLanguage()
          Returns the language of the index file that should be searched.
 String getNullValue()
          Returns the null value.
 int getPreviousTotalResultCount()
          Returns the total number of concept matches found on the previous search.
 double getThreshold()
          Returns the rank threshold value for searching.
 int getWordCountThreshold()
          Returns the rank threshold value for searching.
 boolean isEmptyValue(String token)
          Indicates whether or not the specified token is null or contains a null value as defined by being either zero length or a value equal to the null value.
protected  String resolveNull(String line)
          Replaces all "null value" characters in the line.
 void setLanguage(String lat)
          Sets the language of the index file that should be searched.
 void setMaxResults(int max_results)
          Sets the maximum number of results that should be returned.
 void setNullValue(String null_value)
          Sets the null value to use.
 void setThreshold(double threshold)
          Sets the rank threshold value for searching.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

regex_null_value

protected String regex_null_value

null_value_flag

protected boolean null_value_flag
Constructor Detail

RichMRFilesIndexLookup

public RichMRFilesIndexLookup(String dir)
                       throws IOException
Instantiates an RichMRFilesIndexLookup from the specified input directory.

Parameters:
dir - subset directory where index files can be found
Throws:
IOException
Method Detail

setNullValue

public void setNullValue(String null_value)
Sets the null value to use. This is needed if release.dat specifies some non-standard null value char sequence.

Specified by:
setNullValue in interface LocalNullValueSupport
Parameters:
null_value - the new null string value

getNullValue

public String getNullValue()
Returns the null value. This is needed if release.dat specifies some non-standard null value char sequence.

Specified by:
getNullValue in interface LocalNullValueSupport
Returns:
the string value for "null"

isEmptyValue

public boolean isEmptyValue(String token)
Indicates whether or not the specified token is null or contains a null value as defined by being either zero length or a value equal to the null value.

Specified by:
isEmptyValue in interface LocalNullValueSupport

resolveNull

protected String resolveNull(String line)
Replaces all "null value" characters in the line.

Parameters:
line - input line
Returns:
output line

close

public void close()
           throws IOException
Release resources being used by this class.

Throws:
IOException

getPreviousTotalResultCount

public int getPreviousTotalResultCount()
Returns the total number of concept matches found on the previous search.

Returns:
int number of concepts found on previous search

findChildContexts

public Context[] findChildContexts(Context cxt)
                            throws IOException
Looks up the given Context's ptr + aui in the appropriate index files and returns the Contexts with matching ptrs.

Parameters:
cxt - Context
Returns:
Context[] children
Throws:
IOException

findSiblingContexts

public Context[] findSiblingContexts(Context cxt)
                              throws IOException
Looks up the given Context's ptr in the appropriate index files and returns the Contexts with matching ptrs.

Parameters:
cxt - Context
Returns:
Context[] children
Throws:
IOException

findAncestorContext

public Context findAncestorContext(Context cxt,
                                   String ptr)
                            throws IOException
Looks up the given ptr in the appropriate index files and returns the matching ancestor.

Parameters:
cxt - Context
ptr - String
Returns:
Context[]
Throws:
IOException

countChildContexts

public int countChildContexts(Context cxt)
                       throws IOException
Looks up the given Context in the appropriate index files and returns the count of Contexts whose ptr matches the given one + the aui.

Parameters:
cxt - Context parent
Returns:
int children
Throws:
IOException

countSiblingContexts

public int countSiblingContexts(Context cxt)
                         throws IOException
Looks up the given Context in the appropriate index files and returns the count of Contexts whose ptr matches the given one.

Parameters:
cxt - Context parent
Returns:
int siblings
Throws:
IOException

findConceptByCui

public Concept findConceptByCui(String cui)
                         throws IOException
Looks up the given cui in MRCONSO and returns the Concept associated with the given cui.

Parameters:
cui - to be searched for
Returns:
Concept
Throws:
IOException

findConceptByAui

public Concept findConceptByAui(String aui)
                         throws IOException
Looks up the given aui in the AUI_MRCONSO.x index file and returns the Concept that contains the given aui.

Parameters:
aui - to be searched for
Returns:
Concept containing the aui
Throws:
IOException

findAtomByAui

public Atom findAtomByAui(String aui)
                   throws IOException
Looks up the given aui in the AUI_MRCONSO.x index file and returns the Atom that contains the given aui.

Parameters:
aui - to be searched for
Returns:
Atom containing the aui
Throws:
IOException

setLanguage

public void setLanguage(String lat)
Sets the language of the index file that should be searched.

Parameters:
lat - language abbreviation

getLanguage

public String getLanguage()
Returns the language of the index file that should be searched.

Returns:
the language of the index file that should be searched

setMaxResults

public void setMaxResults(int max_results)
Sets the maximum number of results that should be returned.

Parameters:
max_results - number of results

setThreshold

public void setThreshold(double threshold)
Sets the rank threshold value for searching.

Parameters:
threshold - the rank threshold valud for searching

getThreshold

public double getThreshold()
Returns the rank threshold value for searching.

Returns:
the rank threshold value for searching

getWordCountThreshold

public int getWordCountThreshold()
Returns the rank threshold value for searching.

Returns:
the rank threshold value for searching


Copyright ©2005