Tripal
Functions
Chado Materalized Views
Collaboration diagram for Chado Materalized Views:

Functions

 chado_add_mview ($name, $modulename, $mv_schema, $query, $comment=NULL, $redirect=TRUE)
 
 chado_edit_mview ($mview_id, $name, $modulename, $mv_table, $mv_specs, $indexed, $query, $special_index, $comment=NULL, $mv_schema=NULL)
 
 chado_get_mview_id ($view_name)
 
 chado_get_mview_table_names ()
 
 chado_refresh_mview ($mview_id)
 
 chado_get_mviews ()
 
 chado_delete_mview ($mview_id)
 
 chado_populate_mview ($mview_id)
 

Detailed Description

Provides an application programming interface (API) to manage materialized views in Chado The Perl-based chado comes with an interface for managing materialzed views. This API provides an alternative Drupal-based method.

Function Documentation

◆ chado_add_mview()

chado_add_mview (   $name,
  $modulename,
  $mv_schema,
  $query,
  $comment = NULL,
  $redirect = TRUE 
)

Add a materialized view to the chado database.

Parameters
$nameThe name of the materialized view.
$modulenameThe name of the module submitting the materialized view (e.g. 'tripal_library').
$mv_schemaIf 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.
$queryThe SQL query that loads the materialized view with data.
$commentA string containing a description of the materialized view.
$redirectOptional (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.
Returns
TRUE if the materialized view was successfully added, FALSE otherwise.

◆ chado_delete_mview()

chado_delete_mview (   $mview_id)

Does the specified action for the specified Materialized View.

Parameters
$opThe action to be taken. One of update or delete.
$mview_idThe unique ID of the materialized view for the action to be performed on.
Returns
TRUE if the deletion was a success, FALSE on error.

◆ chado_edit_mview()

chado_edit_mview (   $mview_id,
  $name,
  $modulename,
  $mv_table,
  $mv_specs,
  $indexed,
  $query,
  $special_index,
  $comment = NULL,
  $mv_schema = NULL 
)

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.

Parameters
$mview_idThe mview_id of the materialized view to edit.
$nameThe name of the materialized view.
$modulenameThe name of the module submitting the materialized view (e.g. 'tripal_library').
$mv_tableThe name of the table to add to chado. This is the table that can be queried.
$mv_specsThe table definition.
$indexedThe columns that are to be indexed.
$queryThe SQL query that loads the materialized view with data.
$special_indexcurrently not used.
$commentA string containing a description of the materialized view.
$mv_schemaIf using the newer Schema API array to define the materialized view then this variable should contain the array.

◆ chado_get_mview_id()

chado_get_mview_id (   $view_name)

Retrieve the materialized view_id given the name.

Parameters
$view_nameThe name of the materialized view.
Returns
The unique identifier for the given view.

◆ chado_get_mview_table_names()

chado_get_mview_table_names ( )

Retrieves the list of materialized views in this site.

Returns
An associative array where the key and value pairs are the table names.

◆ chado_get_mviews()

chado_get_mviews ( )

Retrieves the list of materialized view IDs and their names.

Returns
An array of objects with the following properties: mview_id, name.

◆ chado_populate_mview()

chado_populate_mview (   $mview_id)

Populate a Materialized View.

Parameters
$mview_idThe unique identifier for the materialized view to be updated.
Returns
True if successful, FALSE otherwise.

◆ chado_refresh_mview()

chado_refresh_mview (   $mview_id)

Populates the specified Materialized View.

Parameters
$mview_idThe unique ID of the materialized view for the action to be performed on.