Skip to content

Commit

Permalink
Merge pull request #1665 from alliance-genome/fix_missing_indexs
Browse files Browse the repository at this point in the history
  • Loading branch information
oblodgett authored Sep 11, 2024
2 parents 353e4b5 + 202be7f commit 8ceabe9
Show file tree
Hide file tree
Showing 31 changed files with 776 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;
Expand All @@ -24,7 +22,6 @@
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand All @@ -35,14 +32,7 @@
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
@Schema(name = "AGM_Disease_Annotation", description = "Annotation class representing a agm disease annotation")
@JsonTypeName("AGMDiseaseAnnotation")
@OnDelete(action = OnDeleteAction.CASCADE)
@AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { DiseaseAnnotation.class })
@Table(indexes = {
@Index(name = "AGMDiseaseAnnotation_inferredGene_index", columnList = "inferredGene_id"),
@Index(name = "AGMDiseaseAnnotation_inferredAllele_index", columnList = "inferredAllele_id"),
@Index(name = "AGMDiseaseAnnotation_assertedAllele_index", columnList = "assertedAllele_id"),
@Index(name = "AGMDiseaseAnnotation_DiseaseAnnotationSubject_index", columnList = "diseaseAnnotationSubject_id")
})
public class AGMDiseaseAnnotation extends DiseaseAnnotation {

@IndexedEmbedded(includePaths = {"name", "name_keyword", "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"})
Expand Down Expand Up @@ -91,7 +81,10 @@ public class AGMDiseaseAnnotation extends DiseaseAnnotation {
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToMany
@Fetch(FetchMode.SELECT)
@JoinTable(indexes = @Index(name = "agmdiseaseannotation_gene_agmdiseaseannotation_index", columnList = "agmdiseaseannotation_id"))
@JoinTable(indexes = {
@Index(name = "association_agmdiseaseannotation_index", columnList = "agmdiseaseannotation_id"),
@Index(name = "association_assertedgenes_index", columnList = "assertedgenes_id")
})
@JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class })
private List<Gene> assertedGenes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand All @@ -33,12 +32,6 @@
@Schema(name = "AGM_Phenotype_Annotation", description = "Annotation class representing a agm phenotype annotation")
@JsonTypeName("AGMPhenotypeAnnotation")
@AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { PhenotypeAnnotation.class })
@Table(indexes = {
@Index(name = "AGMPhenotypeAnnotation_inferredGene_index", columnList = "inferredGene_id"),
@Index(name = "AGMPhenotypeAnnotation_inferredAllele_index", columnList = "inferredAllele_id"),
@Index(name = "AGMPhenotypeAnnotation_assertedAllele_index", columnList = "assertedAllele_id"),
@Index(name = "AGMPhenotypeAnnotation_PhenotypeAnnotationSubject_index", columnList = "phenotypeAnnotationSubject_id")
})
public class AGMPhenotypeAnnotation extends PhenotypeAnnotation {

@IndexedEmbedded(includePaths = {"name", "name_keyword", "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"})
Expand Down Expand Up @@ -88,8 +81,8 @@ public class AGMPhenotypeAnnotation extends PhenotypeAnnotation {
@ManyToMany
@Fetch(FetchMode.SELECT)
@JoinTable(indexes = {
@Index(name = "agmphenotypeannotation_gene_agmphenotypeannotation_index", columnList = "agmphenotypeannotation_id"),
@Index(name = "agmphenotypeannotation_gene_assertedgenes_index", columnList = "assertedgenes_id")
@Index(name = "association_agmphenotypeannotation_index", columnList = "agmphenotypeannotation_id"),
@Index(name = "association_assertedgenes_index", columnList = "assertedgenes_id")
})
@JsonView({ View.FieldsAndLists.class, View.PhenotypeAnnotationView.class, View.ForPublic.class })
private List<Gene> assertedGenes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;
Expand All @@ -24,7 +22,6 @@
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand All @@ -35,12 +32,7 @@
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
@Schema(name = "Allele_Disease_Annotation", description = "Annotation class representing a allele disease annotation")
@JsonTypeName("AlleleDiseaseAnnotation")
@OnDelete(action = OnDeleteAction.CASCADE)
@AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { DiseaseAnnotation.class })
@Table(indexes = {
@Index(name = "AlleleDiseaseAnnotation_inferredGene_index", columnList = "inferredGene_id"),
@Index(name = "AlleleDiseaseAnnotation_DiseaseAnnotationSubject_index", columnList = "diseaseAnnotationSubject_id")
})
public class AlleleDiseaseAnnotation extends DiseaseAnnotation {

@IndexedEmbedded(includePaths = {
Expand Down Expand Up @@ -83,8 +75,8 @@ public class AlleleDiseaseAnnotation extends DiseaseAnnotation {
@ManyToMany
@Fetch(FetchMode.SELECT)
@JoinTable(indexes = {
@Index(name = "allelediseaseannotationgene_diseaseannotation_index", columnList = "allelediseaseannotation_id"),
@Index(name = "allelediseaseannotationgene_assertedgenes_index", columnList = "assertedgenes_id")
@Index(name = "association_allelediseaseannotation_index", columnList = "allelediseaseannotation_id"),
@Index(name = "association_assertedgenes_index", columnList = "assertedgenes_id")
})
@JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class })
private List<Gene> assertedGenes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand All @@ -33,10 +32,6 @@
@Schema(name = "Allele_Phenotype_Annotation", description = "Annotation class representing a allele phenotype annotation")
@JsonTypeName("AllelePhenotypeAnnotation")
@AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { PhenotypeAnnotation.class })
@Table(indexes = {
@Index(name = "AllelePhenotypeAnnotation_inferredGene_index", columnList = "inferredGene_id"),
@Index(name = "AllelePhenotypeAnnotation_PhenotypeAnnotationSubject_index", columnList = "phenotypeAnnotationSubject_id")
})
public class AllelePhenotypeAnnotation extends PhenotypeAnnotation {

@IndexedEmbedded(includePaths = {
Expand Down Expand Up @@ -79,8 +74,8 @@ public class AllelePhenotypeAnnotation extends PhenotypeAnnotation {
@ManyToMany
@Fetch(FetchMode.SELECT)
@JoinTable(indexes = {
@Index(name = "allelephenotypeannotationgene_phenotypeannotation_index", columnList = "allelephenotypeannotation_id"),
@Index(name = "allelephenotypeannotationgene_assertedgenes_index", columnList = "assertedgenes_id")
@Index(name = "association_allelephenotypeannotation_index", columnList = "allelephenotypeannotation_id"),
@Index(name = "association_assertedgenes_index", columnList = "assertedgenes_id")
})
@JsonView({ View.FieldsAndLists.class, View.PhenotypeAnnotationView.class, View.ForPublic.class })
private List<Gene> assertedGenes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
Expand All @@ -40,18 +38,6 @@
@ToString(callSuper = true)
@Schema(name = "annotation", description = "POJO that represents an annotation")
@AGRCurationSchemaVersion(min = "1.9.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class })
@Table(
indexes = {
@Index(name = "annotation_curie_index", columnList = "curie"),
@Index(name = "annotation_uniqueId_index", columnList = "uniqueId"),
@Index(name = "annotation_modEntityId_index", columnList = "modEntityId"),
@Index(name = "annotation_modInternalId_index", columnList = "modInternalId"),
@Index(name = "annotation_dataprovider_index", columnList = "dataProvider_id")
}, uniqueConstraints = {
@UniqueConstraint(name = "annotation_modentityid_uk", columnNames = "modEntityId"),
@UniqueConstraint(name = "annotation_modinternalid_uk", columnNames = "modInternalId")
}
)
public class Annotation extends SingleReferenceAssociation {

@FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
Expand Down Expand Up @@ -86,7 +72,10 @@ public class Annotation extends SingleReferenceAssociation {
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToMany
@JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.PhenotypeAnnotationView.class, View.ForPublic.class })
@JoinTable(indexes = { @Index(name = "annotation_conditionrelation_annotation_index", columnList = "annotation_id"), @Index(name = "annotation_conditionrelation_conditionrelations_index", columnList = "conditionrelations_id")})
@JoinTable(indexes = {
@Index(name = "association_annotation_conditionrelation_index", columnList = "annotation_id"),
@Index(name = "association_annotation_conditionrelations_index", columnList = "conditionrelations_id")
})
private List<ConditionRelation> conditionRelations;

@IndexedEmbedded(includePaths = {"freeText", "noteType.name", "references.curie",
Expand All @@ -96,7 +85,10 @@ public class Annotation extends SingleReferenceAssociation {
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class })
@JoinTable(indexes = { @Index(name = "annotation_note_annotation_index", columnList = "annotation_id"), @Index(name = "annotation_note_relatednotes_index", columnList = "relatednotes_id")})
@JoinTable(indexes = {
@Index(name = "association_annotation_annotation_index", columnList = "annotation_id"),
@Index(name = "association_relatednotes_index", columnList = "relatednotes_id")
})
private List<Note> relatedNotes;

@IndexedEmbedded(includePaths = {"sourceOrganization.abbreviation", "sourceOrganization.fullName", "sourceOrganization.shortName", "crossReference.displayName", "crossReference.referencedCurie",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.alliancegenome.curation_api.model.entities.base.AuditedObject;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

import jakarta.persistence.DiscriminatorColumn;
import jakarta.persistence.Entity;
import jakarta.persistence.Index;
import jakarta.persistence.Inheritance;
Expand All @@ -14,16 +15,75 @@
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Inheritance(strategy = InheritanceType.JOINED)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "AssociationType", length = 96)
@Entity
@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
@ToString(callSuper = true)
@Schema(name = "association", description = "POJO that represents an association")
@Table(indexes = {
@Index(name = "association_createdby_index", columnList = "createdBy_id"),
@Index(name = "association_updatedby_index", columnList = "updatedBy_id")
@Index(name = "association_curie_index", columnList = "curie"),
@Index(name = "association_modEntityId_index", columnList = "modEntityId"),
@Index(name = "association_modInternalId_index", columnList = "modInternalId"),
@Index(name = "association_uniqueId_index", columnList = "uniqueid"),
@Index(name = "association_whenexpressedstagename_index ", columnList = "whenexpressedstagename"),
@Index(name = "association_whereexpressedstatement_index", columnList = "whereexpressedstatement"),
@Index(name = "association_interactionId_index", columnList = "interactionid"),
@Index(name = "association_construct_subject_index", columnList = "constructassociationsubject_id"),
@Index(name = "association_construct_object_index", columnList = "constructgenomicentityassociationobject_id"),
@Index(name = "association_relation_index", columnList = "relation_id"),
@Index(name = "association_singlereference_index", columnList = "singleReference_id"),
@Index(name = "association_dataProvider_index", columnList = "dataProvider_id"),
@Index(name = "association_crossreference_index", columnList = "crossreference_id"),
@Index(name = "association_assertedAllele_index", columnList = "assertedAllele_id"),
@Index(name = "association_inferredAllele_index", columnList = "inferredAllele_id"),
@Index(name = "association_inferredGene_index", columnList = "inferredGene_id"),
@Index(name = "association_PhenotypeAnnotationSubject_index", columnList = "phenotypeAnnotationSubject_id"),
@Index(name = "association_sgdstrainbackground_index", columnList = "sgdstrainbackground_id"),
@Index(name = "association_expressionpattern_index", columnList = "expressionpattern_id"),
@Index(name = "association_expression_annotation_subject_index", columnList = "expressionannotationsubject_id"),
@Index(name = "association_expression_assay_used_index", columnList = "expressionassayused_id"),
@Index(name = "association_sqtr_subject_index", columnList = "sequencetargetingreagentassociationsubject_id"),
@Index(name = "association_sqtr_object_index", columnList = "sequencetargetingreagentgeneassociationobject_id"),
@Index(name = "association_evidencecode_index", columnList = "evidencecode_id"),
@Index(name = "association_relatednote_index", columnList = "relatednote_id"),
@Index(name = "association_geneassociationsubject_index", columnList = "geneassociationsubject_id"),
@Index(name = "association_genegeneassociationobject_index", columnList = "genegeneassociationobject_id"),
@Index(name = "association_transcript_subject_index", columnList = "transcriptassociationsubject_id"),
@Index(name = "association_transcript_gene_object_index", columnList = "transcriptgeneassociationobject_id"),
@Index(name = "association_exon_subject_index", columnList = "exonassociationsubject_id"),
@Index(name = "association_exon_object_index", columnList = "exongenomiclocationassociationobject_id"),
@Index(name = "association_annotationType_index", columnList = "annotationType_id"),
@Index(name = "association_DiseaseAnnotationObject_index", columnList = "diseaseAnnotationObject_id"),
@Index(name = "association_diseaseGeneticModifierRelation_index", columnList = "diseaseGeneticModifierRelation_id"),
@Index(name = "association_geneticSex_index", columnList = "geneticSex_id"),
@Index(name = "association_secondaryDataProvider_index", columnList = "secondaryDataProvider_id"),
@Index(name = "association_DiseaseAnnotationSubject_index", columnList = "diseaseAnnotationSubject_id"),
@Index(name = "association_interactionsource_index", columnList = "interactionsource_id"),
@Index(name = "association_interactiontype_index", columnList = "interactiontype_id"),
@Index(name = "association_interactorarole_index", columnList = "interactorarole_id"),
@Index(name = "association_interactorbrole_index", columnList = "interactorbrole_id"),
@Index(name = "association_interactoratype_index", columnList = "interactoratype_id"),
@Index(name = "association_interactorbtype_index", columnList = "interactorbtype_id"),
@Index(name = "association_interactorageneticperturbarion_index", columnList = "interactorageneticperturbation_id"),
@Index(name = "association_interactorbgeneticperturbarion_index", columnList = "interactorbgeneticperturbation_id"),
@Index(name = "association_alleleassociationsubject_index", columnList = "alleleassociationsubject_id"),
@Index(name = "association_allelegeneassociationobject_index", columnList = "allelegeneassociationobject_id"),
@Index(name = "association_transcript_exon_object_index", columnList = "transcriptexonassociationobject_id"),
@Index(name = "association_transcript_object_index", columnList = "transcriptgenomiclocationassociationobject_id"),
@Index(name = "association_cds_subject_index", columnList = "codingsequenceassociationsubject_id"),
@Index(name = "association_cds_object_index", columnList = "codingsequencegenomiclocationassociationobject_id"),
@Index(name = "association_aggregationdatabase_index", columnList = "aggregationdatabase_id"),
@Index(name = "association_detectionmethod_index", columnList = "detectionmethod_id"),
@Index(name = "association_transcript_cds_object_index", columnList = "transcriptcodingsequenceassociationobject_id"),

@Index(name = "association_associationtype_index", columnList = "associationtype"),

@Index(name = "association_createdby_index", columnList = "createdBy_id"),
@Index(name = "association_updatedby_index", columnList = "updatedBy_id")
})

@AGRCurationSchemaVersion(min = "1.9.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class })
public class Association extends AuditedObject {

Expand Down
Loading

0 comments on commit 8ceabe9

Please sign in to comment.