gov.nih.nlm.umls.io
Class OriginalMRMetathesaurusOutputStream

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

public class OriginalMRMetathesaurusOutputStream
extends OriginalMRFilesConceptOutputStream
implements MetathesaurusOutputStream

This MetathesaurusOutputStream generates standard MR files.

Author:
Deborah Shapiro

Field Summary
protected  String[] ancillary_files
           
protected  String[] change_files
           
protected  FileStatisticsConfiguration config
           
protected  Map lui_to_cui_set
           
protected  Map sui_to_cui_set
           
 
Fields inherited from class gov.nih.nlm.umls.io.OriginalMRFilesConceptOutputStream
add_unicode_bom, mr_dir, mr_targets, target_files, versioned_output
 
Constructor Summary
OriginalMRMetathesaurusOutputStream(FileStatisticsConfiguration config)
          Instantiates an empty OriginalMRMetathesaurusOutputStream.
 
Method Summary
protected  void ambigCheck(Atom atom)
          Checks the maps to see if the given Atoms sui or lui should be added to the ambiguous maps.
 void close()
          Closes source files that were opened by this class's openTargets() method.
protected  String getColumnTextFromFileStatistics(FileStatistics file_stats)
          Returns a MRCOLS line.
protected  String getFileTextFromFileStatistics(FileStatistics file_stats)
          Returns a MRFILES line.
protected  BufferedWriter openTargetFile(String name)
          Opens the specified file in the directory passed to OriginalMRFilesConceptOutputStream.open(String).
protected  void printLine(String line, String file_name)
          Prints the given line to the file with the given name.
 void setCandidateAmbiguousStringIdentifiers(List suis)
          Sets the list of suis that are candidates to be ambiguous.
 void setCandidateAmbiguousStringIdentifiers(String[] suis)
          Sets the list of suis that are candidates to be ambiguous.
 void setCandidateAmbiguousTermIdentifiers(List luis)
          Sets the list of luis that are candidates to be ambiguous.
 void setCandidateAmbiguousTermIdentifiers(String[] luis)
          Sets the list of terms that are candidates to be ambiguous.
 void writeConcept(Concept c)
          Writes the specified Concept.
protected  void writeFileColumnStats()
          This method computes the file and columns statistics for the MRFILES and MRCOLS tables themselves.
 void writeIndexEntry(IndexEntry index_entry)
          Writes an IndexEntry to the appropriate MR index file.
protected  void writeMRCUI(ReleaseMetadata release_metadata)
          Writes the specified ReleaseMetadata to MRCUI.
protected  void writeMRRANK(ReleaseMetadata release_metadata)
          Write MRRANK.
protected  void writeMRSAB(ReleaseMetadata release_metadata)
          Writes MRSAB.
 void writeReleaseMetadata(ReleaseMetadata release_metadata)
          Writes an ReleaseMetadata to the appropriate MR metadata files.
 
Methods inherited from class gov.nih.nlm.umls.io.OriginalMRFilesConceptOutputStream
open, writeMRCON, writeMRCXT, writeMRDEF, writeMRSAT, writeMRSO
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nih.nlm.umls.io.ConceptOutputStream
open
 

Field Detail

config

protected FileStatisticsConfiguration config

change_files

protected String[] change_files

ancillary_files

protected String[] ancillary_files

sui_to_cui_set

protected Map sui_to_cui_set

lui_to_cui_set

protected Map lui_to_cui_set
Constructor Detail

OriginalMRMetathesaurusOutputStream

public OriginalMRMetathesaurusOutputStream(FileStatisticsConfiguration config)
Instantiates an empty OriginalMRMetathesaurusOutputStream.

Parameters:
config - FileStatisticsConfiguration
Method Detail

openTargetFile

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

Overrides:
openTargetFile in class OriginalMRFilesConceptOutputStream
Parameters:
name - the filename
Returns:
a BufferedWriter for the file
Throws:
IOException - if the file could not be opened.

printLine

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

Overrides:
printLine in class OriginalMRFilesConceptOutputStream
Parameters:
line - the line to be printed
file_name - printing destination
Throws:
IOException

close

public void close()
           throws IOException
Closes source files that were opened by this class's openTargets() method.

Specified by:
close in interface ConceptOutputStream
Overrides:
close in class OriginalMRFilesConceptOutputStream
Throws:
IOException

writeConcept

public void writeConcept(Concept c)
                  throws IOException
Writes the specified Concept.

Specified by:
writeConcept in interface ConceptOutputStream
Overrides:
writeConcept in class OriginalMRFilesConceptOutputStream
Parameters:
c - the specified Concept
Throws:
IOException - if anything goes wrong

writeIndexEntry

public void writeIndexEntry(IndexEntry index_entry)
                     throws IOException
Writes an IndexEntry to the appropriate MR index file.

Specified by:
writeIndexEntry in interface MetathesaurusOutputStream
Parameters:
index_entry - the IndexEntry to write
Throws:
IOException - if the file could not be written

writeMRCUI

protected void writeMRCUI(ReleaseMetadata release_metadata)
                   throws IOException
Writes the specified ReleaseMetadata to MRCUI.

Parameters:
release_metadata - the specified ReleaseMetadata
Throws:
IOException - if anything goes wrong

writeMRSAB

protected void writeMRSAB(ReleaseMetadata release_metadata)
                   throws IOException
Writes MRSAB.

Parameters:
release_metadata - the ReleaseMetadata containing MRSAB data
Throws:
IOException - if anything goes wrong

writeMRRANK

protected void writeMRRANK(ReleaseMetadata release_metadata)
                    throws IOException
Write MRRANK.

Parameters:
release_metadata - the ReleaseMetadata containing MRRANK data
Throws:
IOException - if anything goes wrong

writeReleaseMetadata

public void writeReleaseMetadata(ReleaseMetadata release_metadata)
                          throws IOException
Writes an ReleaseMetadata to the appropriate MR metadata files.

Specified by:
writeReleaseMetadata in interface MetathesaurusOutputStream
Parameters:
release_metadata - the ReleaseMetadata to write
Throws:
IOException - if the file could not be written

setCandidateAmbiguousStringIdentifiers

public void setCandidateAmbiguousStringIdentifiers(String[] suis)
Sets the list of suis that are candidates to be ambiguous.

Specified by:
setCandidateAmbiguousStringIdentifiers in interface MetathesaurusOutputStream
Parameters:
suis - the list of suis that are candidates to be ambiguous

setCandidateAmbiguousStringIdentifiers

public void setCandidateAmbiguousStringIdentifiers(List suis)
Sets the list of suis that are candidates to be ambiguous.

Specified by:
setCandidateAmbiguousStringIdentifiers in interface MetathesaurusOutputStream
Parameters:
suis - the list of suis that are candidates to be ambiguous

setCandidateAmbiguousTermIdentifiers

public void setCandidateAmbiguousTermIdentifiers(String[] luis)
Sets the list of terms that are candidates to be ambiguous.

Specified by:
setCandidateAmbiguousTermIdentifiers in interface MetathesaurusOutputStream
Parameters:
luis - candidate terms

setCandidateAmbiguousTermIdentifiers

public void setCandidateAmbiguousTermIdentifiers(List luis)
Sets the list of luis that are candidates to be ambiguous.

Specified by:
setCandidateAmbiguousTermIdentifiers in interface MetathesaurusOutputStream
Parameters:
luis - the list of luis that are candidates to be ambiguous

writeFileColumnStats

protected void writeFileColumnStats()
                             throws IOException
This method computes the file and columns statistics for the MRFILES and MRCOLS tables themselves. Should it be using "\n"?

Throws:
IOException - if problem writing to files

getFileTextFromFileStatistics

protected String getFileTextFromFileStatistics(FileStatistics file_stats)
Returns a MRFILES line.

Parameters:
file_stats - FileStatistics
Returns:
a MRFILES line

getColumnTextFromFileStatistics

protected String getColumnTextFromFileStatistics(FileStatistics file_stats)
Returns a MRCOLS line.

Parameters:
file_stats - FileStatistics
Returns:
a MRCOLS line

ambigCheck

protected void ambigCheck(Atom atom)
Checks the maps to see if the given Atoms sui or lui should be added to the ambiguous maps.

Parameters:
atom - the Atomto check


Copyright ©2005