Class QueryManager


  • public class QueryManager
    extends java.lang.Object
    Establishes a connection to fetch data from SNOMED CT database.
    • Constructor Summary

      Constructors 
      Constructor Description
      QueryManager()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void createcRefsetdb​(java.lang.String refsetId, java.lang.String refFilePath, java.util.Set<java.lang.String> moduleIdSet)
      This method will create database for cRefset
      void createExtensiondb​(java.util.Set<java.lang.String> moduleIdSet, java.lang.String conceptFile, java.lang.String descriptionFile, java.lang.String relationshipFile, java.lang.String refsetLangFile, java.lang.String concreteRelationshipFile, java.lang.String identifierFile)
      This method will create SNOMED CT extension database
      void createRefsetdb​(java.lang.String refsetId, java.lang.String refFilePath, java.util.Set<java.lang.String> moduleIdSet)
      This method will create database for Refset
      boolean createSimpleMapdb​(java.lang.String moduleId, java.lang.String simpleMapFilePath)
      This method will create database for simpleMap
      void createSNOMEDdb​(java.lang.String conceptFile, java.lang.String descriptionFile, java.lang.String relationshipFile, java.lang.String refsetLangFile, java.lang.String textdefinitionFile, java.lang.String concreteRelationshipFile)
      This method will create SNOMED CT database
      void deleteRelationshipTempFile​(java.lang.String filePath)
      This method will delete temporary relationship file created for TC table generation
      java.lang.String exportRelationshipTableAndDeleteTCTable()
      This method will export relationship table into a tsv file (for TC table creation)
      java.lang.String getAcceptabilityId​(java.lang.String descriptionId)
      Returns acceptability Id for specified description id.
      java.util.List<Description> getDescriptions​(java.lang.String conceptId)
      Returns list of Descriptions associated for a given concept identifier and which is other than FSN.
      java.lang.String getPreferredName​(java.lang.String conceptId, EnumLangRefset enumLangRefset)
      Returns list of preferred names in US refset associated with corresponding Concept identifier.
      java.util.List<Relationship> getRelationships​(java.lang.String ConceptId, java.lang.String relationshipType, EnumDirection direction)
      Returns unique Inward/Outward latest relationships with active status.
      void loadClosureTable​(java.io.File ct_file)
      This function loads the closure table in the database.
      void populateConcept​(java.lang.String id, Concept concept)
      Returns a SNOMED CT Concept associated for a given concept identifier.
      java.util.Set<Concept> searchConcepts​(java.lang.String searchTerm)
      Searches for concepts in the SNOMED CT repository for the given search term.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QueryManager

        public QueryManager()
    • Method Detail

      • populateConcept

        public void populateConcept​(java.lang.String id,
                                    Concept concept)
                             throws java.sql.SQLException,
                                    java.text.ParseException
        Returns a SNOMED CT Concept associated for a given concept identifier.
        Parameters:
        id - identifier of the concept.
        concept - SNOMED CT Concept which is to be populated.
        Throws:
        java.sql.SQLException
        java.text.ParseException
      • getDescriptions

        public java.util.List<Description> getDescriptions​(java.lang.String conceptId)
                                                    throws java.sql.SQLException,
                                                           java.text.ParseException
        Returns list of Descriptions associated for a given concept identifier and which is other than FSN.
        Parameters:
        conceptId - SNOMED CT Concept identifier.
        Returns:
        List of Descriptions .
        Throws:
        java.sql.SQLException - if any error occurs while accessing database.
        java.text.ParseException
      • searchConcepts

        public java.util.Set<Concept> searchConcepts​(java.lang.String searchTerm)
                                              throws java.sql.SQLException
        Searches for concepts in the SNOMED CT repository for the given search term.
        Parameters:
        searchTerm - String term/text to be searched .
        Returns:
        Set of Concepts.
        Throws:
        java.sql.SQLException - if any error occurs while accessing database.
      • getRelationships

        public java.util.List<Relationship> getRelationships​(java.lang.String ConceptId,
                                                             java.lang.String relationshipType,
                                                             EnumDirection direction)
                                                      throws java.sql.SQLException,
                                                             java.text.ParseException
        Returns unique Inward/Outward latest relationships with active status.
        Parameters:
        ConceptId - identifier of the Concept.
        enumRelationshipType - specifies the type of relationship.
        direction - specifies the direction(source / destination) EnumDirection.
        Returns:
        Set of Relationships .
        Throws:
        java.sql.SQLException - if any error occurs while accessing database.
        java.text.ParseException
      • getPreferredName

        public java.lang.String getPreferredName​(java.lang.String conceptId,
                                                 EnumLangRefset enumLangRefset)
                                          throws java.sql.SQLException
        Returns list of preferred names in US refset associated with corresponding Concept identifier.
        Parameters:
        enumLangRefset - specifies the Language Refset EnumLangRefset }.
        conceptId - identifier of the Concept.
        Returns:
        Preferred name of Concept.
        Throws:
        java.sql.SQLException
      • loadClosureTable

        public void loadClosureTable​(java.io.File ct_file)
                              throws java.sql.SQLException,
                                     java.io.IOException
        This function loads the closure table in the database.
        Parameters:
        ct_file - File associated with the closure table.
        Throws:
        java.sql.SQLException
        java.io.IOException
      • getAcceptabilityId

        public java.lang.String getAcceptabilityId​(java.lang.String descriptionId)
                                            throws java.sql.SQLException
        Returns acceptability Id for specified description id. acceptability id indicates whether particular description is Preferred Term or not.
        Parameters:
        descriptionId - String identifier of the Description.
        Returns:
        String value that specifies the acceptability id.
        Throws:
        java.sql.SQLException
      • createSNOMEDdb

        public void createSNOMEDdb​(java.lang.String conceptFile,
                                   java.lang.String descriptionFile,
                                   java.lang.String relationshipFile,
                                   java.lang.String refsetLangFile,
                                   java.lang.String textdefinitionFile,
                                   java.lang.String concreteRelationshipFile)
                            throws java.sql.SQLException
        This method will create SNOMED CT database
        Parameters:
        conceptFile - file path for Concept File
        descriptionFile - file path for Description File
        relationshipFile - file path for Relationship File
        refsetLangFile - file path for Language Refset File
        Throws:
        java.sql.SQLException
      • createExtensiondb

        public void createExtensiondb​(java.util.Set<java.lang.String> moduleIdSet,
                                      java.lang.String conceptFile,
                                      java.lang.String descriptionFile,
                                      java.lang.String relationshipFile,
                                      java.lang.String refsetLangFile,
                                      java.lang.String concreteRelationshipFile,
                                      java.lang.String identifierFile)
                               throws java.sql.SQLException
        This method will create SNOMED CT extension database
        Parameters:
        conceptFile - file path for Concept File
        descriptionFile - file path for Description File
        relationshipFile - file path for Relationship File
        refsetLangFile - file path for Language Refset File
        Set - of moduleId
        Throws:
        java.sql.SQLException
      • createRefsetdb

        public void createRefsetdb​(java.lang.String refsetId,
                                   java.lang.String refFilePath,
                                   java.util.Set<java.lang.String> moduleIdSet)
                            throws java.sql.SQLException
        This method will create database for Refset
        Parameters:
        refsetId -
        refFilePath -
        Throws:
        java.sql.SQLException
      • createcRefsetdb

        public void createcRefsetdb​(java.lang.String refsetId,
                                    java.lang.String refFilePath,
                                    java.util.Set<java.lang.String> moduleIdSet)
                             throws java.sql.SQLException
        This method will create database for cRefset
        Parameters:
        refsetId -
        refFilePath -
        moduleIdSet -
        Throws:
        java.sql.SQLException
      • createSimpleMapdb

        public boolean createSimpleMapdb​(java.lang.String moduleId,
                                         java.lang.String simpleMapFilePath)
                                  throws java.sql.SQLException
        This method will create database for simpleMap
        Parameters:
        moduleId -
        simpleMapFilePath -
        Throws:
        java.sql.SQLException
      • exportRelationshipTableAndDeleteTCTable

        public java.lang.String exportRelationshipTableAndDeleteTCTable()
                                                                 throws java.sql.SQLException,
                                                                        java.io.IOException
        This method will export relationship table into a tsv file (for TC table creation)
        Throws:
        java.sql.SQLException
        java.io.IOException
      • deleteRelationshipTempFile

        public void deleteRelationshipTempFile​(java.lang.String filePath)
        This method will delete temporary relationship file created for TC table generation