Quellcode durchsuchen

change of api function names to bring them into line with the new names outlined in github issue 330

Shawna Spoor vor 6 Jahren
Ursprung
Commit
b1855c73a4

+ 430 - 0
tripal_chado/api/tripal_chado.DEPRECATED.api.inc

@@ -0,0 +1,430 @@
+<?php
+
+/**
+ * @file
+ *
+ * These api functions are deprecated, if your site is currently using them
+ * please update your code with the newer tripal_chado functions.
+ */
+
+/**
+ * @defgroup tripal_chado_DEPRECATED_api
+ * @ingroup tripal_chado_api
+ * @{
+ * Deprecated legacy api code.
+ * @}
+ */
+
+/**
+ * Publishes content in Chado as a new TripalEntity entity.
+ *
+ * @param $values
+ *   A key/value associative array that supports the following keys:
+ *   - bundle_name:  The name of the the TripalBundle (e.g. bio_data-12345).
+ * @param $job_id
+ *   (Optional) The numeric job ID as provided by the Tripal jobs system. There
+ *   is no need to specify this argument if this function is being called
+ *   outside of the jobs systems.
+ *
+ * @return boolean
+ *   TRUE if all of the records of the given bundle type were published, and
+ *   FALSE if a failure occured.
+ *
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_chado_publish_records($values, $job_id = null) {
+  chado_publish_records($values, $job_id = null);
+}
+
+/**
+ * Returns an array of tokens based on Tripal Entity Fields.
+ *
+ * @param $base_table
+ *    The name of a base table in Chado.
+ * @return
+ *    An array of tokens where the key is the machine_name of the token.
+ * 
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_get_chado_tokens($base_table) {
+  chado_get_chado_tokens($base_table);
+}
+
+/**
+ * Replace all Chado Tokens in a given string.
+ *
+ * NOTE: If there is no value for a token then the token is removed.
+ *
+ * @param string $string
+ *   The string containing tokens.
+ * @param $record
+ *   A Chado record as generated by chado_generate_var()
+ *
+ * @return
+ *   The string will all tokens replaced with values.
+ * 
+ *  @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_replace_chado_tokens($string, $record) {
+  chado_replace_chado_tokens($string, $record);
+}
+
+/**
+ * Migrate Tripal content types
+ * 
+ * Migrate specified Tripal content type and publish all its content. The content type 
+ * will be created if it does not already exist.
+ * 
+ * @param $type
+ *   A type array specifying the vocabular, accession, term_name, and chado data_table
+ *   e.g.
+ *     $type = array(
+ *       'vocabulary' => 'OBI',
+ *       'accession' => '0100026',
+ *       'term_name' => 'organism',
+ *       'storage_args' => array (
+ *         'data_table' => $table
+ *       )
+ *     )
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_chado_migrate_tripal_content_type($type = array()) {
+  chado_migrate_tripal_content_type($type = array());
+}
+
+
+/**
+ * Add a materialized view to the chado database to help speed data access. This
+ * function supports the older style where postgres column specifications
+ * are provided using the $mv_table, $mv_specs and $indexed variables. It also
+ * supports the newer preferred method where the materialized view is described
+ * using the Drupal Schema API array.
+ *
+ * @param $name
+ *   The name of the materialized view.
+ * @param $modulename
+ *   The name of the module submitting the materialized view 
+ *   (e.g. 'tripal_library').
+ * @param $mv_schema
+ *   If using the newer Schema API array to define the materialized view then
+ *   this variable should contain the array or a string representation of the
+ *   array.
+ * @param $query
+ *   The SQL query that loads the materialized view with data.
+ * @param $comment
+ *   A string containing a description of the materialized view.
+ * @param $redirect
+ *   Optional (default: TRUE). By default this function redirects back to
+ *   admin pages. However, when called by Drush we don't want to redirect. This
+ *   parameter allows this to be used as a true API function.
+ *
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_add_mview($name, $modulename, $mv_schema, $query, $comment = null, $redirect = true)
+{
+  chado_add_mview($name, $modulename, $mv_schema, $query, $comment = null, $redirect = true);
+}
+
+/**
+ * Edits a materialized view to the chado database to help speed data access. 
+ * This function supports the older style where postgres column specifications
+ * are provided using the $mv_table, $mv_specs and $indexed variables. It also
+ * supports the newer preferred method where the materialized view is described
+ * using the Drupal Schema API array.
+ *
+ * @param $mview_id
+ *   The mview_id of the materialized view to edit.
+ * @param $name
+ *   The name of the materialized view.
+ * @param $modulename
+ *   The name of the module submitting the materialized view 
+ *   (e.g. 'tripal_library').
+ * @param $mv_table
+ *   The name of the table to add to chado. This is the table that can be 
+ *   queried.
+ * @param $mv_specs
+ *   The table definition.
+ * @param $indexed
+ *   The columns that are to be indexed.
+ * @param $query
+ *   The SQL query that loads the materialized view with data.
+ * @param $special_index
+ *   currently not used.
+ * @param $comment
+ *   A string containing a description of the materialized view.
+ * @param $mv_schema
+ *   If using the newer Schema API array to define the materialized view then
+ *   this variable should contain the array.
+ *
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_edit_mview(
+  $mview_id,
+  $name,
+  $modulename,
+  $mv_table,
+  $mv_specs,
+  $indexed,
+  $query,
+  $special_index,
+  $comment = null,
+  $mv_schema = null
+) {
+  chado_edit_mview(
+    $mview_id,
+    $name,
+    $modulename,
+    $mv_table,
+    $mv_specs,
+    $indexed,
+    $query,
+    $special_index,
+    $comment = null,
+    $mv_schema = null
+  );
+}
+
+/**
+ * Retrieve the materialized view_id given the name.
+ *
+ * @param $view_name
+ *   The name of the materialized view.
+ *
+ * @return
+ *   The unique identifier for the given view.
+ *
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_get_mview_id($view_name)
+{
+  chado_get_mview_id($view_name);
+}
+
+/**
+ * Populates the specified Materialized View.
+ *
+ * @param $mview_id
+ *   The unique ID of the materialized view for the action to be performed on.
+ *
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_refresh_mview($mview_id)
+{
+  chado_refresh_mview($mview_id);
+}
+
+/**
+ * Retrieves the list of materialized view IDs and their names.
+ *
+ * @return
+ *   An array of objects with the following properties:  mview_id, name.
+ *
+ * @ingroup tripal_chado_DEPRECATED_api
+ *
+ */
+function tripal_get_mviews()
+{
+  chado_get_mviews();
+}
+
+/**
+ * Does the specified action for the specified Materialized View.
+ *
+ * @param $op
+ *   The action to be taken. One of update or delete.
+ * @param $mview_id
+ *   The unique ID of the materialized view for the action to be performed on.
+ *
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_delete_mview($mview_id)
+{
+  chado_delete_mview($mview_id);
+}
+
+/**
+ * Update a Materialized View.
+ *
+ * @param $mview_id
+ *   The unique identifier for the materialized view to be updated.
+ *
+ * @return
+ *   True if successful, FALSE otherwise.
+ *
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_populate_mview($mview_id) {
+  chado_populate_mview($mview_id);
+}
+
+/**
+ * Alter the name of the schema housing Chado and/or Drupal.
+ *
+ * This example implementation shows a solution for the case where your chado 
+ * database was well established in the "public" schema and you added Drupal 
+ * later in a "drupal" schema. Please note that this has not been tested and 
+ * while we can ensure that Tripal will work as expected, we have no control 
+ * over whether Drupal is compatible with not being in the public schema. That's
+ * why we recommened the organization we have (ie: Chado in a "chado" schema and
+ * Drupal in the "public schema).
+ *
+ * @param $schema_name
+ *   The current name of the schema as known by Tripal. This is likely the 
+ *   default set in tripal_get_schema_name() but in the case of multiple alter 
+ *   hooks, it might be different.
+ * @param $context
+ *   This is an array of items to provide context.
+ *     - schema: this is the schema that was passed to tripal_get_schema_name() 
+ *       and will be either "chado" or "drupal". This should be used to 
+ *       determine you are changing the name of the correct schema.
+ *
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function hook_tripal_get_schema_name_alter($schema_name, $context)
+{
+  hook_chado_get_schema_name_alter($schema_name, $context);
+}
+
+/**
+ * Retrieve the name of the PostgreSQL schema housing Chado or Drupal.
+ *
+ * @param $schema
+ *   Wehter you want the schema name for 'chado' or 'drupal'. Chado is the 
+ *   default.
+ * @return
+ *   The name of the PostgreSQL schema housing the $schema specified.
+ *
+ * @ingroup tripal_chado_DEPRECATED_api
+ */
+function tripal_get_schema_name($schema = 'chado')
+{
+  chado_get_schema_name($schema = 'chado');
+}
+
+
+/**
+ * Adds a new Chado table to the semantic web support for Chado.
+ *
+ * Newly added tables (i.e. custom tables) need to be integrated into the
+ * semantic web infrastructure.  After a new table is created and added to
+ * the Chado schema, this function should be called to indicate that the
+ * table should be included in the semantic web. No associations are made for
+ * the columns. The associations should be added using the
+ * tripal_associate_chado_semweb_term() function.
+ *
+ * If the table has already been added previously then this function does
+ * nothing. It will not overwrite existing assocations.
+ *
+ * Temporary tables (e.g. Tripal tables that begin with 'tripal_' and end with
+ * '_temp', are not supported.
+ *
+ * @param $chado_table
+ *   The name of the Chado table.
+ * 
+ * @ingroup tripal_chado_semweb_api
+ */
+function tripal_add_chado_semweb_table($chado_table)
+{
+  chado_add_chado_semweb_table($chado_table);
+}
+
+/**
+ * Associates a controlled vocabulary term with a field in a Chado table.
+ *
+ * For sharing of data via the semantic web we need to associate a
+ * term from a controlled vocabulary with every column of every table in Chado.
+ *
+ * Temporary tables (e.g. Tripal tables that begin with 'tripal_' and end with
+ * '_temp', are not supported.
+ *
+ * @param $chado_table
+ *   The name of the table in Chado. This argument is optional. If left empty
+ *   or set to NULL then all fields in all Chado tables with that have the
+ *   $column_name will be associated with the provided $term.
+ * @param $chado_column
+ *   The column name in the Chado table to which the term should be associated.
+ * @param $term
+ *   A cvterm object as returned by chado_generate_var().
+ * @param $update
+ *   Set to TRUE if the association should be updated to use the new term
+ *   if a term is already associated with the table and column.  Default is
+ *   FALSE.  If not TRUE and a term is already associated, then no change
+ *   occurs.
+ *
+ * @return boolean
+ *   Returns TRUE if the association was made successfully and FALSE otherwise.
+ * 
+ *  @ingroup tripal_chado_semweb_api
+ */
+function tripal_associate_chado_semweb_term(
+  $chado_table,
+  $chado_column,
+  $term,
+  $update = false
+) {
+  chado_associate_chado_semweb_term(
+    $chado_table,
+    $chado_column,
+    $term,
+    $update = false
+  );
+}
+
+
+/**
+ * Retrieves the term that maps to the given Chado table and field.
+ *
+ * @param $chado_table
+ *   The name of the Chado table.
+ * @param $chado_column
+ *   The name of the Chado field.
+ * @param $options
+ *   An associative array of one or more of the following keys:
+ *     -return_object:  Set to TRUE to return the cvterm object rather than
+ *      the string version of the term.
+ *
+ * @return
+ *   Returns a string-based representation of the term (e.g. SO:0000704). If
+ *   the 'return_object' options is provided then a cvterm object is returned.
+ *   returns NULL if no term is mapped to the table and column.
+ * 
+ *  @ingroup tripal_chado_semweb_api
+ */
+function tripal_get_chado_semweb_term($chado_table, $chado_column, $options = array())
+{
+  chado_get_chado_semweb_term($chado_table, $chado_column, $options = array());
+}
+
+/**
+ * Formats a controlled vocabulary term from Chado for use with Tripal.
+ *
+ * @param $cvterm
+ *   A cvterm object.
+ * @return
+ *   The semantic web name for the term.
+ * 
+ *  @ingroup tripal_chado_semweb_api
+ */
+function tripal_format_chado_semweb_term($cvterm)
+{
+  chado_format_chado_semweb_term($cvterm);
+}
+/**
+ * Retreive the column name in a Chado table that matches a given term.
+ *
+ * @param $chado_table
+ *   The name of the Chado table.
+ * @param $term
+ *   The term. This can be a term name or a unique identifer of the form
+ *   {db}:{accession} or of the form {db}__{term_name}.
+ *
+ * @return
+ *   The name of the Chado column that matches the given term or FALSE if the
+ *   term is not mapped to the Chado table.
+ * 
+ *  @ingroup tripal_chado_semweb_api
+ */
+function tripal_get_chado_semweb_column($chado_table, $term)
+{
+  chado_get_chado_semweb_column($chado_table, $term);
+}

+ 5 - 5
tripal_chado/api/tripal_chado.api.inc

@@ -32,7 +32,7 @@
  *
  * @ingroup tripal_chado_api
  */
-function tripal_chado_publish_records($values, $job_id = NULL) {
+function chado_publish_records($values, $job_id = NULL) {
 
   // We want the job object in order to report progress.
   if (is_object($job_id)) {
@@ -268,7 +268,7 @@ function tripal_chado_publish_records($values, $job_id = NULL) {
  * 
  * @ingroup tripal_chado_api
  */
-function tripal_get_chado_tokens($base_table) {
+function chado_get_chado_tokens($base_table) {
 
   $tokens = array();
   $table_descrip = chado_get_schema($base_table);
@@ -300,7 +300,7 @@ function tripal_get_chado_tokens($base_table) {
         $sub_token_prefix = $base_table . '.' . $left_field;
         $sub_location_prefix = implode(' > ',array($base_table, $left_field));
 
-        $sub_tokens = tripal_get_chado_tokens($table);
+        $sub_tokens = chado_get_chado_tokens($table);
         if (is_array($sub_tokens)) {
           $tokens = array_merge($tokens, $sub_tokens);
         }
@@ -326,9 +326,9 @@ function tripal_get_chado_tokens($base_table) {
  * 
  *  @ingroup tripal_chado_api
  */
-function tripal_replace_chado_tokens($string, $record) {
+function chado_replace_chado_tokens($string, $record) {
   // Get the list of tokens
-  $tokens = tripal_get_chado_tokens($record->tablename);
+  $tokens = chado_get_chado_tokens($record->tablename);
 
   // Determine which tokens were used in the format string
   if (preg_match_all('/\[[^]]+\]/', $string, $used_tokens)) {

+ 5 - 5
tripal_chado/api/tripal_chado.custom_tables.api.inc

@@ -46,7 +46,7 @@ function chado_edit_custom_table($table_id, $table_name, $schema, $skip_if_exist
 
     // If this is a materialized view then don't allow editing with this function.
     if ($custom_table->mview_id) {
-      tripal_report_error('tripal_chado', TRIPAL_ERROR, "Please use the tripal_edit_mview() function to edit this custom table as it is a materialized view.", array());
+      tripal_report_error('tripal_chado', TRIPAL_ERROR, "Please use the chado_edit_mview() function to edit this custom table as it is a materialized view.", array());
       drupal_set_message("This custom table is a materialized view. Please use the "  . l('Materialized View', 'admin/tripal/storage/chado/mviews') . " interface to edit it.", 'error');
       return FALSE;
     }
@@ -72,7 +72,7 @@ function chado_edit_custom_table($table_id, $table_name, $schema, $skip_if_exist
 
     // Re-add the custom table to the semantic web interface to pick up any
     // changes in fields.
-    tripal_add_chado_semweb_table($table_name);
+    chado_add_chado_semweb_table($table_name);
   }
   catch (Exception $e) {
     $transaction->rollback();
@@ -133,7 +133,7 @@ function chado_create_custom_table($table, $schema, $skip_if_exists = TRUE,
   $created = 0;
   $recreated = 0;
 
-  $chado_schema = tripal_get_schema_name('chado');
+  $chado_schema = chado_get_schema_name('chado');
   $chado_dot = $chado_schema . '.';
 
   $transaction = db_transaction();
@@ -203,7 +203,7 @@ function chado_create_custom_table($table, $schema, $skip_if_exists = TRUE,
     }
 
     // Add the custom table to the semantic web interface.
-    tripal_add_chado_semweb_table($table);
+    chado_add_chado_semweb_table($table);
   }
   catch (Exception $e) {
     $transaction->rollback();
@@ -359,7 +359,7 @@ function chado_delete_custom_table($table_id) {
 
   // If this is a materialized view then don't allow deletion with this function.
   if ($custom_table->mview_id) {
-    tripal_report_error('tripal_chado', TRIPAL_ERROR, "Please use the tripal_delete_mview() function to delete this custom table as it is a materialized view. Table not deleted.", array());
+    tripal_report_error('tripal_chado', TRIPAL_ERROR, "Please use the chado_delete_mview() function to delete this custom table as it is a materialized view. Table not deleted.", array());
     drupal_set_message("This custom table is a materialized view. Please use the "  . l('Materialized View', 'admin/tripal/storage/chado/mviews') . " interface to delete it.", 'error');
     return FALSE;
   }

+ 2 - 2
tripal_chado/api/tripal_chado.migrate.api.inc

@@ -31,7 +31,7 @@
  *     )
  * @ingroup tripal_chado_migrate_api
  */
-function tripal_chado_migrate_tripal_content_type($type = array()) {
+function chado_migrate_tripal_content_type($type = array()) {
     
   // Check if the term already exists.
   $term = tripal_load_term_entity($type);
@@ -49,5 +49,5 @@ function tripal_chado_migrate_tripal_content_type($type = array()) {
     'sync_node' => 1,
     'bundle_name' => $bundle_name
   );
-  tripal_chado_publish_records($value);
+  chado_publish_records($value);
 }

+ 8 - 8
tripal_chado/api/tripal_chado.mviews.api.inc

@@ -42,7 +42,7 @@
  *
  * @ingroup tripal_mviews_api
  */
-function tripal_add_mview($name, $modulename, $mv_schema, $query, $comment = NULL, $redirect = TRUE) {
+function chado_add_mview($name, $modulename, $mv_schema, $query, $comment = NULL, $redirect = TRUE) {
 
   if (!array_key_exists('table', $mv_schema)) {
      tripal_report_error('tripal_chado', TRIPAL_ERROR,
@@ -136,7 +136,7 @@ function tripal_add_mview($name, $modulename, $mv_schema, $query, $comment = NUL
  *
  * @ingroup tripal_mviews_api
  */
-function tripal_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
+function chado_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
   $indexed, $query, $special_index, $comment = NULL, $mv_schema = NULL) {
 
   $transaction = db_transaction();
@@ -216,7 +216,7 @@ function tripal_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
  *
  * @ingroup tripal_mviews_api
  */
-function tripal_get_mview_id($view_name) {
+function chado_get_mview_id($view_name) {
   if (db_table_exists('tripal_mviews')) {
     $sql = "SELECT * FROM {tripal_mviews} WHERE name = :name";
     $results = db_query($sql, array(':name' => $view_name));
@@ -259,7 +259,7 @@ function chado_get_mview_table_names() {
  *
  * @ingroup tripal_mviews_api
  */
-function tripal_refresh_mview($mview_id) {
+function chado_refresh_mview($mview_id) {
   global $user;
 
   if (!$mview_id) {
@@ -274,7 +274,7 @@ function tripal_refresh_mview($mview_id) {
   // Add a job to populate the mview.
   $args = array("$mview_id");
   tripal_add_job("Populate materialized view '$mview->name'", 'tripal_chado',
-     'tripal_populate_mview', $args, $user->uid);
+    'chado_populate_mview', $args, $user->uid);
 
 }
 
@@ -287,7 +287,7 @@ function tripal_refresh_mview($mview_id) {
  * @ingroup tripal_mviews_api
  *
  */
-function tripal_get_mviews() {
+function chado_get_mviews() {
 
   $results = db_select('tripal_mviews', 'tm')
     ->fields('tm', array('mview_id', 'name'))
@@ -310,7 +310,7 @@ function tripal_get_mviews() {
  *
  * @ingroup tripal_mviews_api
  */
-function tripal_delete_mview($mview_id) {
+function chado_delete_mview($mview_id) {
   global $user;
 
   if (!$mview_id) {
@@ -354,7 +354,7 @@ function tripal_delete_mview($mview_id) {
  *
  * @ingroup tripal_mviews_api
  */
-function tripal_populate_mview($mview_id) {
+function chado_populate_mview($mview_id) {
   $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id ";
   $results = db_query($sql, array(':mview_id' => $mview_id));
   $mview = $results->fetchObject();

+ 10 - 10
tripal_chado/api/tripal_chado.query.api.inc

@@ -333,7 +333,7 @@ function chado_set_active($dbname = 'default') {
   }
 
   $previous_db = $active_db = $GLOBALS['chado_active_db'];
-  $search_path = tripal_get_schema_name('drupal');
+  $search_path = chado_get_schema_name('drupal');
 
   // Change only if 'chado' has been specified.
   // Notice that we leave the active_db set as chado but use the possibly 
@@ -342,7 +342,7 @@ function chado_set_active($dbname = 'default') {
   // to alter the schema name used.
   if ($dbname == 'chado') {
     $active_db = 'chado';
-    $search_path = tripal_get_schema_name('chado') . ',' . tripal_get_schema_name('drupal');
+    $search_path = chado_get_schema_name('chado') . ',' . chado_get_schema_name('drupal');
   }
   else {
     $active_db = $dbname;
@@ -1675,8 +1675,8 @@ function chado_query($sql, $args = array()) {
     // Chado tables should be enclosed in curly brackets (ie: {feature} )
     // and Drupal tables should be enclosed in square brackets
     // (ie: [tripal_jobs] ).
-    $chado_schema_name = tripal_get_schema_name('chado');
-    $drupal_schema_name = tripal_get_schema_name('drupal');
+    $chado_schema_name = chado_get_schema_name('chado');
+    $drupal_schema_name = chado_get_schema_name('drupal');
     $sql = preg_replace('/\{(.*?)\}/', $chado_schema_name.'.$1', $sql);
     $sql = preg_replace('/\[(\w+)\]/', $drupal_schema_name.'.$1', $sql);
 
@@ -1747,7 +1747,7 @@ function chado_query($sql, $args = array()) {
  *    A string describing the SQL query to be executed by Tripal. All parameters
  *    should be indicated by :tokens with values being in the $args array and 
  *    all tables should be prefixed with the schema name described in 
- *    tripal_get_schema_name().
+ *    chado_get_schema_name().
  * @param $args
  *    An array of arguments where the key is the token used in $sql 
  *    (for example, :value) and the value is the value you would like
@@ -1987,7 +1987,7 @@ function chado_schema_get_foreign_key($table_desc, $field, $values, $options = N
  *
  * @ingroup tripal_chado_query_api
  */
-function tripal_get_schema_name($schema = 'chado') {
+function chado_get_schema_name($schema = 'chado') {
 
   // First we will set our default. This is what will be returned in most cases.
   if ($schema == 'chado') {
@@ -2002,7 +2002,7 @@ function tripal_get_schema_name($schema = 'chado') {
   // the names to be changed and ensure that schema names are never hardcoded
   // directly into queries.
   $context = array('schema' => $schema);
-  drupal_alter('tripal_get_schema_name', $schema_name, $context);
+  drupal_alter('chado_get_schema_name', $schema_name, $context);
 
   return $schema_name;
 }
@@ -2019,17 +2019,17 @@ function tripal_get_schema_name($schema = 'chado') {
  *
  * @param $schema_name
  *   The current name of the schema as known by Tripal. This is likely the 
- *   default set in tripal_get_schema_name() but in the case of multiple alter 
+ *   default set in chado_get_schema_name() but in the case of multiple alter 
  *   hooks, it might be different.
  * @param $context
  *   This is an array of items to provide context.
- *     - schema: this is the schema that was passed to tripal_get_schema_name() 
+ *     - schema: this is the schema that was passed to chado_get_schema_name() 
  *       and will be either "chado" or "drupal". This should be used to 
  *       determine you are changing the name of the correct schema.
  *
  * @ingroup tripal_chado_query_api
  */
-function hook_tripal_get_schema_name_alter($schema_name, $context) {
+function hook_chado_get_schema_name_alter($schema_name, $context) {
 
   // First we check which schema was passed to chado_get_schema().
   // Notice that we do not use $schema_name since it may already have

+ 7 - 7
tripal_chado/api/tripal_chado.schema.api.inc

@@ -51,7 +51,7 @@ function chado_table_exists($table) {
   // Get the default database and chado schema.
   global $databases;
   $default_db = $databases['default']['default']['database'];
-  $chado_schema = tripal_get_schema_name('chado');
+  $chado_schema = chado_get_schema_name('chado');
 
   // If we've already lookup up this table then don't do it again, as
   // we don't need to keep querying the database for the same tables.
@@ -128,7 +128,7 @@ function chado_column_exists($table, $column) {
   $args = array(
     ':table_name' => $table,
     ':column_name' => $column,
-    ':chado' => tripal_get_schema_name('chado'),
+    ':chado' => chado_get_schema_name('chado'),
     ':default_db' => $default_db
   );
   $results = db_query($sql, $args);
@@ -175,7 +175,7 @@ function chado_sequence_exists($sequence) {
   ";
   $args = array(
     ':sequence_name' => $sequence,
-    ':sequence_schema' => tripal_get_schema_name('chado'),
+    ':sequence_schema' => chado_get_schema_name('chado'),
     ':sequence_catalog' => $default_db
   );
   $results = db_query($sql, $args);
@@ -298,7 +298,7 @@ function chado_is_local() {
       has_schema_privilege(nspname, 'USAGE') AND
       nspname = :chado
   ";
-  $results = db_query($sql, array(':chado' => tripal_get_schema_name('chado')));
+  $results = db_query($sql, array(':chado' => chado_get_schema_name('chado')));
   $name = $results->fetchObject();
   if ($name) {
     variable_set('chado_schema_exists', FALSE);
@@ -322,7 +322,7 @@ function chado_is_installed() {
   global $databases;
 
   // first check if chado is in the $databases variable of the settings.php file
-  if (array_key_exists(tripal_get_schema_name('chado'), $databases)) {
+  if (array_key_exists(chado_get_schema_name('chado'), $databases)) {
     return TRUE;
   }
 
@@ -365,7 +365,7 @@ function chado_get_version($exact = FALSE, $warn_if_unsupported = FALSE) {
   if (!$is_local) {
     // If it's not in the drupal database check to see if it's specified in
     // the $db_url in the settings.php
-    if (!array_key_exists(tripal_get_schema_name('chado'), $databases)) {
+    if (!array_key_exists(chado_get_schema_name('chado'), $databases)) {
       // if it's not in the drupal database or specified in the $db_url then
       // return uninstalled as the version
       return 'not installed';
@@ -378,7 +378,7 @@ function chado_get_version($exact = FALSE, $warn_if_unsupported = FALSE) {
   else {
     $chado_exists = TRUE;
     // @todo we need a chado aware db_table_exists.
-    $prop_exists = db_table_exists(tripal_get_schema_name('chado') . '.chadoprop');
+    $prop_exists = db_table_exists(chado_get_schema_name('chado') . '.chadoprop');
   }
 
   // if the table doesn't exist then we don't know what version but we know

+ 7 - 7
tripal_chado/api/tripal_chado.semweb.api.inc

@@ -22,7 +22,7 @@
  * the Chado schema, this function should be called to indicate that the
  * table should be included in the semantic web. No associations are made for
  * the columns. The associations should be added using the
- * tripal_associate_chado_semweb_term() function.
+ * chado_associate_chado_semweb_term() function.
  *
  * If the table has already been added previously then this function does
  * nothing. It will not overwrite existing assocations.
@@ -35,7 +35,7 @@
  * 
  * @ingroup tripal_chado_semweb_api
  */
-function tripal_add_chado_semweb_table($chado_table) {
+function chado_add_chado_semweb_table($chado_table) {
 
   // Don't include the tripal temp tables.
   if (preg_match('/tripal_.+_temp/', $chado_table)) {
@@ -92,7 +92,7 @@ function tripal_add_chado_semweb_table($chado_table) {
  * 
  *  @ingroup tripal_chado_semweb_api
  */
-function tripal_associate_chado_semweb_term($chado_table, $chado_column, $term,
+function chado_associate_chado_semweb_term($chado_table, $chado_column, $term,
     $update = FALSE) {
 
   // Check for required arguments.
@@ -197,7 +197,7 @@ function tripal_associate_chado_semweb_term($chado_table, $chado_column, $term,
  * 
  *  @ingroup tripal_chado_semweb_api
  */
-function tripal_get_chado_semweb_term($chado_table, $chado_column, $options = array()) {
+function chado_get_chado_semweb_term($chado_table, $chado_column, $options = array()) {
   $cvterm_id = db_select('chado_semweb', 'CS')
     ->fields('CS', array('cvterm_id'))
     ->condition('chado_column', $chado_column)
@@ -211,7 +211,7 @@ function tripal_get_chado_semweb_term($chado_table, $chado_column, $options = ar
       return $cvterm;
     }
 
-    return tripal_format_chado_semweb_term($cvterm);
+    return chado_format_chado_semweb_term($cvterm);
   }
 }
 
@@ -225,7 +225,7 @@ function tripal_get_chado_semweb_term($chado_table, $chado_column, $options = ar
  * 
  *  @ingroup tripal_chado_semweb_api
  */
-function tripal_format_chado_semweb_term($cvterm) {
+function chado_format_chado_semweb_term($cvterm) {
   if ($cvterm) {
     return $cvterm->dbxref_id->db_id->name . ':' . $cvterm->dbxref_id->accession;
   }
@@ -246,7 +246,7 @@ function tripal_format_chado_semweb_term($cvterm) {
  * 
  *  @ingroup tripal_chado_semweb_api
  */
-function tripal_get_chado_semweb_column($chado_table, $term) {
+function chado_get_chado_semweb_column($chado_table, $term) {
   $columns = db_select('chado_semweb', 'CS')
     ->fields('CS')
     ->condition('chado_table', $chado_table)