Class TableMaintenanceUtilImpl

java.lang.Object
ubic.gemma.persistence.service.maintenance.TableMaintenanceUtilImpl
All Implemented Interfaces:
TableMaintenanceUtil

@Service public class TableMaintenanceUtilImpl extends Object implements TableMaintenanceUtil
Functions for maintaining the database. This is intended for denormalized tables and statistics tables that need to be generated periodically.
Author:
jsantos, paul
  • Constructor Details

    • TableMaintenanceUtilImpl

      public TableMaintenanceUtilImpl()
  • Method Details

    • updateGene2CsEntries

      @Transactional public int updateGene2CsEntries()
      Description copied from interface: TableMaintenanceUtil
      If necessary, update the GENE2CS table.
      Specified by:
      updateGene2CsEntries in interface TableMaintenanceUtil
    • updateGene2CsEntries

      @Transactional public int updateGene2CsEntries(ArrayDesign arrayDesign, boolean force)
      Description copied from interface: TableMaintenanceUtil
      Update the GENE2CS table for a specific ArrayDesign.
      Specified by:
      updateGene2CsEntries in interface TableMaintenanceUtil
      Parameters:
      arrayDesign - the platform for which to update the GENE2CS entries
      force - update the table even if no platforms has been modified since the last update
    • updateGene2CsEntries

      @Transactional public int updateGene2CsEntries(@Nullable Date sinceLastUpdate, boolean truncate, boolean force)
      Description copied from interface: TableMaintenanceUtil
      Update the GENE2CS table.
      Specified by:
      updateGene2CsEntries in interface TableMaintenanceUtil
      Parameters:
      sinceLastUpdate - if not null, only update entries whose corresponding ArrayDesign hsa been updated after the given date
      truncate - if true, the GENE2CS table will be truncated before the update
      force - update the table even if no platforms has been modified since the last update
    • updateExpressionExperiment2CharacteristicEntries

      @Transactional public int updateExpressionExperiment2CharacteristicEntries(@Nullable Date sinceLastUpdate, boolean truncate)
      Description copied from interface: TableMaintenanceUtil
      Update the EXPRESSION_EXPERIMENT2CHARACTERISTIC table.
      Specified by:
      updateExpressionExperiment2CharacteristicEntries in interface TableMaintenanceUtil
      Returns:
      the number of records that were created or updated
    • updateExpressionExperiment2CharacteristicEntries

      @Transactional public int updateExpressionExperiment2CharacteristicEntries(Class<?> level, @Nullable Date sinceLastUpdate, boolean truncate)
      Description copied from interface: TableMaintenanceUtil
      Update a specific level of the EXPRESSION_EXPERIMENT2CHARACTERISTIC table.
      Specified by:
      updateExpressionExperiment2CharacteristicEntries in interface TableMaintenanceUtil
      Parameters:
      level - the level to update which is either ExpressionExperiment, BioMaterial or ExperimentalDesign
      Returns:
      the number of records that were created or updated
    • updateExpressionExperiment2CharacteristicEntries

      @Transactional public int updateExpressionExperiment2CharacteristicEntries(ExpressionExperiment ee, @Nullable Class<?> level)
      Description copied from interface: TableMaintenanceUtil
      Update the EXPRESSION_EXPERIMENT2CHARACTERISTIC table for a specific experiment.
      Specified by:
      updateExpressionExperiment2CharacteristicEntries in interface TableMaintenanceUtil
    • updateExpressionExperiment2ArrayDesignEntries

      @Transactional public int updateExpressionExperiment2ArrayDesignEntries(@Nullable Date sinceLastUpdate, boolean truncate)
      Description copied from interface: TableMaintenanceUtil
      Update the EXPRESSION_EXPERIMENT2_ARRAY_DESIGN table.
      Specified by:
      updateExpressionExperiment2ArrayDesignEntries in interface TableMaintenanceUtil
      Parameters:
      sinceLastUpdate - only update entries for platforms updated since this date
      truncate - if true, the table will be truncated before the update
      Returns:
      the number of records that were created or updated
    • updateExpressionExperiment2ArrayDesignEntries

      @Transactional public int updateExpressionExperiment2ArrayDesignEntries(ExpressionExperiment ee)
      Specified by:
      updateExpressionExperiment2ArrayDesignEntries in interface TableMaintenanceUtil
    • evictGene2CsQueryCache

      public void evictGene2CsQueryCache()
      Description copied from interface: TableMaintenanceUtil
      Evict the query cache for the GENE2CS table.
      Specified by:
      evictGene2CsQueryCache in interface TableMaintenanceUtil
    • evictEe2CQueryCache

      public void evictEe2CQueryCache()
      Description copied from interface: TableMaintenanceUtil
      Evict the query cache for the EXPRESSION_EXPERIMENT2CHARACTERISTIC table.
      Specified by:
      evictEe2CQueryCache in interface TableMaintenanceUtil
    • updateAnnotationRelationEntries

      @Transactional public int updateAnnotationRelationEntries(@Nullable ExpressionExperiment ee)
      Removes the CURATED rows. 🛑 It no longer writes any.

      The harvest turned every EE2C row carrying a predicate and an object into a triple keyed by the TERM. A statement a curator wrote about ONE experiment's material therefore came back as a property of that term and landed on every other experiment using it. uib found it on experiment 24976 -- mouse EAE astrocytes under fingolimod -- which rendered three confident chips, none of them true of it: astrocyte --derives from part of--> organoid from ee 31771, astrocyte --has role--> cell co-culturing from ee 32195, and nuclear RNA extract --derived from cell--> vasoactive intestinal peptide secreting cell from ee 32525.

      🛑 Filtering does not rescue the harvest, and this was measured rather than assumed. 15,007 of ~18,000 curated triples on prod were attested by a single experiment. The ones that recurred were the common curation PATTERNS rather than truths -- Trp53 --has_genotype--> Homozygous negative across 133 experiments, though Trp53 is also overexpressed and heterozygous elsewhere. Adding both breadth bars on top left a set that still read mostly experiment-local: diabetes mellitus --induced by--> streptozocin holds for STZ models rather than for diabetes, Apoe --has_allele --> APOE4 is simply wrong because Apoe also carries E2 and E3, and induced by records how one model was made. Paul, 2026-08-28, having read them: "most of these are not good … let's just delete all the curated records. We'll just make sure the ones we add are high quality."

      The delete is kept, and is what removes the rows already in the table. Curated relations are not gone as a concept -- what is gone is deriving them wholesale from annotations that were never assertions about a term. Anything added back has to be curated as a relation in its own right.

      Specified by:
      updateAnnotationRelationEntries in interface TableMaintenanceUtil
      Parameters:
      ee - restrict to one experiment, or null for the whole corpus
      Returns:
      always 0; nothing is written. The count of rows REMOVED goes to the log.
    • updateOntologyRelationEntries

      public int updateOntologyRelationEntries(@Nullable Collection<String> sources)
      Not @Transactional: the producer spends minutes walking Jena models before it has a row to write, and its own transaction wraps only the delete-and-insert. Holding a connection open across the read would be a maintenance job contending with the application for no reason.
      Specified by:
      updateOntologyRelationEntries in interface TableMaintenanceUtil
      Parameters:
      sources - source names to rebuild (CLO, CHEBI), or null/empty for all of them; the delete is narrowed the same way, so a partial run does not drop the rest
      Returns:
      how many relation rows were written
    • updateExternalRelationEntries

      public int updateExternalRelationEntries()
      Not @Transactional, for the same reason as the ontology pass: the fetch and the parse happen before there is a row to write, and the producer's own transaction wraps only the delete-and-insert.
      Specified by:
      updateExternalRelationEntries in interface TableMaintenanceUtil
      Returns:
      how many relation rows were written
    • evictAnnotationRelationQueryCache

      public void evictAnnotationRelationQueryCache()
      Description copied from interface: TableMaintenanceUtil
      Evict the query cache for the ANNOTATION_RELATION table.
      Specified by:
      evictAnnotationRelationQueryCache in interface TableMaintenanceUtil
    • evictEe2AdQueryCache

      public void evictEe2AdQueryCache()
      Description copied from interface: TableMaintenanceUtil
      Evict the query cache for the EXPRESSION_EXPERIMENT2_ARRAY_DESIGN table.
      Specified by:
      evictEe2AdQueryCache in interface TableMaintenanceUtil
    • disableEmail

      public void disableEmail()
      For use in tests.
      Specified by:
      disableEmail in interface TableMaintenanceUtil