gov.nih.nlm.umls.io
Class OriginalMRFilesConceptOutputStream

java.lang.Object
  extended bygov.nih.nlm.umls.io.OriginalMRFilesConceptOutputStream
All Implemented Interfaces:
ConceptOutputStream
Direct Known Subclasses:
OriginalMRMetathesaurusOutputStream

public class OriginalMRFilesConceptOutputStream
extends Object
implements ConceptOutputStream

This ConceptOutputStream generates a subset of standard MR files.

Author:
Deborah Shapiro

Field Summary
protected  boolean add_unicode_bom
           
protected  String mr_dir
           
protected  Map mr_targets
           
protected static String[] target_files
           
protected  boolean versioned_output
           
protected  List warnings
           
 
Constructor Summary
OriginalMRFilesConceptOutputStream()
          Instantiates an empty OriginalMRFilesConceptOutputStream.
 
Method Summary
protected  Map assignLrl(Atom[] atoms)
          Assigns the LRL value.
 void close()
          Closes files opened in open(String).
 String[] getWarnings()
          Returns a String[] of warnings accumulated during processing of the output stream.
protected  boolean isLuiSuppressible(String lui, Atom[] atoms)
          Returns true if the specified LUI is suppressible.
 void open(String mr_dir)
          Opens all target files in the specified directory.
protected  BufferedWriter openTargetFile(String name)
          Opens the specified file in the directory passed to open(String).
protected  void printLine(String line, String file_name)
          Prints the given line to the file with the given name.
 void writeConcept(Concept concept)
          Writes a Concept to the appropriate MR files.
protected  void writeMRCON(Concept concept)
          Writes MRCON entries for a Concept
protected  void writeMRCXT(Concept concept)
          Writes MRCXT entries for a Concept
protected  void writeMRDEF(Concept concept)
          Writes MRDEF entries for a Concept
protected  void writeMRSAT(Concept concept)
          Writes MRSAT entries for a Concept
protected  void writeMRSO(Concept concept)
          Writes MRSO entries for a Concept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mr_targets

protected Map mr_targets

target_files

protected static String[] target_files

mr_dir

protected String mr_dir

versioned_output

protected boolean versioned_output

add_unicode_bom

protected boolean add_unicode_bom

warnings

protected List warnings
Constructor Detail

OriginalMRFilesConceptOutputStream

public OriginalMRFilesConceptOutputStream()
Instantiates an empty OriginalMRFilesConceptOutputStream.

Method Detail

open

public void open(String mr_dir)
          throws IOException
Opens all target files in the specified directory. The set of target files is the standard MR files.

Specified by:
open in interface ConceptOutputStream
Parameters:
mr_dir - the subset directory
Throws:
IOException - if the files cannot be opened

close

public void close()
           throws IOException
Closes files opened in open(String).

Specified by:
close in interface ConceptOutputStream
Throws:
IOException - if the stream cannot be closed

writeConcept

public void writeConcept(Concept concept)
                  throws IOException
Writes a Concept to the appropriate MR files.

Specified by:
writeConcept in interface ConceptOutputStream
Parameters:
concept - the Concept to write
Throws:
IOException - if the files could not be written

writeMRSO

protected void writeMRSO(Concept concept)
                  throws IOException
Writes MRSO entries for a Concept

Parameters:
concept - the Concept to write
Throws:
IOException - if anything goes wrong

writeMRCON

protected void writeMRCON(Concept concept)
                   throws IOException
Writes MRCON entries for a Concept

Parameters:
concept - the Concept to write
Throws:
IOException - if anything goes wrong

isLuiSuppressible

protected boolean isLuiSuppressible(String lui,
                                    Atom[] atoms)
Returns true if the specified LUI is suppressible.

Parameters:
lui - the LUI value to check
atoms - the Atoms
Returns:
true if the LUI is suppressible, false otherwise

assignLrl

protected Map assignLrl(Atom[] atoms)
Assigns the LRL value.

Parameters:
atoms - the Atoms to be assigned
Returns:
Map of cui:sui tuple mapped to lrl

writeMRCXT

protected void writeMRCXT(Concept concept)
                   throws IOException
Writes MRCXT entries for a Concept

Parameters:
concept - the Concept to write
Throws:
IOException - if anything goes wrong

writeMRDEF

protected void writeMRDEF(Concept concept)
                   throws IOException
Writes MRDEF entries for a Concept

Parameters:
concept - the Concept to write
Throws:
IOException - if anything goes wrong

writeMRSAT

protected void writeMRSAT(Concept concept)
                   throws IOException
Writes MRSAT entries for a Concept

Parameters:
concept - the Concept to write
Throws:
IOException - if anything goes wrong

printLine

protected void printLine(String line,
                         String file_name)
                  throws IOException
Prints the given line to the file with the given name.

Parameters:
line - the line to be printed
file_name - filename to print to
Throws:
IOException

openTargetFile

protected BufferedWriter openTargetFile(String name)
                                 throws IOException
Opens the specified file in the directory passed to open(String).

Parameters:
name - the filename
Returns:
a BufferedWriter for the file
Throws:
IOException - if the file could not be opened.

getWarnings

public String[] getWarnings()
Returns a String[] of warnings accumulated during processing of the output stream.

Specified by:
getWarnings in interface ConceptOutputStream
Returns:
String[] of warnings


Copyright ©2005