Class AnnotationRelationDaoImpl
- All Implemented Interfaces:
BaseDao<AnnotationRelation>, AnnotationRelationDao
AnnotationRelationDao.
Native SQL throughout. The reads are aggregations over a derived table with an ACL clause that
has to be composed per user class, and the ACL helper emits SQL, not HQL - the same reason
CharacteristicDaoImpl's EE2C reads are native.
The expensive part happens offline. Every query here is an indexed lookup plus a group-by over a small purpose-built table. There is deliberately no candidate cut, no self-join over EE2C, and no second query stitched to the first by a string key in Java: those existed only to fit a corpus-wide derivation inside a request, and once the derivation runs in the maintenance job there is nothing left to approximate around.
-
Nested Class Summary
Nested classes/interfaces inherited from interface AnnotationRelationDao
AnnotationRelationDao.Direction, AnnotationRelationDao.RelationQuery, AnnotationRelationDao.RelationSummary -
Field Summary
Fields inherited from class AbstractDao
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindRelatedTerms(Collection<String> seedValueUris, Collection<String> seedValues, AnnotationRelationDao.Direction direction, Set<AnnotationRelationBasis> bases, Collection<String> predicateUris, Long taxonId, Collection<Long> excludedExperimentIds, int maximumObjectBreadth, int maxResults) Set membership: every term related to any of the seeds, with no counting, no ranking and no ambiguity to resolve.The ranked, evidenced read.intremoveByBasis(AnnotationRelationBasis basis, Long experimentId) Remove every derived row for a basis, optionally for one experiment.intremoveByBasis(AnnotationRelationBasis basis, Long experimentId, String source) The same rebuild delete, narrowed to onesource.Methods inherited from class AbstractDao
countAll, create, create, find, findByProperty, findByPropertyIn, findIdByProperty, findOneByProperty, findOrCreate, getBatchSize, getElementClass, getEntityName, getIdentifierPropertyName, getSessionFactory, load, load, loadAll, loadReference, loadReference, reload, reload, remove, remove, save, save, streamAll, streamAll, streamQuery, update, update
-
Constructor Details
-
AnnotationRelationDaoImpl
-
-
Method Details
-
findRelations
public List<AnnotationRelationDao.RelationSummary> findRelations(AnnotationRelationDao.RelationQuery q) Description copied from interface:AnnotationRelationDaoThe ranked, evidenced read. Empty when the query names neither end of the relation.Support is counted here, never stored, so the counts are exact for the calling user's ACL.
- Specified by:
findRelationsin interfaceAnnotationRelationDao
-
findRelatedTerms
public List<String[]> findRelatedTerms(Collection<String> seedValueUris, Collection<String> seedValues, AnnotationRelationDao.Direction direction, Set<AnnotationRelationBasis> bases, Collection<String> predicateUris, @Nullable Long taxonId, Collection<Long> excludedExperimentIds, int maximumObjectBreadth, int maxResults) Description copied from interface:AnnotationRelationDaoSet membership: every term related to any of the seeds, with no counting, no ranking and no ambiguity to resolve.This is the primitive behind query expansion and behind "is this tag already implied?". It is one indexed lookup and has to stay cheap enough to sit on an interactive path.
- Specified by:
findRelatedTermsin interfaceAnnotationRelationDao- Parameters:
seedValueUris- grounded seeds; may be empty ifseedValuesis notseedValues- ungrounded seeds, matched on the value string - ordinary here, since plenty of curated statement objects are free text (aortic bandinghas none)- Returns:
- the related terms, each as
[value, valueUri], the URI possibly null
-
removeByBasis
Description copied from interface:AnnotationRelationDaoRemove every derived row for a basis, optionally for one experiment.Rebuild, not upsert - see
AnnotationRelation. An upsert can only correct rows the new query still produces, so a row whose source annotation was deleted would outlive it.- Specified by:
removeByBasisin interfaceAnnotationRelationDao
-
removeByBasis
public int removeByBasis(AnnotationRelationBasis basis, @Nullable Long experimentId, @Nullable String source) Description copied from interface:AnnotationRelationDaoThe same rebuild delete, narrowed to onesource.AnnotationRelationBasis.ONTOLOGYhas more than one producer — CLO states which disease a cell line came from, CHEBI which roles a chemical bears — and they are loaded and rebuilt independently. Rebuilding one with the basis-wide delete would silently drop the other's rows and leave the table looking like the other producer had never run.- Specified by:
removeByBasisin interfaceAnnotationRelationDao- Parameters:
source- the source to remove, or null for every source under the basis
-