gov.nih.nlm.umls.io
Class RichMRMetathesaurusOutputStream

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

public class RichMRMetathesaurusOutputStream
extends RichMRFilesConceptOutputStream
implements MetathesaurusOutputStream, ProgressReporter

This MetathesaurusOutputStream generates MR files in the "Rich Release Format". It is an extension of RichMRFilesConceptOutputStream with additional code for the ReleaseMetadata content.

Author:
Deborah Shapiro

Field Summary
protected  String[] ancillary_files
           
protected  Atom[] atoms
           
protected  String[] change_files
           
protected  FileStatisticsConfiguration config
           
protected  List listeners
           
protected  Map lui_to_cui_set
           
protected  Map sui_to_cui_set
           
 
Fields inherited from class gov.nih.nlm.umls.io.RichMRFilesConceptOutputStream
add_unicode_bom, file_ext, mr_dir, mr_targets, target_files, target_to_output_stream, versioned_output
 
Constructor Summary
RichMRMetathesaurusOutputStream(FileStatisticsConfiguration config)
          Instantiates an empty RichMRMetathesaurusOutputStream.
 
Method Summary
 void addProgressListener(ProgressListener l)
          Adds a ProgressListener.
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  void fireProgressEvent(int pct, String note)
          Fires a ProgressEvent.
protected  String getColumnTextFromFileStatistics(FileStatistics file_stats)
          Returns the MRCOLS.RRF lines for the specified FileStatistics.
protected  String getFileTextFromFileStatistics(FileStatistics file_stats)
          Returns the MRFILES.RRF line for the specified FileStatistics.
protected  BufferedWriter openTargetFile(String name)
          Opens the specified file in the directory passed to RichMRFilesConceptOutputStream.open(String).
protected  void printLine(String line, String file_name)
          Prints the given line to the file with the given name.
 void removeProgressListener(ProgressListener l)
          Removes a ProgressListener.
 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 terms that are candidates to be ambiguous.
 void setCandidateAmbiguousTermIdentifiers(String[] luis)
          Sets the list of terms that are candidates to be ambiguous.
 void writeConcept(Concept concept)
          Writes a Concept to the appropriate MR files.
protected  void writeFileColumnStats()
          This method computes the file and columns statistics for the MRFILES.RRF and MRCOLS.RRF files themselves.
 void writeIndexEntry(IndexEntry index_entry)
          Writes an IndexEntry to the appropriate MR index file.
protected  void writeMRAUI(ReleaseMetadata release_metadata)
          Writes a line to the MRAUI.RRF file.
protected  void writeMRCUI(ReleaseMetadata release_metadata)
          Writes a line to the MRCUI.RRF file.
protected  void writeMRDOC(ReleaseMetadata release_metadata)
          Write a line to the MRDOC.RRF file.
protected  void writeMRRANK(ReleaseMetadata release_metadata)
          Writes a line to the MRRANK.RRF file.
protected  void writeMRSAB(ReleaseMetadata release_metadata)
          Write a line to the MRSAB.RRF file.
 void writeReleaseMetadata(ReleaseMetadata release_metadata)
          Writes an ReleaseMetadata to the appropriate MR metadata files.
 
Methods inherited from class gov.nih.nlm.umls.io.RichMRFilesConceptOutputStream
flush, getFilePosition, open, writeMRCOC, writeMRCONSO, writeMRCXT, writeMRDEF, writeMRHIER, writeMRHIST, writeMRMAP, writeMRREL, writeMRSAT, writeMRSMAP, writeMRSTY
 
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

listeners

protected List listeners

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

atoms

protected Atom[] atoms
Constructor Detail

RichMRMetathesaurusOutputStream

public RichMRMetathesaurusOutputStream(FileStatisticsConfiguration config)
Instantiates an empty RichMRMetathesaurusOutputStream.

Parameters:
config - FileStatisticsConfiguration
Method Detail

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 RichMRFilesConceptOutputStream
Throws:
IOException

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 RichMRFilesConceptOutputStream
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
Overrides:
writeConcept in class RichMRFilesConceptOutputStream
Parameters:
concept - the Concept to write
Throws:
IOException - if the files could not be written

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 a line to the MRCUI.RRF file.

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

writeMRAUI

protected void writeMRAUI(ReleaseMetadata release_metadata)
                   throws IOException
Writes a line to the MRAUI.RRF file.

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

writeMRDOC

protected void writeMRDOC(ReleaseMetadata release_metadata)
                   throws IOException
Write a line to the MRDOC.RRF file.

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

writeMRSAB

protected void writeMRSAB(ReleaseMetadata release_metadata)
                   throws IOException
Write a line to the MRSAB.RRF file.

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

writeMRRANK

protected void writeMRRANK(ReleaseMetadata release_metadata)
                    throws IOException
Writes a line to the MRRANK.RRF file.

Parameters:
release_metadata - the ReleaseMetadata
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 - list of terms that are candidates to be ambiguous

setCandidateAmbiguousTermIdentifiers

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

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

openTargetFile

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

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

addProgressListener

public void addProgressListener(ProgressListener l)
Adds a ProgressListener.

Specified by:
addProgressListener in interface ProgressReporter
Parameters:
l - thefProgressListener

removeProgressListener

public void removeProgressListener(ProgressListener l)
Removes a ProgressListener.

Specified by:
removeProgressListener in interface ProgressReporter
Parameters:
l - thefProgressListener

fireProgressEvent

protected void fireProgressEvent(int pct,
                                 String note)
Fires a ProgressEvent.

Parameters:
pct - percent done
note - progress note

writeFileColumnStats

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

Throws:
IOException - if anything goes wrong

getFileTextFromFileStatistics

protected String getFileTextFromFileStatistics(FileStatistics file_stats)
Returns the MRFILES.RRF line for the specified FileStatistics.

Parameters:
file_stats - the FileStatistics
Returns:
the MRFILES.RRF line for the specified FileStatistics

getColumnTextFromFileStatistics

protected String getColumnTextFromFileStatistics(FileStatistics file_stats)
Returns the MRCOLS.RRF lines for the specified FileStatistics.

Parameters:
file_stats - the FileStatistics
Returns:
the MRCOLS.RRF lines for the specified FileStatistics

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