Class CharacteristicDaoImpl
- All Implemented Interfaces:
BaseDao<Characteristic>
,BaseVoEnabledDao<Characteristic,
,CharacteristicValueObject> BrowsingDao<Characteristic>
,CharacteristicDao
,FilteringDao<Characteristic>
,FilteringVoEnabledDao<Characteristic,
CharacteristicValueObject>
- Author:
- Luke, Paul
- See Also:
-
Field Summary
Fields inherited from class ubic.gemma.persistence.service.AbstractVoEnabledDao
REPORT_SLOW_QUERY_AFTER_MS
Fields inherited from class ubic.gemma.persistence.service.AbstractDao
log
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbrowse
(int start, int limit) Browse through the characteristics, excluding GO annotations.Browse through the characteristics, excluding GO annotations, with sorting.countByValueUriGroupedByNormalizedValue
(Collection<String> uris, Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents) Count characteristics matching the provided value URIs.protected CharacteristicValueObject
doLoadValueObject
(Characteristic entity) Load a value object for a given entity.findBestByUri
(String uri) Return the characteristic with the most frequently used non-null value by URI.findByCategory
(String value) findByCategoryLike
(String query, Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents, int maxResults) findByCategoryUri
(String uri, Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents, int maxResults) findByParentClasses
(Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents, String category, int maxResults) findByUri
(String uri, String category, Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents, int maxResults) Find characteristics with the given URI.findByValue
(String value) findByValueLike
(String search, String category, Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents, int maxResults) Finds all Characteristics whose value match the given search termfindByValueLikeGroupedByNormalizedValue
(String valueLike, Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents) Find characteristics by value matching the provided LIKE pattern.findByValueUriGroupedByNormalizedValue
(String valueUri, Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents) Find characteristics by URI.Map
<Class<? extends Identifiable>, Map<String, Set<ExpressionExperiment>>> findExperimentReferencesByUris
(Collection<String> uris, Taxon taxon, int limit, boolean rankByLevel) Since proxies are returned, they cannot be collected in aHashSet
which would otherwise cause their initialization by accessingObject.hashCode()
.Map
<Class<? extends Identifiable>, Map<String, Set<ExpressionExperiment>>> findExperimentsByUris
(Collection<String> uris, Taxon taxon, int limit, boolean rankByLevel) This search looks at direct annotations, factor values and biomaterials in that order.Collection
<Class<? extends Identifiable>> Obtain the classes of entities can can own aCharacteristic
.getParents
(Collection<Characteristic> characteristics, Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents) Obtain the parents (i.e. owners) of the given characteristics.Methods inherited from class ubic.gemma.persistence.service.AbstractNoopFilteringVoEnabledDao
count, getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyIsUsingSubquery, getFilterablePropertyType, getSort, load, load, loadIds, loadValueObjects, loadValueObjects
Methods inherited from class ubic.gemma.persistence.service.AbstractVoEnabledDao
doLoadValueObjects, loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIds, postProcessValueObjects
Methods inherited from class ubic.gemma.persistence.service.AbstractDao
countAll, create, create, find, findByProperty, findByPropertyIn, findOneByProperty, findOrCreate, getBatchSize, getElementClass, getIdentifierPropertyName, getSessionFactory, load, load, loadAll, loadReference, loadReference, reload, reload, remove, remove, remove, save, save, streamAll, streamAll, streamQuery, update, update
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ubic.gemma.persistence.service.BaseDao
countAll, create, create, find, findOrCreate, getElementClass, getIdentifierPropertyName, load, load, loadAll, loadReference, loadReference, reload, reload, remove, remove, remove, save, save, streamAll, streamAll, update, update
Methods inherited from interface ubic.gemma.persistence.service.BaseVoEnabledDao
loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIds
Methods inherited from interface ubic.gemma.persistence.service.FilteringDao
count, getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyIsUsingSubquery, getFilterablePropertyType, getSort, load, load, loadIds
Methods inherited from interface ubic.gemma.persistence.service.FilteringVoEnabledDao
loadValueObjects, loadValueObjects
-
Constructor Details
-
CharacteristicDaoImpl
-
-
Method Details
-
browse
Description copied from interface:CharacteristicDao
Browse through the characteristics, excluding GO annotations.- Specified by:
browse
in interfaceBrowsingDao<Characteristic>
- Specified by:
browse
in interfaceCharacteristicDao
- Parameters:
start
- How far into the list to startlimit
- Maximum records to retrieve (might be subject to security filtering)- Returns:
- characteristics
-
browse
Description copied from interface:CharacteristicDao
Browse through the characteristics, excluding GO annotations, with sorting.- Specified by:
browse
in interfaceBrowsingDao<Characteristic>
- Specified by:
browse
in interfaceCharacteristicDao
- Parameters:
start
- query offsetlimit
- maximum amount of entriesorderField
- order fielddescending
- order direction- Returns:
- characteristics
-
findByParentClasses
public Collection<Characteristic> findByParentClasses(@Nullable Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents, @Nullable String category, int maxResults) - Specified by:
findByParentClasses
in interfaceCharacteristicDao
-
findByCategory
- Specified by:
findByCategory
in interfaceCharacteristicDao
-
findByCategoryLike
public Collection<Characteristic> findByCategoryLike(String query, @Nullable Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents, int maxResults) - Specified by:
findByCategoryLike
in interfaceCharacteristicDao
-
findByCategoryUri
public Collection<Characteristic> findByCategoryUri(String uri, @Nullable Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents, int maxResults) - Specified by:
findByCategoryUri
in interfaceCharacteristicDao
-
findExperimentsByUris
public Map<Class<? extends Identifiable>,Map<String, findExperimentsByUrisSet<ExpressionExperiment>>> (Collection<String> uris, @Nullable Taxon taxon, int limit, boolean rankByLevel) Description copied from interface:CharacteristicDao
This search looks at direct annotations, factor values and biomaterials in that order.Resulting EEs are filtered by ACLs.
The returned collection of EEs is effectively a
Set
, but since we cannot use since this should be interchangable withCharacteristicDao.findExperimentReferencesByUris(Collection, Taxon, int, boolean)
.Ranking results by level guarantees correctness if a limit is used as datasets matched by direct annotation will be considered before those matched by factor values or biomaterials. It is however expensive.
- Specified by:
findExperimentsByUris
in interfaceCharacteristicDao
- Parameters:
uris
- collection of URIs used for matching characteristics (viaCharacteristic.getValueUri()
)taxon
- taxon to restrict EEs to, or null to ignorelimit
- limit how many results to return. Set to -1 for no limit.rankByLevel
- rank results by level before limiting, has no effect if limit is -1- Returns:
- map of classes (
ExpressionExperiment
,FactorValue
,BioMaterial
) to the matching URI to EEs which have an associated characteristic using the given URI. The class lets us track where the annotation was.
-
findExperimentReferencesByUris
public Map<Class<? extends Identifiable>,Map<String, findExperimentReferencesByUrisSet<ExpressionExperiment>>> (Collection<String> uris, @Nullable Taxon taxon, int limit, boolean rankByLevel) Since proxies are returned, they cannot be collected in aHashSet
which would otherwise cause their initialization by accessingObject.hashCode()
. Thus we need to create aTreeSet
over the EE IDs.- Specified by:
findExperimentReferencesByUris
in interfaceCharacteristicDao
- See Also:
-
findByUri
public Collection<Characteristic> findByUri(String uri, @Nullable String category, @Nullable Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents, int maxResults) Description copied from interface:CharacteristicDao
Find characteristics with the given URI.- Specified by:
findByUri
in interfaceCharacteristicDao
- Parameters:
category
- restrict the category of the characteristic, or null to ignoreparentClasses
- only return characteristics that have parents of these classes, or null to ignoreincludeNoParents
- include characteristics that have no parentsmaxResults
- maximum number of results to return, or -1 for no limit
-
findBestByUri
Description copied from interface:CharacteristicDao
Return the characteristic with the most frequently used non-null value by URI.- Specified by:
findBestByUri
in interfaceCharacteristicDao
-
findByValueUriGroupedByNormalizedValue
public Map<String,Characteristic> findByValueUriGroupedByNormalizedValue(String valueUri, @Nullable Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents) Description copied from interface:CharacteristicDao
Find characteristics by URI.The mapping key is the normalized value of the characteristics as per
CharacteristicUtils.getNormalizedValue(Characteristic)
.- Specified by:
findByValueUriGroupedByNormalizedValue
in interfaceCharacteristicDao
-
findByValueLikeGroupedByNormalizedValue
public Map<String,Characteristic> findByValueLikeGroupedByNormalizedValue(String valueLike, @Nullable Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents) Description copied from interface:CharacteristicDao
Find characteristics by value matching the provided LIKE pattern.The mapping key is the normalized value of the characteristics as per
CharacteristicUtils.getNormalizedValue(Characteristic)
.- Specified by:
findByValueLikeGroupedByNormalizedValue
in interfaceCharacteristicDao
-
countByValueUriGroupedByNormalizedValue
public Map<String,Long> countByValueUriGroupedByNormalizedValue(Collection<String> uris, @Nullable Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents) Description copied from interface:CharacteristicDao
Count characteristics matching the provided value URIs.The mapping key is the normalized value of the characteristics as per
CharacteristicUtils.getNormalizedValue(Characteristic)
.- Specified by:
countByValueUriGroupedByNormalizedValue
in interfaceCharacteristicDao
-
findByValue
- Specified by:
findByValue
in interfaceCharacteristicDao
-
findByValueLike
public Collection<Characteristic> findByValueLike(String search, @Nullable String category, @Nullable Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents, int maxResults) Description copied from interface:CharacteristicDao
Finds all Characteristics whose value match the given search term- Specified by:
findByValueLike
in interfaceCharacteristicDao
- Parameters:
category
- constraint the category of the characteristic, or null to ignore
-
getParentClasses
Description copied from interface:CharacteristicDao
Obtain the classes of entities can can own aCharacteristic
.- Specified by:
getParentClasses
in interfaceCharacteristicDao
-
getParents
public Map<Characteristic,Identifiable> getParents(Collection<Characteristic> characteristics, @Nullable Collection<Class<? extends Identifiable>> parentClasses, boolean includeNoParents) Description copied from interface:CharacteristicDao
Obtain the parents (i.e. owners) of the given characteristics.- Specified by:
getParents
in interfaceCharacteristicDao
- Parameters:
characteristics
- characteristics to find parents forparentClasses
- restrict the parents to these classes, all parents are returned if null. If supplied, at least one parent must be provided unless includeNoParents is true.includeNoParents
- include characteristics that have no parents, those will be mapped explicitly tonull
.- Returns:
- the supplied characteristics mapped to their parents, or
null
if the characteristic has no parent and includeNoParents is true. A characteristic may not have multiple parents.
-
doLoadValueObject
Description copied from class:AbstractVoEnabledDao
Load a value object for a given entity.This should be fast and efficient, and avoid any database query or post-processing. If you need to perform additional queries, implement
AbstractVoEnabledDao.postProcessValueObjects(List)
instead.- Specified by:
doLoadValueObject
in classAbstractVoEnabledDao<Characteristic,
CharacteristicValueObject>
-