@Unstable
@Role
public interface Vocabulary
Modifier and Type | Method and Description |
---|---|
long |
count(Map<String,?> fieldValues)
Get the number of terms that match a specific query.
|
Set<String> |
getAliases()
A vocabulary has an official name, but it can also have other aliases, for example the Human Phenotype Ontology
is known both as
HP , which is the official prefix for its terms, HPO , which is its acronym, or
the lowercase hpo . |
String |
getCitation()
Get the citation for the vocabulary.
|
String |
getDefaultSourceLocation()
Get the default location where the sources for this vocabulary can be fetched from.
|
long |
getDistance(String fromTermId,
String toTermId)
Find the distance between two terms identified by their
term identifiers , if this
is a structured ontology that supports computing such a distance. |
long |
getDistance(VocabularyTerm fromTerm,
VocabularyTerm toTerm)
Find the distance between two terms, if this is a structured ontology that supports computing such a distance.
|
List<VocabularyExtension> |
getExtensions()
Get the list of
VocabularyExtension s that extend a base vocabulary with additional annotations. |
String |
getIdentifier()
The identifier of the vocabulary, used internally to differentiate between different vocabularies and different
implementations of the same vocabulary.
|
String |
getName()
The official name of the vocabulary.
|
default String |
getSourceLocation()
Get the location where the sources for this vocabulary can be fetched from.
|
default Collection<String> |
getSupportedCategories()
Reports the categories of terms supported by this vocabulary.
|
VocabularyTerm |
getTerm(String id)
Access an individual term from the vocabulary, identified by its
term identifier . |
Set<VocabularyTerm> |
getTerms(Collection<String> ids)
Access a list of terms from the vocabulary, identified by their
term identifiers . |
String |
getVersion()
Get the available version of the vocabulary.
|
String |
getWebsite()
Get the website url for the vocabulary.
|
int |
reindex(String sourceUrl)
Reindex the whole vocabulary, fetching the source from the specified location.
|
List<VocabularyTerm> |
search(Map<String,?> fieldValues)
Generic search method, which looks for terms that match the specified term properties.
|
List<VocabularyTerm> |
search(Map<String,?> fieldValues,
Map<String,String> queryOptions)
Generic search method, which looks for terms that match the specified meta-properties.
|
List<VocabularyTerm> |
search(String input)
Suggest the terms that best match the user's input.
|
List<VocabularyTerm> |
search(String input,
int maxResults,
String sort,
String customFilter)
Suggest the terms that best match the user's input.
|
default List<VocabularyTerm> |
search(String input,
String category,
int maxResults,
String sort,
String customFilter)
Suggest the terms that best match the user's input, in a specific sub-category of this vocabulary.
|
long |
size()
Get the size (i.e.
|
VocabularyTerm getTerm(String id)
term identifier
.id
- the term identifier, in the format <vocabulary prefix>:<term id>
, for example
HP:0002066
null
if the term doesn't exist in this vocabularySet<VocabularyTerm> getTerms(Collection<String> ids)
term identifiers
.ids
- a set of term identifiers, in the format <vocabulary prefix>:<term id>
, for example
HP:0002066
List<VocabularyTerm> search(Map<String,?> fieldValues)
fieldValues
- a map with term property values that must be matched by the returned terms; the keys are
property names, like id
, description
, is_a
, and the values can be either a
single value, or a collection of values that can (OR
) be matched by the termList<VocabularyTerm> search(Map<String,?> fieldValues, Map<String,String> queryOptions)
fieldValues
- a map with term property values that must be matched by the returned terms; the keys are
property names, like id
, description
, is_a
, and the values can be either a
single value, or a collection of values that can (OR
) be matched by the termqueryOptions
- a map with additional query options, such as maximum number of terms to return or a different
sort order; the accepted keys/values depend on the actual implementation details, and usually
correspond to the settings accepted by the storage engine, for example rows -> 10
,
start -> 50
, sort -> nameSort asc
for Solr-indexed vocabulariesList<VocabularyTerm> search(String input)
input
- the text that the user enteredList<VocabularyTerm> search(String input, int maxResults, String sort, String customFilter)
supported categories
, or in a "default" category, depending on the vocabulary
implementation.input
- the text that the user enteredmaxResults
- the maximum number of terms to be returnedsort
- an optional sort parameter, in a format that depends on the actual engine that stores the vocabulary;
usually a property name followed by asc
or desc
; may be null
customFilter
- an optional custom filter query to further restrict which terms may be returned, in a format
that depends on the actual engine that stores the vocabulary; some vocabularies may not support a
filter query; may be null
default List<VocabularyTerm> search(String input, String category, int maxResults, String sort, String customFilter)
input
- the text that the user enteredcategory
- the category of terms to search in, one of the supported
categories
maxResults
- the maximum number of terms to be returnedsort
- an optional sort parameter, in a format that depends on the actual engine that stores the vocabulary;
usually a property name followed by asc
or desc
; may be null
customFilter
- an optional custom filter query to further restrict which terms may be returned, in a format
that depends on the actual engine that stores the vocabulary; some vocabularies may not support a
filter query; may be null
long count(Map<String,?> fieldValues)
fieldValues
- a map with term property values that must be matched by the returned terms; the keys are
property names, like id
, description
, is_a
, and the values can be either a
single value, or a collection of values that can (OR) be matched by the term-1
if the query couldn't be run correctlylong getDistance(String fromTermId, String toTermId)
term identifiers
, if this
is a structured ontology that supports computing such a distance. The parameters are interchangeable.fromTermId
- the identifier of the term that is considered the start pointtoTermId
- the identifier of the term that is considered the end point-1
if this is an unstructured vocabulary, the terms are not connected, or if at least one of the
identifiers is invalidgetDistance(VocabularyTerm, VocabularyTerm)
long getDistance(VocabularyTerm fromTerm, VocabularyTerm toTerm)
fromTerm
- the term that is considered the start pointtoTerm
- the term that is considered the end pointnull
String getIdentifier()
hpo
, omim
, or hgncRemote
String getName()
The Human Phenotype Ontology
Set<String> getAliases()
HP
, which is the official prefix for its terms, HPO
, which is its acronym, or
the lowercase hpo
.default Collection<String> getSupportedCategories()
search(String, String, int, String, String)
method will be called whenever suggestions/matches for a
specify type of terms are requested. If no categories are reported as supported, then this vocabulary must be
used explicitly to search for terms.disorder
, feature
, or feature-qualifier
; may be emptylong size()
int reindex(String sourceUrl)
sourceUrl
- the URL to be indexed0
if the indexing succeeded, 1
if writing to the Solr server failed, 2
if the
specified URL is invalidString getDefaultSourceLocation()
default String getSourceLocation()
String getVersion()
null
if the version cannot be determinedString getWebsite()
String getCitation()
List<VocabularyExtension> getExtensions()
VocabularyExtension
s that extend a base vocabulary with additional annotations.Copyright © 2011–2018 University of Toronto, Computational Biology Lab. All rights reserved.