function tripal_update_cvtermpath

2.x tripal_update_cvtermpath($cv_id, $job_id = NULL)

Updates the cvtermpath table of Chado for the specified CV.


$cv_id: The chado cv_id;

$job_id: This function is intended to be used with the Tripal Jobs API. When this function is called as a job the $job_id is automatically passed to this function.

Return value

TRUE on success FALSE on failure

Related topics

2 calls to tripal_update_cvtermpath()
tripal_cv_load_update_cvtermpath in tripal_cv/includes/
A function for executing the cvtermpath function of Chado. This function populates the cvtermpath table of Chado for quick lookup of term relationships
tripal_cv_update_cvtermpath in tripal_cv/api/
1 string reference to 'tripal_update_cvtermpath'


tripal_cv/api/, line 305
This module provides a set of functions to simplify working with controlled vocabularies.


function tripal_update_cvtermpath($cv_id, $job_id = NULL) {
  // TODO: need better error checking in this function

  // first get the controlled vocabulary name:
  $sql = "SELECT * FROM {cv} WHERE cv_id = :cv_id";
  $cv = chado_query($sql, array(':cv_id' => $cv_id))->fetchObject();

  print "\nUpdating cvtermpath for $cv->name...\n";

  $previous = chado_set_active('chado');
  try {
    $sql = "SELECT * FROM fill_cvtermpath(:name)";
    db_query($sql, array(':name' => $cv->name));
  catch (Exception $e) {
    $error = $e->getMessage();
    tripal_report_error('tripal_cv', TRIPAL_ERROR, "Could not fill cvtermpath table: @error", array('@error' => $error));
    return FALSE;

  return TRUE;