function tripal_get_vocabulary_details

3.x tripal.terms.api.inc tripal_get_vocabulary_details($vocabulary)

Retrieves full information about a vocabulary.

Vocabularies are stored in a database backend. Tripal has no requirements for how terms are stored. By default, the tripal_chado modules provides storage for vocabularies and terms. This function will call the hook_vocab_get_term() function for the database backend that is housing the vocabularies and allow it to return the details about the term.

Parameters

$vocabulary: The vocabulary of the vocabulary in which the term is found.

Return value

An array with at least 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: A URL for the online resources for the vocabulary.
  • urlprefix: 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.
  • sw_url: The URL for mapping terms via the semantic web.
  • num_terms: The number of terms loaded in the vocabulary.

Related topics

6 calls to tripal_get_vocabulary_details()
TripalContentService_v0_1::addDocBundleCollectionClass in tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc
Every content type (bundle) needs a collection class in the documentation.
TripalContentService_v0_1::addDocContentCollectionClass in tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc
Adds the content collection class to the document for this service.
TripalWebServiceResource::__construct in tripal_ws/includes/TripalWebServiceResource.inc
Implements the constructor.
tripal_vocabulary_lookup_vocab_page in tripal/includes/tripal.term_lookup.inc
Provides the content for a single controlled vocabulary.
tripal_ws_get_services in tripal_ws/tripal_ws.module
The callback function for all RESTful web services.

... See full list

File

tripal/api/tripal.terms.api.inc, line 488
Provides an application programming interface (API) for working with controlled vocaublary terms.

Code

function tripal_get_vocabulary_details($vocabulary) {
  // 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_vocabulary';
    if (function_exists($function)) {
      return $function($vocabulary);
    }
  }
}