Class AnnotationsWebService
- Author:
- tesarst
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classWire shape forGET /annotations/categories— carries the ontology term info plus a preferred-prefix list per category (config-driven viaannotation.category.prefixes).static classstatic final classA relation on the wire.static final classDiff-and-apply summary returned by the bulk PUT.static classstatic classstatic classGET /annotations/searchenvelope: the standarddataarray plus, when identity matching ran, theAnnotationsWebService.NegativeEvidenceValueObjectbeside it.static final classstatic classRequest body forreplaceDatasetAnnotations(DatasetArg, AnnotationsWebService.AnnotationsReplaceRequest): the full desired tag set plus an optionalannotationSetIdto attach to emitted audit events (linkage is parked until the source-AnnotationSet → emitted-event audit link lands — seeSTATUS_PUT_DATASETS_DESIGN.md).static classOne row of the canonicalization table: the URI as stored, and the URI Gemma reports instead.static final classA single representative usage of a searched term, for showing a hit in context.static classWhat an external naming authority says a query string is, when nothing Gemma has loaded names it — plus enough provenance to check the claim.static final classWire shape forLexicalTermMetadata.static enumJSON-friendly enumeration of which Lucene field produced a hit.static classstatic final classstatic final classA single synonym of an ontology term plus its scope.static final classstatic classA term prior curators chose for the query string, with the number of distinct experiments they chose it on.static classOne term that was retrieved for the query and rejected as not naming it.static final classWhat the ontology says about this term's species applicability.static final classAn organism an entry derives from. -
Constructor Summary
ConstructorsConstructorDescriptionRequired by springAnnotationsWebService(OntologyService ontologyService, SearchService searchService, CharacteristicService characteristicService, ExpressionExperimentService expressionExperimentService, DatasetArgService datasetArgService, TaxonArgService taxonArgService) Back-compat constructor for tests that wire only the core collaborators.AnnotationsWebService(OntologyService ontologyService, SearchService searchService, CharacteristicService characteristicService, ExpressionExperimentService expressionExperimentService, DatasetArgService datasetArgService, TaxonArgService taxonArgService, GeneService geneService, Map<String, AnnotationSearchRankingStrategy> rankingStrategies) Constructor for service autowiring -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseaddDatasetAnnotation(DatasetArg<?> datasetArg, AnnotationsWebService.AnnotationDto body, Long annotationSetId) List the ontology categories allowed for use in characteristics.List the ontology predicates allowed for use in statements.getAnnotationRelations(String subject, String object, String predicate, String subjectCategory, String objectCategory, String basis, Long datasetId, String seedDirection, Long taxonId, String excludeDatasets, int minSupport, double minSpecificity, boolean includeExperimentLevel, int maxObjectBreadth, int maxSubjectBreadth, boolean includeRefuted, boolean includeCellTypeSubjects, int limit) Relations Gemma knows between annotation terms, with the basis for each.getAnnotationsChildren(String termUri, boolean direct) Obtain the children of a given annotation.getAnnotationsParents(String termUri, boolean direct) getAnnotationTerm(String termUri, boolean includeCitationXrefs) getCanonicalUris(String uri) Every URI Gemma resolves to a different one on read, so a caller can hold the same answer we do instead of a hand-copied subset of it.getImpliedAnnotations(String from, String to, String excludeDatasets, String basis, Long taxonId, int maxObjectBreadth, boolean includeExperimentLevel, int limit) Is a term already implied by the terms an experiment carries?jakarta.ws.rs.core.ResponseremoveDatasetAnnotation(DatasetArg<?> datasetArg, Long annotationId) replaceDatasetAnnotations(DatasetArg<?> datasetArg, AnnotationsWebService.AnnotationsReplaceRequest body) searchAnnotations(StringArrayArg query, String rank, int limit, String prefixesParam, boolean upstream, boolean exactLabel, boolean exactLabelLegacy, String category, boolean suppressNearMatches, boolean suppressNearMatchesLegacy, TaxonArg<?> taxonArg, boolean includeGeneCount, int geneCountMaxTerms, boolean includeGenes, boolean includeExampleUsage, String excludeExperiments, boolean includePriorCuration) Does a search for annotation tags based on the given string.searchDatasets(StringArrayArg query, FilterArg<ExpressionExperiment> filterArg, OffsetArg offset, LimitArg limit, SortArg<ExpressionExperiment> sortArg) Does a search for datasets containing characteristics matching the given string.searchDatasetsByQueryInPath(StringArrayArg query, FilterArg<ExpressionExperiment> filterArg, OffsetArg offset, LimitArg limit, SortArg<ExpressionExperiment> sortArg) searchTaxonDatasets(TaxonArg<?> taxonArg, StringArrayArg query, FilterArg<ExpressionExperiment> filter, OffsetArg offset, LimitArg limit, SortArg<ExpressionExperiment> sort) Same assearchDatasets(StringArrayArg, FilterArg, OffsetArg, LimitArg, SortArg)but also filters by taxon.searchTaxonDatasetsByQueryInPath(TaxonArg<?> taxonArg, StringArrayArg query, FilterArg<ExpressionExperiment> filter, OffsetArg offset, LimitArg limit, SortArg<ExpressionExperiment> sort)
-
Constructor Details
-
AnnotationsWebService
public AnnotationsWebService()Required by spring -
AnnotationsWebService
@Autowired public AnnotationsWebService(OntologyService ontologyService, SearchService searchService, CharacteristicService characteristicService, ExpressionExperimentService expressionExperimentService, DatasetArgService datasetArgService, TaxonArgService taxonArgService, GeneService geneService, @Nullable Map<String, AnnotationSearchRankingStrategy> rankingStrategies) Constructor for service autowiring -
AnnotationsWebService
public AnnotationsWebService(OntologyService ontologyService, SearchService searchService, CharacteristicService characteristicService, ExpressionExperimentService expressionExperimentService, DatasetArgService datasetArgService, TaxonArgService taxonArgService) Back-compat constructor for tests that wire only the core collaborators. Equivalent to passingnullforrankingStrategies.
-
-
Method Details
-
getAnnotationsParents
@GET @Path("/parents") @Produces("application/json") public ResponseDataObject<List<AnnotationsWebService.AnnotationSearchResultValueObject>> getAnnotationsParents(@QueryParam("uri") String termUri, @QueryParam("direct") @DefaultValue("false") boolean direct) -
getAnnotationsChildren
@GET @Path("/children") @Produces("application/json") public ResponseDataObject<List<AnnotationsWebService.AnnotationSearchResultValueObject>> getAnnotationsChildren(@QueryParam("uri") String termUri, @QueryParam("direct") @DefaultValue("false") boolean direct) Obtain the children of a given annotation.This is plural as we might add support for querying multiple annotations at once in the future.
-
getCanonicalUris
@GET @Path("/canonicalUris") @Produces("application/json") public ResponseDataObject<List<AnnotationsWebService.CanonicalUriValueObject>> getCanonicalUris(@QueryParam("uri") @Nullable String uri) Every URI Gemma resolves to a different one on read, so a caller can hold the same answer we do instead of a hand-copied subset of it. -
getAnnotationTerm
@GET @Path("/term") @Produces("application/json") public ResponseDataObject<AnnotationsWebService.OntologyTermValueObject> getAnnotationTerm(@QueryParam("uri") String termUri, @QueryParam("includeCitationXrefs") @DefaultValue("false") boolean includeCitationXrefs) -
getAnnotationCategories
@GET @Path("/categories") @Produces("application/json") public ResponseDataObject<List<AnnotationsWebService.AnnotationCategoryValueObject>> getAnnotationCategories()List the ontology categories allowed for use in characteristics. -
getAnnotationPredicates
@GET @Path("/predicates") @Produces("application/json") public ResponseDataObject<List<AnnotationsWebService.OntologyTermSimpleValueObject>> getAnnotationPredicates()List the ontology predicates allowed for use in statements. -
getAnnotationRelations
@GET @Path("/relations") @Produces("application/json") public ResponseDataObject<List<AnnotationsWebService.AnnotationRelationValueObject>> getAnnotationRelations(@QueryParam("subject") @Nullable String subject, @QueryParam("object") @Nullable String object, @QueryParam("predicate") @Nullable String predicate, @QueryParam("subjectCategory") @Nullable String subjectCategory, @QueryParam("objectCategory") @Nullable String objectCategory, @QueryParam("basis") @Nullable String basis, @QueryParam("dataset") @Nullable Long datasetId, @QueryParam("seedDirection") @DefaultValue("OBJECT_TO_SUBJECT") String seedDirection, @QueryParam("taxonId") @Nullable Long taxonId, @QueryParam("excludeDatasets") @Nullable String excludeDatasets, @QueryParam("minSupport") @DefaultValue("0") int minSupport, @QueryParam("minSpecificity") @DefaultValue("0") double minSpecificity, @QueryParam("includeExperimentLevel") @DefaultValue("false") boolean includeExperimentLevel, @QueryParam("maxObjectBreadth") @DefaultValue("0") int maxObjectBreadth, @QueryParam("maxSubjectBreadth") @DefaultValue("-1") int maxSubjectBreadth, @QueryParam("includeRefuted") @DefaultValue("false") boolean includeRefuted, @QueryParam("includeCellTypeSubjects") @DefaultValue("false") boolean includeCellTypeSubjects, @QueryParam("limit") @DefaultValue("50") int limit) Relations Gemma knows between annotation terms, with the basis for each.Generic on purpose. "Which genotypes stand for Leigh syndrome?" and "which anatomical part does this cell line come from?" are the same query with different terms in it, so there is one endpoint rather than one per relation kind.
Ask it from either end.
subjectandobjectboth accept a term, and the row means the same thing whichever end seeded it. -
getImpliedAnnotations
@GET @Path("/relations/implies") @Produces("application/json") public ResponseDataObject<List<AnnotationsWebService.AnnotationRelationValueObject>> getImpliedAnnotations(@QueryParam("from") @Nullable String from, @QueryParam("to") @Nullable String to, @QueryParam("excludeDatasets") @Nullable String excludeDatasets, @QueryParam("basis") @Nullable String basis, @QueryParam("taxonId") @Nullable Long taxonId, @QueryParam("maxObjectBreadth") @DefaultValue("0") int maxObjectBreadth, @QueryParam("includeExperimentLevel") @DefaultValue("false") boolean includeExperimentLevel, @QueryParam("limit") @DefaultValue("100") int limit) Is a term already implied by the terms an experiment carries?The inhibition question, and it is deliberately not the same endpoint as
/annotations/relations. That one ranks and evidences, for a caller that has to CHOOSE a term; this one tests set membership, for a caller deciding whether to SUPPRESS one it was about to write. The distinction is what makes using this knowledge safe at all:- Generating a disease from a genotype needs a unique answer.
SURF1carries three germline disease axioms andTrp53pairs with fifteen diseases in our corpus, so a producer asked to emit one has to pick, and picking wrong writes a false assertion into the database. This is why the curation rule forbids it. - Suppressing a redundant tag needs only membership. All three of SURF1's diseases go into the set, and the answer is right whichever one is meant.
It also fails in the safe direction. A wrong association here suppresses a tag that should have been kept -- a recall miss, visible in scoring and recoverable. The same wrong association used generatively writes a wrong disease onto a dataset.
- Generating a disease from a genotype needs a unique answer.
-
searchAnnotations
@GET @Path("/search") @Produces("application/json") public AnnotationsWebService.AnnotationSearchResponseDataObject searchAnnotations(@QueryParam("query") @DefaultValue("") StringArrayArg query, @QueryParam("rank") @DefaultValue("lucene") String rank, @QueryParam("limit") @DefaultValue("20") int limit, @QueryParam("prefixes") @DefaultValue("") String prefixesParam, @QueryParam("upstream") @DefaultValue("false") boolean upstream, @QueryParam("exactLabel") @DefaultValue("false") boolean exactLabel, @QueryParam("exact_label") @DefaultValue("false") boolean exactLabelLegacy, @QueryParam("category") @DefaultValue("") String category, @QueryParam("suppressNearMatches") @DefaultValue("false") boolean suppressNearMatches, @QueryParam("suppress_near_matches") @DefaultValue("false") boolean suppressNearMatchesLegacy, @QueryParam("taxon") @Nullable TaxonArg<?> taxonArg, @QueryParam("includeGeneCount") @DefaultValue("false") boolean includeGeneCount, @QueryParam("geneCountMaxTerms") @DefaultValue("50") int geneCountMaxTerms, @QueryParam("includeGenes") @DefaultValue("true") boolean includeGenes, @QueryParam("includeExampleUsage") @DefaultValue("false") boolean includeExampleUsage, @QueryParam("excludeExperiments") @Nullable String excludeExperiments, @QueryParam("includePriorCuration") @DefaultValue("false") boolean includePriorCuration) Does a search for annotation tags based on the given string.- Parameters:
query- the search query. Either plain text, or an ontology term URI- Returns:
- response data object with a collection of found terms, each wrapped in a CharacteristicValueObject.
- See Also:
-
searchAnnotationsBatch
@POST @Path("/search/batch") @Consumes("application/json") @Produces("application/json") public ResponseDataObject<List<AnnotationsWebService.AnnotationSearchBatchResultValueObject>> searchAnnotationsBatch(@Nullable AnnotationsWebService.AnnotationSearchBatchRequest body) -
searchAnnotationsByPathQuery
@GET @Path("/search/{query}") @Produces("application/json") public ResponseDataObject<List<AnnotationsWebService.AnnotationSearchResultValueObject>> searchAnnotationsByPathQuery(@PathParam("query") @DefaultValue("") StringArrayArg query) - See Also:
-
searchDatasets
@GET @Path("/search/datasets") @Produces("application/json") public QueriedAndFilteredAndPaginatedResponseDataObject<ExpressionExperimentValueObject> searchDatasets(@QueryParam("query") @DefaultValue("") StringArrayArg query, @QueryParam("filter") @DefaultValue("") FilterArg<ExpressionExperiment> filterArg, @QueryParam("offset") @DefaultValue("0") OffsetArg offset, @QueryParam("limit") @DefaultValue("20") LimitArg limit, @QueryParam("sort") @DefaultValue("+id") SortArg<ExpressionExperiment> sortArg) Does a search for datasets containing characteristics matching the given string. If filterArg, offset, limit or sortArg parameters are provided.- Parameters:
query- the search query. Either plain text, or an ontology term URI- Returns:
- response data object with a collection of dataset that match the search query.
- See Also:
-
searchDatasetsByQueryInPath
@GET @Path("/search/{query}/datasets") @Produces("application/json") public QueriedAndFilteredAndPaginatedResponseDataObject<ExpressionExperimentValueObject> searchDatasetsByQueryInPath(@PathParam("query") @DefaultValue("") StringArrayArg query, @QueryParam("filter") @DefaultValue("") FilterArg<ExpressionExperiment> filterArg, @QueryParam("offset") @DefaultValue("0") OffsetArg offset, @QueryParam("limit") @DefaultValue("20") LimitArg limit, @QueryParam("sort") @DefaultValue("+id") SortArg<ExpressionExperiment> sortArg) -
searchTaxonDatasets
@GET @Path("/{taxon}/search/datasets") @Produces("application/json") public QueriedAndFilteredAndPaginatedResponseDataObject<ExpressionExperimentValueObject> searchTaxonDatasets(@PathParam("taxon") TaxonArg<?> taxonArg, @QueryParam("query") @DefaultValue("") StringArrayArg query, @QueryParam("filter") @DefaultValue("") FilterArg<ExpressionExperiment> filter, @QueryParam("offset") @DefaultValue("0") OffsetArg offset, @QueryParam("limit") @DefaultValue("20") LimitArg limit, @QueryParam("sort") @DefaultValue("+id") SortArg<ExpressionExperiment> sort) Same assearchDatasets(StringArrayArg, FilterArg, OffsetArg, LimitArg, SortArg)but also filters by taxon. -
searchTaxonDatasetsByQueryInPath
@GET @Path("/{taxon}/search/{query}/datasets") @Produces("application/json") public QueriedAndFilteredAndPaginatedResponseDataObject<ExpressionExperimentValueObject> searchTaxonDatasetsByQueryInPath(@PathParam("taxon") TaxonArg<?> taxonArg, @PathParam("query") @DefaultValue("") StringArrayArg query, @QueryParam("filter") @DefaultValue("") FilterArg<ExpressionExperiment> filter, @QueryParam("offset") @DefaultValue("0") OffsetArg offset, @QueryParam("limit") @DefaultValue("20") LimitArg limit, @QueryParam("sort") @DefaultValue("+id") SortArg<ExpressionExperiment> sort) - See Also:
-
addDatasetAnnotation
@POST @Path("/datasets/{dataset}/annotations") @Consumes("application/json") @Produces("application/json") @PreAuthorize("hasAuthority('GROUP_CURATOR') or hasAuthority('GROUP_ADMIN')") public jakarta.ws.rs.core.Response addDatasetAnnotation(@PathParam("dataset") DatasetArg<?> datasetArg, @Nullable AnnotationsWebService.AnnotationDto body, @QueryParam("annotationSetId") @Nullable Long annotationSetId) -
removeDatasetAnnotation
@DELETE @Path("/datasets/{dataset}/annotations/{annotationId}") @Produces("application/json") @PreAuthorize("hasAuthority('GROUP_CURATOR') or hasAuthority('GROUP_ADMIN')") public jakarta.ws.rs.core.Response removeDatasetAnnotation(@PathParam("dataset") DatasetArg<?> datasetArg, @PathParam("annotationId") Long annotationId) -
replaceDatasetAnnotations
@PUT @Path("/datasets/{dataset}/annotations") @Consumes("application/json") @Produces("application/json") @PreAuthorize("hasAuthority('GROUP_CURATOR') or hasAuthority('GROUP_ADMIN')") public ResponseDataObject<AnnotationsWebService.AnnotationReplaceReport> replaceDatasetAnnotations(@PathParam("dataset") DatasetArg<?> datasetArg, @Nullable AnnotationsWebService.AnnotationsReplaceRequest body)
-