gov.nih.nlm.umls.io
Class RichMRFilesConceptOutputStream

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

public class RichMRFilesConceptOutputStream
extends Object
implements ConceptOutputStream

This ConceptOutputStream generates a subset of "Rich Release Format" MR files.

Author:
Deborah Shapiro

Field Summary
protected  boolean add_unicode_bom
           
protected static String file_ext
           
protected  String mr_dir
           
protected  Map mr_targets
           
protected static String[] target_files
           
protected  Map target_to_output_stream
           
protected  boolean versioned_output
           
 
Constructor Summary
RichMRFilesConceptOutputStream()
          Instantiates an empty RichMRFilesConceptOutputStream.
 
Method Summary
 void close()
          Closes source files that were opened by @link #open(String)}.
 void flush(String file_name)
           
protected  long getFilePosition(String name)
          DO NOT USE.
 void open(String mr_dir)
          Opens all Rich Release Format MR 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 writeMRCOC(Concept concept)
          Writes MRCOC.RRF entries for a Concept
protected  void writeMRCONSO(Concept concept)
          Writes MRCONSO.RRF entries for a Concept
protected  void writeMRCXT(Concept concept)
          Writes MRCXT.RRF entries for a Concept
protected  void writeMRDEF(Concept concept)
          Writes MRDEF.RRF entries for a Concept
protected  void writeMRHIER(Concept concept)
          Writes MRHIER entries for a Concept
protected  void writeMRHIST(Concept concept)
          Writes MRHIST.RRF entries for a Concept
protected  void writeMRMAP(Concept concept)
          Writes MRMAP.RRF entries for a Concept
protected  void writeMRREL(Concept concept)
          Writes MRREL.RRF entries for a Concept
protected  void writeMRSAT(Concept concept)
          Writes MRSAT.RRF entries for a Concept
protected  void writeMRSMAP(Concept concept)
          Writes MRSMAP.RRF entries for a Concept
protected  void writeMRSTY(Concept concept)
          Writes MRSTY.RRF 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

file_ext

protected static String file_ext

target_to_output_stream

protected Map target_to_output_stream

mr_dir

protected String mr_dir

versioned_output

protected boolean versioned_output

add_unicode_bom

protected boolean add_unicode_bom
Constructor Detail

RichMRFilesConceptOutputStream

public RichMRFilesConceptOutputStream()
Instantiates an empty RichMRFilesConceptOutputStream.

Method Detail

open

public void open(String mr_dir)
          throws IOException
Opens all Rich Release Format MR files in the specified directory.

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

flush

public void flush(String file_name)
           throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Closes source files that were opened by @link #open(String)}.

Specified by:
close in interface ConceptOutputStream
Throws:
IOException - if the files could not be cloesed

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 - printing destination
Throws:
IOException

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

writeMRCOC

protected void writeMRCOC(Concept concept)
                   throws IOException
Writes MRCOC.RRF entries for a Concept

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

writeMRCONSO

protected void writeMRCONSO(Concept concept)
                     throws IOException
Writes MRCONSO.RRF entries for a Concept

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

writeMRCXT

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

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

writeMRHIER

protected void writeMRHIER(Concept concept)
                    throws IOException
Writes MRHIER 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.RRF entries for a Concept

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

writeMRSTY

protected void writeMRSTY(Concept concept)
                   throws IOException
Writes MRSTY.RRF entries for a Concept

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

writeMRREL

protected void writeMRREL(Concept concept)
                   throws IOException
Writes MRREL.RRF 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.RRF entries for a Concept

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

writeMRMAP

protected void writeMRMAP(Concept concept)
                   throws IOException
Writes MRMAP.RRF entries for a Concept

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

writeMRSMAP

protected void writeMRSMAP(Concept concept)
                    throws IOException
Writes MRSMAP.RRF entries for a Concept

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

writeMRHIST

protected void writeMRHIST(Concept concept)
                    throws IOException
Writes MRHIST.RRF entries for a Concept

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

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.

getFilePosition

protected long getFilePosition(String name)
                        throws IOException
DO NOT USE.

Parameters:
name - the name
Returns:
the file pos
Throws:
IOException - if anything goes wrong


Copyright ©2005