gov.nih.nlm.umls.io
Class OriginalMRFilesConceptInputStream

java.lang.Object
  extended bygov.nih.nlm.umls.io.OriginalMRFilesConceptInputStream
All Implemented Interfaces:
ConceptInputStream
Direct Known Subclasses:
OriginalMRMetathesaurusInputStream

public class OriginalMRFilesConceptInputStream
extends Object
implements ConceptInputStream

This ConceptInputStream builds Concept objects from a full set of original format MR files.

Author:
Deborah Shapiro

Field Summary
protected  String[] file_names
           
protected  String mr_dir
           
protected  PushBackReader mratx_source
           
protected  PushBackReader mrcoc_source
           
protected  int mrcon_counter
           
protected  int mrcon_lines
           
protected  PushBackReader mrcon_source
           
protected  PushBackReader mrcxt_source
           
protected  PushBackReader mrdef_source
           
protected  PushBackReader mrlo_source
           
protected  PushBackReader mrrel_source
           
protected  PushBackReader mrsat_source
           
protected  PushBackReader mrso_source
           
protected  PushBackReader mrsty_source
           
protected  Concept this_concept
           
protected  String[] tokens
           
 
Constructor Summary
OriginalMRFilesConceptInputStream()
          Instantiates an empty OriginalMRFilesConceptInputStream.
 
Method Summary
 void close()
          Close files opened during open(String[]).
protected  Concept getAtoms(Concept this_concept, String current_cui)
          Returns Atoms from the MRCON and MRSO files with the given cui and adds them to the current Concept.
protected  void getAttributes(Concept this_concept, String current_cui)
          Returns Attributes from the MRSAT files with the given cui and adds them to the current Concept
 int getConceptProgress()
          Returns the percentage of MRCON lines that have been processed.
protected  void getContexts(Concept this_concept, String current_cui)
          Returns Contexts from the MRCXT files with the given cui and adds them to the current Concept.
protected  void getCoocurrences(Concept this_concept, String current_cui)
          Returns a Coocurrences from the MRCOC file with the given cui and adds them to the current Concept.
protected  void getDefinitions(Concept this_concept, String current_cui)
          Returns Definitions from the MRDEF file with the given cui and adds them to the current Concept.
protected  Map getLineCounts()
          Reads through MRFILES to determine the size of MRCON.
protected  void getLocators(Concept this_concept, String current_cui)
          Returns Locators from the MRLO file with the given cui and adds them to the current Concept.
protected  void getMappings(Concept this_concept, String current_cui)
          Returns Mappings from the MRATX file with the given cui and adds them to the current Concept.
protected  void getRelationships(Concept this_concept, String current_cui)
          Returns Relationships from the MRREL file with the given cui and adds them to the current Concept
protected  void getSemanticTypes(Concept this_concept, String current_cui)
          Returns SemanticTypes from the MRSTY file with the given cui and adds them to the current Concept.
 void open(String[] install_paths)
          Opens all of the MR Files in preparation for subsetting.
protected  PushBackReader openSourceFile(String name)
          Opens the specified file in the directory passed to open(String[]).
 Concept readConcept()
          Returns the next Concept from the MR Files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mrso_source

protected PushBackReader mrso_source

mrcon_source

protected PushBackReader mrcon_source

mrsty_source

protected PushBackReader mrsty_source

mrdef_source

protected PushBackReader mrdef_source

mrrel_source

protected PushBackReader mrrel_source

mrcxt_source

protected PushBackReader mrcxt_source

mrcoc_source

protected PushBackReader mrcoc_source

mratx_source

protected PushBackReader mratx_source

mrsat_source

protected PushBackReader mrsat_source

mrlo_source

protected PushBackReader mrlo_source

file_names

protected String[] file_names

mr_dir

protected String mr_dir

this_concept

protected Concept this_concept

mrcon_lines

protected int mrcon_lines

mrcon_counter

protected int mrcon_counter

tokens

protected final String[] tokens
Constructor Detail

OriginalMRFilesConceptInputStream

public OriginalMRFilesConceptInputStream()
Instantiates an empty OriginalMRFilesConceptInputStream.

Method Detail

open

public void open(String[] install_paths)
          throws IOException
Opens all of the MR Files in preparation for subsetting.

Specified by:
open in interface ConceptInputStream
Parameters:
install_paths - the directory containing the files
Throws:
IOException - if any files can not be opened

close

public void close()
           throws IOException
Close files opened during open(String[]).

Specified by:
close in interface ConceptInputStream
Throws:
IOException - if files can not be closed

getConceptProgress

public int getConceptProgress()
Returns the percentage of MRCON lines that have been processed.

Specified by:
getConceptProgress in interface ConceptInputStream
Returns:
the percentage of MRCON lines that have been processed

readConcept

public Concept readConcept()
                    throws IOException
Returns the next Concept from the MR Files.

Specified by:
readConcept in interface ConceptInputStream
Returns:
the next Conceptfrom the MR Files
Throws:
IOException - if files could not be read

openSourceFile

protected PushBackReader openSourceFile(String name)
                                 throws IOException
Opens the specified file in the directory passed to open(String[]).

Parameters:
name - the filename
Returns:
a BufferedReader on the file
Throws:
IOException - if the file could not be opened

getLineCounts

protected Map getLineCounts()
                     throws IOException
Reads through MRFILES to determine the size of MRCON. This is used in the getConceptProgress() method.

Returns:
Map of file names to lines in file
Throws:
IOException - if the file cannot be opened or read

getMappings

protected void getMappings(Concept this_concept,
                           String current_cui)
                    throws IOException
Returns Mappings from the MRATX file with the given cui and adds them to the current Concept.

Parameters:
this_concept - Concept that will contain the Mappings
current_cui - String representation of the cui
Throws:
IOException - if there is a problem with the file

getAtoms

protected Concept getAtoms(Concept this_concept,
                           String current_cui)
                    throws IOException
Returns Atoms from the MRCON and MRSO files with the given cui and adds them to the current Concept.

Parameters:
this_concept - the current Concept
current_cui - the current CUI
Returns:
Concept that will contain the Atoms
Throws:
IOException - if there is a problem with the file

getAttributes

protected void getAttributes(Concept this_concept,
                             String current_cui)
                      throws IOException
Returns Attributes from the MRSAT files with the given cui and adds them to the current Concept

Parameters:
this_concept - the current Concept
current_cui - the current CUI
Throws:
IOException - if there is a problem with the file

getContexts

protected void getContexts(Concept this_concept,
                           String current_cui)
                    throws IOException
Returns Contexts from the MRCXT files with the given cui and adds them to the current Concept.

Parameters:
this_concept - the current Concept
current_cui - the current CUI
Throws:
IOException - if anything wrong with file

getCoocurrences

protected void getCoocurrences(Concept this_concept,
                               String current_cui)
                        throws IOException
Returns a Coocurrences from the MRCOC file with the given cui and adds them to the current Concept.

Parameters:
this_concept - the current Concept
current_cui - the current CUI
Throws:
IOException - if problem reading from file

getDefinitions

protected void getDefinitions(Concept this_concept,
                              String current_cui)
                       throws IOException
Returns Definitions from the MRDEF file with the given cui and adds them to the current Concept.

Parameters:
this_concept - the current Concept
current_cui - the current CUI
Throws:
IOException - if problem reading from the file

getLocators

protected void getLocators(Concept this_concept,
                           String current_cui)
                    throws IOException
Returns Locators from the MRLO file with the given cui and adds them to the current Concept.

Parameters:
this_concept - the current Concept
current_cui - the current CUI
Throws:
IOException - if problem reading from file

getSemanticTypes

protected void getSemanticTypes(Concept this_concept,
                                String current_cui)
                         throws IOException
Returns SemanticTypes from the MRSTY file with the given cui and adds them to the current Concept.

Parameters:
this_concept - the current Concept
current_cui - the current CUI
Throws:
IOException - if problem reading from file

getRelationships

protected void getRelationships(Concept this_concept,
                                String current_cui)
                         throws IOException
Returns Relationships from the MRREL file with the given cui and adds them to the current Concept

Parameters:
this_concept - the current Concept
current_cui - the current CUI
Throws:
IOException - if problem reading from file


Copyright ©2005