function tripal_get_term_details
3.x tripal.terms.api.inc | tripal_get_term_details($vocabulary, $accession) |
Retrieves full information about a vocabulary term.
Parameters
$vocabulary: The vocabulary of the vocabulary in which the term is found.
$accession: The unique identifier (accession) for this term.
Return value
An array with at least the following keys:
- vocabulary : An array containing the following keys:
- name : The full name of the vocabulary.
- short_name : The short name abbreviation for the vocabulary.
- description : A brief description of the vocabulary.
- url : (optional) A URL for the online resources for the vocabulary.
- urlprefix : (optional) A URL to which the short_name and term accession can be appended to form a complete URL for a term. If the prefix does not support appending then the exact location for the position of the short_name and the term accession will be specified with the {db} and {accession} tags respectively.
- accession : The name unique ID of the term.
- url : The URL for the term.
- name : The name of the term.
- definition : The term's description.
any other keys may be added as desired. Returns NULL if the term cannot be found.
Related topics
21 calls to tripal_get_term_details()
- TripalContentService_v0_1::addEntityField in tripal_ws/
includes/ TripalWebService/ TripalContentService_v0_1.inc - Adds the field as a property of the entity resource.
- TripalContentService_v0_1::addEntityFields in tripal_ws/
includes/ TripalWebService/ TripalContentService_v0_1.inc - Adds the fields as properties of an entity resource.
- TripalContentService_v0_1::doContentTypesList in tripal_ws/
includes/ TripalWebService/ TripalContentService_v0_1.inc - Creates a resources that contains the list of content types.
- TripalContentService_v0_1::doEntity in tripal_ws/
includes/ TripalWebService/ TripalContentService_v0_1.inc - Creates a resource for a single entity.
- TripalContentService_v0_1::doEntityList in tripal_ws/
includes/ TripalWebService/ TripalContentService_v0_1.inc - Creates a collection of resources for a given type.
File
- tripal/
api/ tripal.terms.api.inc, line 377 - Provides an application programming interface (API) for working with controlled vocaublary terms.
Code
function tripal_get_term_details($vocabulary, $accession) {
if (empty($vocabulary) OR empty($accession)) {
tripal_report_error('tripal_term', TRIPAL_ERROR, "Unable to retrieve details for term due to missing vocabulary and/or accession");
}
// TODO: we need some sort of administrative interface that lets the user
// switch to the desired vocabulary type. For now, we'll just use the
// first one in the list.
$stores = module_invoke_all('vocab_storage_info');
if (is_array($stores) and count($stores) > 0) {
$keys = array_keys($stores);
$module = $stores[$keys[0]]['module'];
$function = $module . '_vocab_get_term';
if (function_exists($function)) {
return $function($vocabulary, $accession);
}
}
}