Tripal
|
Functions | |
tripal_get_default_cv ($table, $field) | |
tripal_get_default_cv_table ($cv_id) | |
tripal_get_cvterm_default_select_options ($table, $field, $field_desc) | |
tripal_set_default_cv ($table, $field, $cv_name, $cv_id=FALSE) | |
Provides an application programming interface (API) to manage entities that use Chado as their base data.
tripal_get_cvterm_default_select_options | ( | $table, | |
$field, | |||
$field_desc | |||
) |
Create an options array to be used in a form element which provides a list of all chado cvterms. Unlike the tripal_get_cvterm_select_option, this function retrieves the cvterms using the default vocabulary set for a given table and field. It will also notify the administrative user if a default vocabulary is missing for the field and if the vocabulary is empty.
$table | The name of the table that contains the field with a foreign key relationship to the cvterm table |
$field | The table field name that has the foreign key relationship to the cvterm table for which the default vocabulary will be set |
$field_desc | A human readable descriptive name for the field |
tripal_get_default_cv | ( | $table, | |
$field | |||
) |
Retrieves the default vocabulary for a given table and field.
Each table in Chado that has a 'type_id' (or foreign key constraint to the cvterm table) will have a default vocabulary assigned. This indicates to Tripal that terms in that vocabulary are used to set the type_id for that table. An example where this is used is the tripal_get_cvterm_select_options() function which generates a list of options for a select box used in a Drupal form. The select box will list the terms from the default vocabulary in the drop down.
This function uses the Chado table and field name (e.g. 'type_id') to retrieve the vocabulary assgined.
$table | The name of the table that contains a field with a foreign key relationship to the cvterm table |
$field | The table field name that has the foreign key relationship to the cvterm table for which the default vocabulary will be set |
tripal_get_default_cv_table | ( | $cv_id | ) |
Retrieves the Chado table to which a vocbulary is set as default.
Each table in Chado that has a 'type_id' (or foreign key constraint to the cvterm table) will have a default vocabulary assigned. This indicates to Tripal that terms in that vocabulary are used to set the type_id for that table. An example where this is used is the tripal_get_cvterm_select_options() function which generates a list of options for a select box used in a Drupal form. The select box will list the terms from the default vocabulary in the drop down.
This function uses the vocabulary ID to get the Chado table to which it is assigned.
$cv_id | The ID of the vocabulary. |
tripal_set_default_cv | ( | $table, | |
$field, | |||
$cv_name, | |||
$cv_id = FALSE |
|||
) |
This function sets the default vocabulary for a given table and field.
$table | The name of the table that contains a field with a foreign key relationship to the cvterm table |
$field | The table field name that has the foreign key relationship to the cvterm table for which the default vocabulary will be set |
$cv_name | The name of the vocabulary |