Browse Source

API Update: updated all modules to use the CV API

Lacey Sanderson 10 years ago
parent
commit
d7e312dfa4

+ 29 - 13
tripal_analysis/tripal_analysis.install

@@ -124,32 +124,48 @@ function tripal_analysis_add_cvs() {
  */
 function tripal_analysis_add_cvterms() {
 
-  tripal_cv_add_cv('tripal_analysis', 'Terms used for managing analyses in Tripal');
+  tripal_insert_cv('tripal_analysis', 'Terms used for managing analyses in Tripal');
 
   // add analysis_date.  This is no longer used (as far as we can tell) but we don't
   // get rid of it in case it is used, so just keep it in the Tripal CV
-  $term = array(
-    'name' => 'analysis_date',
-    'def' => 'The date that an analysis was performed.'
+  tripal_insert_cvterm(
+    array(
+      'name' => 'analysis_date',
+      'def' => 'The date that an analysis was performed.',
+      'cv_name' => 'tripal',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
   );
-  tripal_cv_add_cvterm($term, 'tripal', 0, 1, 'tripal');
 
   // add analysis_short_name.  This is no longer used (as far as we can tell) but we don't
   // get rid of it in case it is used, so just keep it in the Tripal CV
-  $term = array(
-    'name' => 'analysis_short_name',
-    'def' => 'A computer legible (no spaces or special characters) abbreviation for the analysis.'
+  tripal_insert_cvterm(
+    array(
+      'name' => 'analysis_short_name',
+      'def' => 'A computer legible (no spaces or special characters) '
+        . 'abbreviation for the analysis.',
+      'cv_name' => 'tripal',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
   );
-  tripal_cv_add_cvterm($term, 'tripal', 0, 1 , 'tripal');
 
 
   // the 'analysis_property' vocabulary is for user definable properties wo we
   // will add an 'Analysis Type' to this vocubulary
-  $term = array(
-    'name' => 'Analysis Type',
-    'def' => 'The type of analysis that was performed.'
+  tripal_insert_cvterm(
+    array(
+      'name' => 'Analysis Type',
+      'def' => 'The type of analysis that was performed.',
+      'cv_name' => 'analysis_property',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
   );
-  tripal_cv_add_cvterm($term, 'analysis_property', 0, 1, 'tripal');
 }
 
 /**

+ 4 - 1
tripal_contact/api/tripal_contact.api.inc

@@ -46,7 +46,10 @@ function tripal_insert_contact($values) {
   $contact = chado_select_record('contact', array('contact_id'), $values, $options);
 
   if (count($contact) == 0) {
-    $cvterm = tripal_cv_get_cvterm_by_name($type, NULL, 'tripal_contact');
+    $cvterm = tripal_get_cvterm(array(
+      'name' => $type,
+      'cv_id' => array('name' => 'tripal_contact')
+    ));
     if (!$cvterm) {
       tripal_report_error('tripal_contact', TRIPAL_ERROR, "Cannot find contact type '%type'",
         array('%type' => $type));

+ 12 - 6
tripal_contact/includes/tripal_contact.chado_node.inc

@@ -388,7 +388,10 @@ function chado_contact_insert($node) {
 
       // Add the description property
     $properties = chado_retrieve_node_form_properties($node);
-    $contact_descrip_id = tripal_cv_get_cvterm_by_name('contact_description', NULL, 'tripal_contact');
+    $contact_descrip_id = tripal_get_cvterm(array(
+      'name' => 'contact_description',
+      'cv_id' => array('name' =>  'tripal_contact')
+    ));
     $properties[$contact_descrip_id->cvterm_id][0] = $node->description;
 
     // * Properties Form *
@@ -462,7 +465,10 @@ function chado_contact_update($node) {
 
   // Add the description property
   $properties = chado_retrieve_node_form_properties($node);
-  $contact_descrip_id = tripal_cv_get_cvterm_by_name('contact_description', NULL, 'tripal_contact');
+  $contact_descrip_id = tripal_get_cvterm(array(
+    'name' => 'contact_description',
+    'cv_id' => array('name' => 'tripal_contact')
+  ));
   $properties[$contact_descrip_id->cvterm_id][0] = $node->description;
 
   // now add in the properties by first removing any the contact
@@ -649,12 +655,12 @@ function tripal_contact_node_insert($node) {
 
       // find the contact and add in the details
       $contact_id = chado_get_id_from_nid('contact', $node->nid);
-     
+
       // get the contact
       $values = array('contact_id' => $contact_id);
       $contact = chado_generate_var('contact', $values);
       $node->contact = $contact;
-      
+
       // Now get the title
       $node->title = chado_get_node_title($node);
 
@@ -675,12 +681,12 @@ function tripal_contact_node_update($node) {
 
       // find the contact and add in the details
       $contact_id = chado_get_id_from_nid('contact', $node->nid);
-       
+
       // get the contact
       $values = array('contact_id' => $contact_id);
       $contact = chado_generate_var('contact', $values);
       $node->contact = $contact;
-      
+
       // Now get the title
       $node->title = chado_get_node_title($node);
 

+ 6 - 6
tripal_contact/tripal_contact.install

@@ -59,8 +59,8 @@ function tripal_contact_install() {
 
   // add loading of the the tripal contact ontology to the job queue
   $obo_path = drupal_realpath(drupal_get_path('module', 'tripal_contact') . '/files/tcontact.obo');
-  $obo_id = tripal_cv_add_obo_ref('Tripal Contacts', $obo_path);
-  tripal_cv_submit_obo_job($obo_id);
+  $obo_id = tripal_insert_obo('Tripal Contacts', $obo_path);
+  tripal_submit_obo_job(array('ob_id' => $obo_id));
 
   // Add cvterms for relationship types
   tripal_contact_add_cvs();
@@ -96,26 +96,26 @@ function tripal_contact_add_cvs() {
 
   // Add the cv for contact properties. This is a default vocabulary in the event
   // that a user does not want to use the tripal_contact vocabulary
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'contact_property',
     'Contains properties for contacts. This can be used if the tripal_contact vocabulary (which is default for contacts in Tripal) is not desired.'
   );
 
   // add the cv for the contact type. This is a default vocabulary in the event
   // that a user does not want to use the tripal_contact vocabulary
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'contact_type',
     'Contains types of contacts. This can be used if the tripal_contact vocabulary (which is default for contacts in Tripal) is not desired.'
   );
 
   // Add the cv for the tripal_contact vocabulary which is loaded via the OBO
-  tripal_cv_add_cv(
+  tripal_insert_cv(
    'tripal_contact',
    'A heirarchical set of terms for describing a contact. It is intended to be used as the default vocabularies in Tripal for contact types and contact properties.'
   );
 
   // add the cv for contact relationships
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'contact_relationship',
     'Contains types of relationships between contacts.'
   );

+ 2 - 2
tripal_cv/api/tripal_cv.api.inc

@@ -523,9 +523,9 @@ function tripal_insert_cvterm($term, $options = array()) {
   }
 
   // make sure the CV name exists
-  $cv = tripal_cv_get_cv_by_name($cvname);
+  $cv = tripal_get_cv(array('name' => $cvname));
   if (!$cv) {
-    $cv = tripal_cv_add_cv($cvname, '');
+    $cv = tripal_insert_cv($cvname, '');
   }
   if (!$cv) {
     tripal_report_error('tripal_cv', TRIPAL_WARNING, "Cannot find namespace '$cvname' when adding/updating $id", NULL);

+ 9 - 3
tripal_cv/includes/tripal_cv.cvterm_form.inc

@@ -378,11 +378,14 @@ function tripal_cv_cvterm_edit_form_submit($form, &$form_state) {
           'name' => $name,
           'namespace' => $cv->name,
           'id' => $accession,
-          'def' => $definition,
+          'definition' => $definition,
           'is_obsolete' => $is_obsolete,
+          'cv_name' => $cv->name,
+          'is_relationship' => $is_relationship,
+          'db_name' => $db_name
         );
 
-        $cvterm = tripal_cv_add_cvterm($term, $cv->name, $is_relationship, TRUE, $db->name);
+        $cvterm = tripal_insert_cvterm($term, array('update_existing' => TRUE));
         if ($cvterm) {
           drupal_set_message('Term updated successfully.');
         }
@@ -436,9 +439,12 @@ function tripal_cv_cvterm_add_form_submit($form, &$form_state) {
     'id' => $accession,
     'def' => $definition,
     'is_obsolete' => $is_obsolete,
+    'cv_name' => $cv->name,
+    'is_relationship' => $is_relationship,
+    'db_name' => $db->name
   );
 
-  $cvterm = tripal_cv_add_cvterm($term, $cv->name, $is_relationship, TRUE, $db->name);
+  $cvterm = tripal_insert_cvterm($term, array('update_existing' => TRUE));
   if ($cvterm) {
     drupal_set_message('Term added successfully.');
   }

+ 39 - 15
tripal_cv/includes/tripal_cv.obo_loader.inc

@@ -119,7 +119,12 @@ function tripal_cv_obo_form_submit($form, &$form_state) {
   $obo_url   = trim($form_state['values']['obo_url']);
   $obo_file  = trim($form_state['values']['obo_file']);
 
-  tripal_cv_submit_obo_job($obo_id, $obo_name, $obo_url, $obo_file);
+  tripal_submit_obo_job(array(
+    'ob_id' => $obo_id,
+    'name' => $obo_name,
+    'url' => $obo_url,
+    'file' => $obo_file
+  ));
 }
 
 /**
@@ -187,7 +192,7 @@ function tripal_cv_load_obo_v1_2_file($obo_name, $file, $jobid = NULL, $is_new =
   $newcvs = array();
 
   if ($is_new) {
-    tripal_cv_add_obo_ref($obo_name, $file);
+    tripal_insert_obo($obo_name, $file);
   }
 
   $success = tripal_cv_load_obo_v1_2($file, $jobid, $newcvs);
@@ -238,7 +243,7 @@ function tripal_cv_load_obo_v1_2_url($obo_name, $url, $jobid = NULL, $is_new = T
   fclose($obo_fh);
 
   if ($is_new) {
-    tripal_cv_add_obo_ref($obo_name, $url);
+    tripal_insert_obo($obo_name, $url);
   }
 
   // second, parse the OBO
@@ -270,7 +275,7 @@ function tripal_cv_load_update_cvtermpath($newcvs, $jobid) {
 
   print "\nUpdating cvtermpath table.  This may take a while...\n";
   foreach ($newcvs as $namespace => $cvid) {
-    tripal_cv_update_cvtermpath($cvid, $jobid);
+    tripal_update_cvtermpath($cvid, $jobid);
   }
 }
 
@@ -327,7 +332,7 @@ function tripal_cv_load_obo_v1_2($file, $jobid = NULL, &$newcvs) {
     // present for each stanza.  Some ontologies have adopted the v1.4 method
     // in their v1.2 files and not including it.
     if (array_key_exists('default-namespace', $header)) {
-      $defaultcv = tripal_cv_add_cv($header['default-namespace'][0], '');
+      $defaultcv = tripal_insert_cv($header['default-namespace'][0], '');
       if (!$defaultcv) {
         tripal_cv_obo_quiterror('Cannot add namespace ' . $header['default-namespace'][0]);
       }
@@ -339,14 +344,14 @@ function tripal_cv_load_obo_v1_2($file, $jobid = NULL, &$newcvs) {
       // look to see if an 'ontology' key is present.  It is part of the v1.4
       // specification so it shouldn't be in the file, but just in case
       if (array_key_exists('ontology', $header)) {
-        $defaultcv = tripal_cv_add_cv(strtoupper($header['ontology'][0]), '');
+        $defaultcv = tripal_insert_cv(strtoupper($header['ontology'][0]), '');
         if (!$defaultcv) {
           tripal_cv_obo_quiterror('Cannot add namespace ' . strtoupper($header['ontology'][0]));
         }
         $newcvs[strtoupper(strtoupper($header['ontology'][0]))] = $defaultcv->cv_id;
       }
       else {
-        $defaultcv = tripal_cv_add_cv('_global', '');
+        $defaultcv = tripal_insert_cv('_global', '');
         $newcvs['_global'] = $defaultcv->cv_id;
       }
       watchdog('t_obo_loader', "This OBO is missing the 'default-namespace' header. It is not possible to determine which vocabulary terms without a 'namespace' key should go.  Instead, those terms will be placed in the '%vocab' vocabulary.",
@@ -566,8 +571,12 @@ function tripal_cv_obo_process_term($term, $defaultcv, $is_relationship = 0, &$n
     $t['is_obsolete'] = $term['is_obsolete'][0];
   }
 
+  $t['cv_name'] = $defaultcv;
+  $t['is_relationship'] = $is_relationship;
+  $t['db_name'] = $default_db;
+
   // add the cvterm
-  $cvterm = tripal_cv_add_cvterm($t, $defaultcv, $is_relationship, 1, $default_db);
+  $cvterm = tripal_insert_cvterm($t, array('update_existing' => TRUE));
   if (!$cvterm) {
     tripal_cv_obo_quiterror("Cannot add the term " . $term['id'][0]);
   }
@@ -731,8 +740,11 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
     'id' => "$default_db:$rel",
     'definition' => '',
     'is_obsolete' => 0,
+    'cv_name' => $defaultcv,
+    'is_relationship' => TRUE,
+    'db_naame' => $default_db
   );
-  $relcvterm = tripal_cv_add_cvterm($term, $defaultcv, 1, 0, $default_db);
+  $relcvterm = tripal_insert_cvterm($term, array('update_existing' => FALSE));
 
   if (!$relcvterm) {
     // if the relationship term couldn't be found in the default_db provided
@@ -742,8 +754,11 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
       'id' => "OBO_REL:$rel",
       'definition' => '',
       'is_obsolete' => 0,
+      'cv_name' => $defaultcv,
+      'is_relationship' => TRUE,
+      'db_name' => 'OBO_REL'
     );
-    $relcvterm = tripal_cv_add_cvterm($term, $defaultcv, 1, 0, 'OBO_REL');
+    $relcvterm = tripal_insert_cvterm($term, array('update_existing' => FALSE));
     if (!$relcvterm) {
       tripal_cv_obo_quiterror("Cannot find the relationship term in the current ontology or in the relationship ontology: $rel\n");
     }
@@ -770,7 +785,12 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
   if (array_key_exists('is_obsolete', $oterm)) {
     $objterm['is_obsolete'] = $oterm['is_obsolete'][0];
   }
-  $objcvterm = tripal_cv_add_cvterm($objterm, $defaultcv, $object_is_relationship, 1, $default_db);
+
+  $objterm['cv_name' ] = $defaultcv;
+  $objterm['is_relationship'] = $object_is_relationship;
+  $objterm['db_name'] = $default_db;
+
+  $objcvterm = tripal_insert_cvterm($objterm, array('update_existing' => TRUE));
   if (!$objcvterm) {
     tripal_cv_obo_quiterror("Cannot add cvterm " . $oterm['name'][0]);
   }
@@ -828,7 +848,7 @@ function tripal_cv_obo_get_term($id) {
 function tripal_cv_obo_add_synonyms($term, $cvterm) {
 
   // make sure we have a 'synonym_type' vocabulary
-  $syncv = tripal_cv_add_cv('synonym_type', 'A vocabulary added by the Tripal CV module OBO loader for storing synonym types.');
+  $syncv = tripal_insert_cv('synonym_type', 'A vocabulary added by the Tripal CV module OBO loader for storing synonym types.');
 
   // now add the synonyms
   if (array_key_exists('synonym', $term)) {
@@ -860,8 +880,10 @@ function tripal_cv_obo_add_synonyms($term, $cvterm) {
            'id' => "internal:$scope",
            'definition' => '',
            'is_obsolete' => 0,
+           'cv_name' => $syncv->name,
+           'is_relationship' => FALSE
         );
-        $syntype = tripal_cv_add_cvterm($term, $syncv->name, 0, 1);
+        $syntype = tripal_insert_cvterm($term, array('update_existing' => TRUE));
         if (!$syntype) {
           tripal_cv_obo_quiterror("Cannot add synonym type: internal:$scope");
         }
@@ -1126,7 +1148,7 @@ function tripal_cv_obo_add_cvterm_dbxref($cvterm, $xref) {
 function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
 
   // make sure the 'cvterm_property_type' CV exists
-  $cv = tripal_cv_add_cv('cvterm_property_type', '');
+  $cv = tripal_insert_cv('cvterm_property_type', '');
   if (!$cv) {
     tripal_cv_obo_quiterror("Cannot add/find cvterm_property_type cvterm");
   }
@@ -1144,8 +1166,10 @@ function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
       'id' => "internal:$property",
       'definition' => '',
       'is_obsolete' => 0,
+      'cv_name' => $cv->name,
+      'is_relationship' => FALSE,
     );
-    $cvproptype = tripal_cv_add_cvterm($term, $cv->name, 0, 0);
+    $cvproptype = tripal_insert_cvterm($term, array('update_existing' => FALSE));
     if (!$cvproptype) {
       tripal_cv_obo_quiterror("Cannot add cvterm property: internal:$property");
       return FALSE;

+ 4 - 4
tripal_example/tripal_example.install

@@ -224,22 +224,22 @@ function tripal_example_add_dbs() {
  */
 function tripal_example_add_cvs() {
 
-  // EXPLANATION: use the tripal_cv_add_cv() function to add any
+  // EXPLANATION: use the tripal_insert_cv() function to add any
   // controlled vocabularies needed by your module.  If the vocabulary already
   // exists then the function will gracefully return.  Chado convensions
   // use a singluar name for CV names (not plural)/
 
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'example_property',
     'Contains property terms for examples.'
   );
 
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'example_type',
     'Contains terms describing types of examples.'
   );
 
-  tripal_cv_add_cv(
+  tripal_insert_cv(
    'example_relationship',
    'Contains terms for describing relationship types between examples.'
   );

+ 8 - 2
tripal_feature/includes/tripal_feature.chado_node.inc

@@ -285,7 +285,10 @@ function chado_feature_validate($node, $form, &$form_state) {
   if (property_exists($node, 'nid')) {
 
     // make sure the feature type is a real sequence ontology term
-    $type = tripal_cv_get_cvterm_by_name($node->feature_type, NULL, 'sequence');
+    $type = tripal_get_cvterm(array(
+      'name' => $node->feature_type,
+      'cv_id' => array('name' =>'sequence')
+    ));
     if (!$type) {
       form_set_error('feature_type', t("The feature type is not a valid name from the Sequence Ontology."));
     }
@@ -316,7 +319,10 @@ function chado_feature_validate($node, $form, &$form_state) {
   else {
 
     // make sure the feature type is a real sequence ontology term
-    $type = tripal_cv_get_cvterm_by_name($node->feature_type, NULL, 'sequence');
+    $type = tripal_get_cvterm(array(
+      'name' => $node->feature_type,
+      'cv_id' => array('name' => 'sequence')
+    ));
     if (!$type) {
       form_set_error('feature_type', t("The feature type is not a valid name from the Sequence Ontology."));
     }

+ 6 - 2
tripal_feature/includes/tripal_feature.gff_loader.inc

@@ -1358,8 +1358,10 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
       'id' => "internal:exact",
       'definition' => '',
       'is_obsolete' => 0,
+      'cv_name' => $syncv->name,
+      'is_relationship' => FALSE
     );
-    $syntype = tripal_cv_add_cvterm($term, $syncv->name, 0, 1);
+    $syntype = tripal_insert_cvterm($term, array('update_existing' => TRUE));
     if (!$syntype) {
       tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add synonym type: internal:$type", array());
       return 0;
@@ -1805,8 +1807,10 @@ function tripal_feature_load_gff3_property($feature, $property, $value) {
       'name' => $property,
       'namespace' => 'feature_property',
       'is_obsolete' => 0,
+      'cv_name' => 'feature_property',
+      'is_relationship' => FALSE
     );
-    $cvterm = (object) tripal_cv_add_cvterm($term, 'feature_property', 0, 0);
+    $cvterm = (object) tripal_insert_cvterm($term, array('update_existing' => FALSE));
     if (!$cvterm) {
       tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add cvterm, $property", array());
       return 0;

+ 3 - 3
tripal_feature/tripal_feature.install

@@ -227,14 +227,14 @@ function tripal_feature_add_organism_count_mview() {
 function tripal_feature_add_cvs() {
 
   // Add cv for relationship types
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'feature_relationship',
     'Contains types of relationships between features.'
   );
 
   // the feature_property CV already exists... it comes with chado, but we need to
   // add it just in case it doesn't get added before the feature module is installed
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'feature_property',
     'Stores properties about features'
   );
@@ -242,7 +242,7 @@ function tripal_feature_add_cvs() {
   // the feature type vocabulary should be the sequence ontology, and even though
   // this ontology should get loaded we will create it here just so that we can
   // set the default vocabulary for the feature.type_id field
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'sequence',
     'The Sequence Ontology'
   );

+ 1 - 1
tripal_feature/tripal_feature.module

@@ -390,7 +390,7 @@ function tripal_feature_cv_tree($tree_id) {
 
   $organism_id = preg_replace("/^tripal_feature_cv_tree_(\d+)$/", "$1", $tree_id);
   $options = array(
-    cv_id            => tripal_cv_get_cv_id('sequence'),
+    cv_id            => tripal_get_cv(array('name' => 'sequence')),
     count_mview      => 'organism_feature_count',
     cvterm_id_column => 'cvterm_id',
     count_column     => 'num_features',

+ 113 - 64
tripal_featuremap/tripal_featuremap.install

@@ -117,17 +117,17 @@ function tripal_featuremap_schema() {
  */
 function tripal_featuremap_add_cvs() {
 
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'featuremap_units',
     'Contains map unit types for the unittype_id column of the featuremap table.'
   );
 
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'featurepos_property',
     'Contains terms map properties.'
   );
 
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'featuremap_property',
     'Contains positional types for the feature positions'
   );
@@ -141,115 +141,164 @@ function tripal_featuremap_add_cvs() {
 function tripal_featuremap_add_cvterms() {
 
    // add cvterms for the map unit types
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'cM',
-       'def' => 'Centimorgan units'
-     ),
-     'featuremap_units', 0, 1, 'tripal'
+       'def' => 'Centimorgan units',
+       'cv_name' => 'featuremap_units',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'bp',
-       'def' => 'Base pairs units'
-     ),
-     'featuremap_units', 0, 1, 'tripal'
+       'def' => 'Base pairs units',
+       'cv_name' => 'featuremap_units',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'bin_unit',
-       'def' => 'The bin unit'
-     ),
-     'featuremap_units', 0, 1, 'tripal'
+       'def' => 'The bin unit',
+       'cv_name' => 'featuremap_units',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'marker_order',
-       'def' => 'Units simply to define marker order.'
-     ),
-     'featuremap_units', 0, 1, 'tripal'
+       'def' => 'Units simply to define marker order.',
+       'cv_name' => 'featuremap_units',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'undefined',
-       'def' => 'A catch-all for an undefined unit type'
-     ),
-     'featuremap_units', 0, 1, 'tripal'
+       'def' => 'A catch-all for an undefined unit type',
+       'cv_name' => 'featuremap_units',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
 
    // featurepos properties
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'start',
-       'def' => 'The start coordinate for a map feature.'
-     ),
-     'featurepos_property', 0, 1, 'tripal'
+       'def' => 'The start coordinate for a map feature.',
+       'cv_name' => 'featurepos_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'stop',
-       'def' => 'The end coordinate for a map feature'
-     ),
-     'featurepos_property', 0, 1, 'tripal'
+       'def' => 'The end coordinate for a map feature',
+       'cv_name' => 'featurepos_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
 
    // add cvterms for map properties
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'Map Dbxref',
-       'def' => 'A unique identifer for the map in a remote database.  The format is a database abbreviation and a unique accession separated by a colon.  (e.g. Gramene:tsh1996a)'
-     ),
-     'featuremap_property', 0, 1, 'tripal'
+       'def' => 'A unique identifer for the map in a remote database.  The '
+        . 'format is a database abbreviation and a unique accession separated '
+        . 'by a colon.  (e.g. Gramene:tsh1996a)',
+       'cv_name' => 'featuremap_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'Map Type',
-       'def' => 'The type of Map (e.g. QTL, Physical, etc.)'
-     ),
-     'featuremap_property', 0, 1, 'tripal'
+       'def' => 'The type of Map (e.g. QTL, Physical, etc.)',
+       'cv_name' => 'featuremap_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'Genome Group',
-       'def' => ''
-     ),
-     'featuremap_property', 0, 1, 'tripal'
+       'def' => '',
+       'cv_name' => 'featuremap_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'URL',
-       'def' => 'A univeral resource locator (URL) reference where the publication can be found.  For maps found online, this would be the web address for the map.'
-     ),
-     'featuremap_property', 0, 1, 'tripal'
+       'def' => 'A univeral resource locator (URL) reference where the '
+        . 'publication can be found.  For maps found online, this would be '
+        . 'the web address for the map.',
+       'cv_name' => 'featuremap_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'Population Type',
-       'def' => 'A brief description of the population type used to generate the map (e.g. RIL, F2, BC1, etc).'
-     ),
-     'featuremap_property', 0, 1, 'tripal'
+       'def' => 'A brief description of the population type used to generate '
+        . 'the map (e.g. RIL, F2, BC1, etc).',
+       'cv_name' => 'featuremap_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'Population Size',
-       'def' => 'The size of the population used to construct the map.'
-     ),
-     'featuremap_property', 0, 1, 'tripal'
+       'def' => 'The size of the population used to construct the map.',
+       'cv_name' => 'featuremap_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'Methods',
-       'def' => 'A brief description of the methods used to construct the map.'
-     ),
-     'featuremap_property', 0, 1, 'tripal'
+       'def' => 'A brief description of the methods used to construct the map.',
+       'cv_name' => 'featuremap_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
-   tripal_cv_add_cvterm(
+   tripal_insert_cvterm(
      array(
        'name' => 'Software',
-       'def' => 'The software used to construct the map.'
-     ),
-     'featuremap_property', 0, 1, 'tripal'
-   );
+       'def' => 'The software used to construct the map.',
+       'cv_name' => 'featuremap_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
 
 }
 

+ 11 - 5
tripal_library/includes/tripal_library.chado_node.inc

@@ -170,7 +170,7 @@ function chado_library_form($node, &$form_state) {
     // Generate our own select list so we can exclude the description element
     $cv_result = chado_select_record('cv',array('cv_id'),array('name' => 'library_property'));
     $cv_id = $cv_result[0]->cv_id;
-    $select_options = tripal_cv_get_cvterm_options($cv_id);
+    $select_options = tripal_get_cvterm_select_options($cv_id);
     $descrip_id = array_search('Library Description', $select_options);
     unset($select_options[$descrip_id]);
   }
@@ -277,7 +277,10 @@ function chado_library_insert($node) {
     // * Properties Form *
     // add the description property
     $properties = chado_retrieve_node_form_properties($node);
-    $descrip_id = tripal_cv_get_cvterm_by_name('Library Description', NULL, 'library_property');
+    $descrip_id = tripal_get_cvterm(array(
+      'name' => 'Library Description',
+      'cv_id' => array('name' => 'library_property')
+    ));
     $properties[$descrip_id->cvterm_id][0] = $node->description;
 
     $details = array(
@@ -346,7 +349,10 @@ function chado_library_update($node) {
   // * Properties Form *
   // add the description property
   $properties = chado_retrieve_node_form_properties($node);
-  $descrip_id = tripal_cv_get_cvterm_by_name('Library Description', NULL, 'library_property');
+  $descrip_id = tripal_get_cvterm(array(
+    'name' => 'Library Description',
+    'cv_id' => array('name' => 'library_property')
+  ));
   $properties[$descrip_id->cvterm_id][0] = $node->description;
 
   $details = array(
@@ -592,7 +598,7 @@ function tripal_library_node_insert($node) {
 
   switch ($node->type) {
     case 'chado_library':
-      
+
       $library_id = chado_get_id_from_nid('library', $node->nid);
       $values = array('library_id' => $library_id);
       $library = chado_generate_var('library', $values);
@@ -616,7 +622,7 @@ function tripal_library_node_update($node) {
 
   switch ($node->type) {
     case 'chado_library':
-      
+
       $library_id = chado_get_id_from_nid('library', $node->nid);
       $values = array('library_id' => $library_id);
       $library = chado_generate_var('library', $values);

+ 51 - 29
tripal_library/tripal_library.install

@@ -168,11 +168,11 @@ function tripal_library_add_mview_library_feature_count(){
  * @ingroup tripal_library
  */
 function tripal_library_add_cvs(){
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'library_property',
     'Contains properties for libraries.'
   );
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'library_type',
     'Contains terms for types of libraries (e.g. BAC, cDNA, FOSMID, etc).'
   );
@@ -188,55 +188,77 @@ function tripal_library_add_cvterms() {
   // Insert cvterm 'library_description' into cvterm table of chado
   // database. This CV term is used to keep track of the library
   // description in the libraryprop table.
-  tripal_cv_add_cvterm(
+  tripal_insert_cvterm(
      array(
        'name' => 'Library Description',
-       'def' => 'Description of a library'
-     ),
-    'library_property', 0, 1, 'tripal'
+       'def' => 'Description of a library',
+       'cv_name' => 'library_property',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
    );
 
   // add cvterms for the map unit types
-  tripal_cv_add_cvterm(
+  tripal_insert_cvterm(
     array(
       'name' => 'cdna_library',
-      'def' => 'cDNA library'
-    ),
-    'library_type', 0, 1, 'tripal'
+      'def' => 'cDNA library',
+       'cv_name' => 'library_type',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
   );
-  tripal_cv_add_cvterm(
+  tripal_insert_cvterm(
     array(
       'name' => 'bac_library',
-      'def' => 'Bacterial Artifical Chromsome (BAC) library'
-    ),
-    'library_type', 0, 1, 'tripal'
+      'def' => 'Bacterial Artifical Chromsome (BAC) library',
+       'cv_name' => 'library_type',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
   );
-  tripal_cv_add_cvterm(
+  tripal_insert_cvterm(
     array(
       'name' => 'fosmid_library',
-      'def' => 'Fosmid library'
-    ),
-    'library_type', 0, 1, 'tripal'
+      'def' => 'Fosmid library',
+       'cv_name' => 'library_type',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
   );
-  tripal_cv_add_cvterm(
+  tripal_insert_cvterm(
     array(
       'name' => 'cosmid_library',
-      'def' => 'Cosmid library'
-    ),
-    'library_type', 0, 1, 'tripal'
+      'def' => 'Cosmid library',
+       'cv_name' => 'library_type',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
   );
-  tripal_cv_add_cvterm(
+  tripal_insert_cvterm(
     array(
       'name' => 'yac_library',
-      'def' => 'Yeast Artificial Chromosome (YAC) library'
-    ),
-    'library_type', 0, 1, 'tripal'
+      'def' => 'Yeast Artificial Chromosome (YAC) library',
+       'cv_name' => 'library_type',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
   );
-  tripal_cv_add_cvterm(
+  tripal_insert_cvterm(
     array(
       'name' => 'genomic_library',
-      'def' => 'Genomic Library'),
-    'library_type', 0, 1, 'tripal'
+      'def' => 'Genomic Library',
+       'cv_name' => 'library_type',
+       'is_relationship' => 0,
+       'db_name' => 'tripal'
+      ),
+      array('update_existing' => TRUE)
   );
 }
 

+ 31 - 6
tripal_natural_diversity/tripal_natural_diversity.install

@@ -73,11 +73,36 @@ function tripal_natural_diversity_uninstall() {
 function tripal_natural_diversity_add_cvterms(){
 
   // add cvterms for the nd_experiment_types
-  tripal_cv_add_cvterm(array('name' => 'Genotyping','def' => 'An experiment where genotypes of individuals are identified.'),
-    'nd_experiment_types', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'Phenotyping','def' => 'An experiment where phenotypes of individuals are identified.'),
-    'nd_experiment_types', 0, 1, 'tripal');
+  tripal_insert_cvterm(
+    array(
+     'name' => 'Genotyping',
+     'def' => 'An experiment where genotypes of individuals are identified.',
+     'cv_name' => 'nd_experiment_types',
+     'is_relationship' => 0,
+     'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
+  );
 
-  tripal_cv_add_cvterm(array('name' => 'Location','def' => 'The name of the location.'),
-    'nd_geolocation_property', 0, 1, 'tripal');
+  tripal_insert_cvterm(
+    array(
+      'name' => 'Phenotyping',
+      'def' => 'An experiment where phenotypes of individuals are identified.',
+      'cv_name' => 'nd_experiment_types',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
+  );
+
+  tripal_insert_cvterm(
+    array(
+      'name' => 'Location',
+      'def' => 'The name of the location.',
+      'cv_name' => 'nd_geolocation_property',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
+  );
 }

+ 1 - 1
tripal_organism/tripal_organism.install

@@ -116,7 +116,7 @@ function tripal_organism_requirements($phase) {
  * @ingroup tripal_organism
  */
 function tripal_organism_add_cvs() {
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'organism_property',
     'Contains properties for organisms'
   );

+ 9 - 3
tripal_project/includes/tripal_project.chado_node.inc

@@ -148,7 +148,7 @@ function chado_project_form(&$node, $form_state) {
     // as a property even though it will be stored as a property.
     $cv_result = chado_select_record('cv',array('cv_id'),array('name' => 'project_property'));
     $cv_id = $cv_result[0]->cv_id;
-    $select_options = tripal_cv_get_cvterm_options($cv_id);
+    $select_options = tripal_get_cvterm_select_options($cv_id);
     $descrip_id = array_search('Project Description', $select_options);
     unset($select_options[$descrip_id]);
   }
@@ -258,7 +258,10 @@ function chado_project_insert($node) {
     // * Properties Form *
     // Add the description property
     $properties = chado_retrieve_node_form_properties($node);
-    $descrip_id = tripal_cv_get_cvterm_by_name('Project Description', NULL, 'project_property');
+    $descrip_id = tripal_get_cvterm(array(
+      'name' => 'Project Description',
+      'cv_id' => array('name' => 'project_property')
+    ));
     $properties[$descrip_id->cvterm_id][0] = $node->description;
 
     $details = array(
@@ -357,7 +360,10 @@ function chado_project_update($node) {
   // * Properties Form *
   // Add the description property
   $properties = chado_retrieve_node_form_properties($node);
-  $descrip_id = tripal_cv_get_cvterm_by_name('Project Description', NULL, 'project_property');
+  $descrip_id = tripal_get_cvterm(array(
+    'name' => 'Project Description',
+    'cv_id' => array('name' => 'project_property')
+  ));
   $properties[$descrip_id->cvterm_id][0] = $node->description;
 
   $details = array(

+ 8 - 5
tripal_project/tripal_project.install

@@ -103,13 +103,13 @@ function tripal_project_schema() {
  */
 function tripal_project_add_cvs() {
   // Add the cv for project properties
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'project_property',
     'Contains properties for projects'
   );
 
   // Add cv for relationship types
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'project_relationship',
     'Contains Types of relationships between projects.'
   );
@@ -125,12 +125,15 @@ function tripal_project_add_cvterms() {
   // Insert cvterm 'Project Description' into cvterm table of chado
   // database. This CV term is used to keep track of the project
   // description in the projectprop table.
-  tripal_cv_add_cvterm(
+  tripal_insert_cvterm(
     array(
       'name' => 'Project Description',
-      'def'  => 'Description of a project'
+      'def'  => 'Description of a project',
+      'cv_name' => 'project_property',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
     ),
-    'project_property', 0, 1, 'tripal'
+    array('update_existing' => TRUE)
   );
 }
 

+ 60 - 33
tripal_pub/includes/tripal_pub.chado_node.inc

@@ -91,45 +91,72 @@ function chado_pub_form($node, $form_state) {
     // get fields from the pub table and convert them to properties. We will add these to the $more_props
     // array which gets passed in to the tripal_core_properties_form() API call further down
     if ($pub->volumetitle) {
-      $cvterm = tripal_cv_get_cvterm_by_name('Volume Title', NULL, 'tripal_pub');
+      $cvterm = tripal_get_cvterm(array(
+        'name' => 'Volume Title',
+        'cv_id' => array('name' => 'tripal_pub')
+      ));
       $more_props[] = array('cvterm' => $cvterm, 'value' => $pub->volumetitle);
     }
     if ($pub->volume) {
-      $cvterm = tripal_cv_get_cvterm_by_name('Volume', NULL, 'tripal_pub');
+      $cvterm = tripal_get_cvterm(array(
+        'name' => 'Volume',
+        'cv_id' => array('name' => 'tripal_pub')
+      ));
       $more_props[] = array('cvterm' => $cvterm, 'value' => $pub->volume);
     }
     if ($pub->series_name) {
       switch ($pub->type_id->name) {
         case 'Journal Article':
-          $cvterm = tripal_cv_get_cvterm_by_name('Journal Name', NULL, 'tripal_pub');
+          $cvterm = tripal_get_cvterm(array(
+            'name' => 'Journal Name',
+            'cv_id' => array('name' => 'tripal_pub')
+          ));
           $more_props[] = array('cvterm' => $cvterm, 'value' => $pub->series_name);
           break;
         case 'Conference Proceedings':
-          $cvterm = tripal_cv_get_cvterm_by_name('Conference Name', NULL, 'tripal_pub');
+          $cvterm = tripal_get_cvterm(array(
+            'name' => 'Conference Name',
+            'cv_id' => array('name' => 'tripal_pub')
+          ));
           $more_props[] = array('cvterm' => $cvterm, 'value' => $pub->series_name);
           break;
         default:
-          $cvterm = tripal_cv_get_cvterm_by_name('Series Name', NULL, 'tripal_pub');
+          $cvterm = tripal_get_cvterm(array(
+            'name' => 'Series Name',
+            'cv_id' => array('tripal_pub')
+          ));
           $more_props[] = array('cvterm' => $cvterm, 'value' => $pub->series_name);
       }
     }
     if ($pub->issue) {
-      $cvterm = tripal_cv_get_cvterm_by_name('Issue', NULL, 'tripal_pub');
+      $cvterm = tripal_get_cvterm(array(
+        'name' => 'Issue',
+        'cv_id' => array('name' => 'tripal_pub')
+      ));
       $more_props[] = array('cvterm' => $cvterm, 'value' => $pub->issue);
     }
     if ($pub->pages) {
-      $cvterm = tripal_cv_get_cvterm_by_name('Pages', NULL, 'tripal_pub');
+      $cvterm = tripal_get_cvterm(array(
+        'name' => 'Pages',
+        'cv_id' => array('name' => 'tripal_pub')
+      ));
       $more_props[] = array('cvterm' => $cvterm, 'value' => $pub->pages);
     }
     if ($pub->miniref) {
       // not sure what to do with this one
     }
     if ($pub->publisher) {
-      $cvterm = tripal_cv_get_cvterm_by_name('Publisher', NULL, 'tripal_pub');
+      $cvterm = tripal_get_cvterm(array(
+        'name' => 'Publisher',
+        'cv_id' => array('name' => 'tripal_pub')
+      ));
       $more_props[] = array('cvterm' => $cvterm, 'value' => $pub->publisher);
     }
     if ($pub->pubplace) {
-      $cvterm = tripal_cv_get_cvterm_by_name('Published Location', NULL, 'tripal_pub');
+      $cvterm = tripal_get_cvterm(array(
+        'name' => 'Published Location',
+        'cv_id' => array('name' => 'tripal_pub')
+      ));
       $more_props[] = array('cvterm' => $cvterm, 'value' => $pub->pages);
     }
   }
@@ -157,10 +184,10 @@ function chado_pub_form($node, $form_state) {
     '#default_value' => $title,
     '#required' => TRUE,
   );
-  
+
   $type_cv = tripal_get_default_cv('pub', 'type_id');
   if ($type_cv->name == 'tripal_pub') {
-   
+
     // get the list of publication types.  In the Tripal publication
     // ontologies these are all grouped under the term 'Publication Type'
     // we want the default to be 'Journal Article'
@@ -188,7 +215,7 @@ function chado_pub_form($node, $form_state) {
   }
   else {
     $pub_types = tripal_get_cvterm_default_select_options('pub', 'type_id', 'publication types');
-    $pub_types[0] = 'Select a Type'; 
+    $pub_types[0] = 'Select a Type';
   }
 
   $form['type_id'] = array(
@@ -229,8 +256,8 @@ function chado_pub_form($node, $form_state) {
   $select_options = array();
   $prop_cv = tripal_get_default_cv('pubprop', 'type_id');
   $cv_id = $prop_cv ? $prop_cv->cv_id : NULL;
-  // if the poperty cv is 'tripal_pub' then we need to pass in our own select_options 
-  // for only a subset of the vocabulary  
+  // if the poperty cv is 'tripal_pub' then we need to pass in our own select_options
+  // for only a subset of the vocabulary
   if ($prop_cv->name == 'tripal_pub') {
     $select_options[] = 'Select a Property';
     $sql = "
@@ -285,7 +312,7 @@ function chado_pub_form($node, $form_state) {
   // Adds the form elements to your current form
   chado_add_node_form_relationships($form, $form_state, $details);
 
-  
+
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
   $details = array(
@@ -324,7 +351,7 @@ function chado_pub_validate($node, $form, &$form_state) {
   $uniquename   = trim($node->uniquename);
   $is_obsolete  = $node->is_obsolete;
   $type_id      = $node->type_id;
-  
+
   $pub = array();
 
   // make sure the year is four digits
@@ -348,7 +375,7 @@ function chado_pub_validate($node, $form, &$form_state) {
   foreach ($properties as $key => $prop_values) {
     $values = array('cvterm_id' => $key);
     $prop_type = chado_select_record('cvterm', array('name'), $values);
-    if ($prop_type[0]->name == 'Conference Name' or 
+    if ($prop_type[0]->name == 'Conference Name' or
         $prop_type[0]->name == 'Journal Name' or
         $prop_type[0]->name == 'Series Name') {
       $series_name = $prop_values[0];
@@ -417,7 +444,7 @@ function chado_pub_validate_check_uniquename($uniquename, $pub_id = NULL) {
   $pub = chado_get_publication(array('uniquename' => $uniquename));
   if ($pub) {
     // if a $pub_id is provided to the function then this is an update
-    // if the pub_id's don't match then a different pub with the same 
+    // if the pub_id's don't match then a different pub with the same
     // uniquename already exists.
     if ($pub->pub_id != $pub_id) {
       $message = t('A publication with this unique citation already exists.');
@@ -440,7 +467,7 @@ function chado_pub_validate_check_uniquename($uniquename, $pub_id = NULL) {
  *   The type of publication
  * @param $pub_id
  *   the unique id of the publication
- *   
+ *
  *
  * @ingroup tripal_pub
  */
@@ -454,7 +481,7 @@ function chado_pub_validate_check_duplicate($title, $pyear, $series_name, $cvter
   );
   // TODO: need to include the Publication Dbxref in the $pub_details as well
   $pub_ids = tripal_publication_exists($pub_details);
-  
+
   // if we found only one publication and it is our publication then return, we're good.
   if (count($pub_ids) == 1 and in_array($pub_id, $pub_ids)) {
     return;
@@ -463,7 +490,7 @@ function chado_pub_validate_check_duplicate($title, $pyear, $series_name, $cvter
     // there is no match so return
     return;
   }
-  
+
   // return an appropriate message based on the unique constraint settings
   $import_dups_check = variable_get('tripal_pub_import_duplicate_check', 'title_year_media');
   switch ($import_dups_check) {
@@ -510,7 +537,7 @@ function chado_pub_node_access($node, $op, $account) {
   if (is_object($node)) {
     $node_type = $node->type;
   }
-  
+
   if($node_type == 'chado_pub') {
     if ($op == 'create') {
       if (!user_access('create chado_pub', $account)) {
@@ -647,7 +674,7 @@ function chado_pub_insert($node) {
     }
     // generate a citation for this pub if one doesn't already exist
     if (!$node->uniquename and !array_key_exists($citation_id, $properties)) {
-      $pub_type = tripal_cv_get_cvterm_by_id($node->type_id);
+      $pub_type = tripal_get_cvterm(array('cvterm_id' => $node->type_id));
       $pub_arr['Title'] = $node->pubtitle;
       $pub_arr['Publication Type'][0] = $pub_type->name;
       $pub_arr['Year'] = $node->pyear;
@@ -697,7 +724,7 @@ function chado_pub_insert($node) {
     chado_update_node_form_relationships($node, $details);
 
     // add in any database cross-references
-    foreach ($cross_refs as $index => $ref) { 
+    foreach ($cross_refs as $index => $ref) {
       $dbxref = array();
       if(preg_match('/^(.*?):(.*?)$/', trim($ref), $matches)) {
         $dbxref['db_name']   = $matches[1];
@@ -851,7 +878,7 @@ function chado_pub_update($node) {
   }
   // generate a citation for this pub if one doesn't already exist
   if (!$node->uniquename) {
-    $pub_type = tripal_cv_get_cvterm_by_id($node->type_id);
+    $pub_type = tripal_get_cvterm(array('cvterm_id' => $node->type_id));
     $pub_arr['Title'] = $node->pubtitle;
     $pub_arr['Publication Type'][0] = $pub_type->name;
     $pub_arr['Year'] = $node->pyear;
@@ -943,9 +970,9 @@ function chado_pub_load($nodes) {
   foreach ($nodes as $nid => $node) {
     // find the pub and add in the details
     $pub_id = chado_get_id_from_nid('pub', $nid);
-    
+
     // if the nid does not have a matching record then skip this node.
-    // this can happen with orphaned nodes. 
+    // this can happen with orphaned nodes.
     if (!$pub_id) {
       continue;
     }
@@ -1091,7 +1118,7 @@ function tripal_pub_node_view($node, $view_mode, $langcode) {
 function tripal_pub_node_insert($node) {
 
   if ($node->type == 'chado_pub') {
-    
+
     // get the pub
     $pub_id = chado_get_id_from_nid('pub', $node->nid);
     $values = array('pub_id' => $pub_id);
@@ -1103,7 +1130,7 @@ function tripal_pub_node_insert($node) {
     $pub = chado_expand_var($pub, 'field', 'pub.volumetitle');
     $pub = chado_expand_var($pub, 'field', 'pub.uniquename');
     $node->pub = $pub;
-    
+
     // Now get the title
     $node->title = chado_get_node_title($node);
 
@@ -1155,14 +1182,14 @@ function tripal_pub_node_update($node) {
     $pub_id = chado_get_id_from_nid('pub', $node->nid);
     $values = array('pub_id' => $pub_id);
     $pub = chado_generate_var('pub', $values);
-    
+
     // expand the 'text' fields as those aren't included by default
     // and they really shouldn't be so large to cause problems
     $pub = chado_expand_var($pub, 'field', 'pub.title');
     $pub = chado_expand_var($pub, 'field', 'pub.volumetitle');
     $pub = chado_expand_var($pub, 'field', 'pub.uniquename');
     $node->pub = $pub;
-            
+
     // Now get the title
     $node->title = chado_get_node_title($node);
 
@@ -1206,12 +1233,12 @@ function chado_pub_chado_node_default_title_format() {
 
 /**
  * Implements [content_type]_chado_node_sync_select_query().
- * 
+ *
  * Adds a where clause to the query to exclude the NULL pub.
  */
 function chado_pub_chado_node_sync_select_query($query) {
   $query['where_clauses']['title'][] = 'pub.title <> :pub_title_null';
   $query['where_args']['title'][':pub_title_null'] = 'NULL';
-  
+
   return $query;
 }

+ 1 - 1
tripal_pub/includes/tripal_pub.pub_importers.inc

@@ -1069,7 +1069,7 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
     $cvterm = tripal_get_cvterm($identifiers);
 
     // if we could not find the cvterm by name then try by synonym
-    //$cvterm = tripal_cv_get_cvterm_by_name($key, NULL, 'tripal_pub');
+    //$cvterm = tripal_get_cvterm(array('name' => $key, 'cv_id' => array('name' => 'tripal_pub')));
     if (!$cvterm) {
       $identifiers = array(
         'synonym' => array(

+ 6 - 6
tripal_pub/tripal_pub.install

@@ -54,8 +54,8 @@ function tripal_pub_install() {
 
   // add loading of the the tripal pub ontology to the job queue
   $obo_path =  drupal_realpath(drupal_get_path('module', 'tripal_pub') . '/files/tpub.obo');
-  $obo_id = tripal_cv_add_obo_ref('Tripal Publication', $obo_path);
-  tripal_cv_submit_obo_job($obo_id);
+  $obo_id = tripal_insert_obo('Tripal Publication', $obo_path);
+  tripal_submit_obo_job(array('ob_id' => $obo_id));
 
   tripal_pub_add_cvs();
   tripal_pub_add_cvterms();
@@ -246,25 +246,25 @@ function tripal_pub_add_cvs() {
 
 
   // Add the cv for pub properties
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'tripal_pub',
     'A heirarchical set of terms for describing a publication. It is intended to be used as the default vocabularies in Tripal for publication types and contact properties.'
   );
 
   // Add the cv for pub types
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'pub_type',
     'Contains types of publications. This can be used if the tripal_pub vocabulary (which is default for publications in Tripal) is not desired.'
   );
 
   // Add the cv for pub properties
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'pub_property',
     'Contains properties for publications. This can be used if the tripal_pub vocabulary (which is default for publications in Tripal) is not desired.'
   );
 
   // Add cv for relationship types
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'pub_relationship',
     'Contains types of relationships between publications.'
   );

+ 3 - 3
tripal_stock/tripal_stock.install

@@ -186,15 +186,15 @@ function tripal_stock_add_organism_count_mview() {
 function tripal_stock_add_cvs() {
 
   // Add cv for relationship types
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'stock_relationship',
     'Contains types of relationships between stocks.'
   );
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'stock_property',
     'Contains properties for stocks.'
   );
-  tripal_cv_add_cv(
+  tripal_insert_cv(
     'stock_type',
     'Contains a list of types for stocks.'
   );