function tripal_insert_obo

2.x tripal_cv.api.inc tripal_insert_obo($name, $path)
3.x tripal_chado.module.DEPRECATED.api.inc tripal_insert_obo($name, $path)

Add the OBO to the tripal_cv_obo table in the Drupal database.

If the OBO name already exists in the table then the path is updated.

Parameters

$name: The human readable name of this ontology

$path: The file path or URL of the ontology

Return value

Returns the ontology ID

Related topics

11 calls to tripal_insert_obo()
tripal_contact_install in tripal_contact/tripal_contact.install
Implementation of hook_install().
tripal_contact_update_7202 in tripal_contact/tripal_contact.install
Updates path of tripal_contact OBO to be relative.
tripal_cv_add_obo_ref in tripal_cv/api/tripal_cv.DEPRECATED.inc
tripal_cv_install in tripal_cv/tripal_cv.install
Implementation of hook_install().
tripal_cv_load_obo_v1_2_file in tripal_cv/includes/tripal_cv.obo_loader.inc
A wrapper function for importing the user specified OBO file into Chado by specifying the filename and path of the OBO. It requires that the file be in OBO v1.2 compatible format. This function is typically executed via the Tripal jobs management…

... See full list

File

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

Code

function tripal_insert_obo($name, $path) {
  // make sure an OBO with the same name doesn't already exist
  $obo_id = db_select('tripal_cv_obo', 'tco')
    ->fields('tco', array('obo_id'))
    ->condition('name', $name)
    ->execute()
    ->fetchField();

  if ($obo_id) {
    db_update('tripal_cv_obo')
      ->fields(array(
        'path' => $path,
      ))
      ->condition('name', $name)
      ->execute();
    return $obo_id;
  }
  else {
    $obo_id = db_insert('tripal_cv_obo')
      ->fields(array(
        'name' => $name,
        'path' => $path,
      ))
      ->execute();
    return $obo_id;
  }
}