function tripal_feature_set_vocabulary
1.x tripal_feature.admin.inc | tripal_feature_set_vocabulary() |
Related topics
4 calls to tripal_feature_set_vocabulary()
- tripal_features_set_taxonomy in tripal_feature/
includes/ tripal_feature.admin.inc - tripal_feature_sync_features in tripal_feature/
includes/ tripal_feature.sync_features.inc - tripal_library_taxonify_features in tripal_library/
includes/ tripal_library.admin.inc - tripal_organism_taxonify_features in tripal_organism/
includes/ tripal_organism.admin.inc
File
- tripal_feature/
includes/ tripal_feature.admin.inc, line 633 - @todo Add file header description
Code
function tripal_feature_set_vocabulary() {
//include the file containing the required functions for adding taxonomy vocabs
module_load_include('inc', 'taxonomy', 'taxonomy.admin');
// get the vocabularies so that we make sure we don't recreate
// the vocabs that already exist
$vocabularies = taxonomy_get_vocabularies();
$ft_vid = NULL;
$op_vid = NULL;
$lb_vid = NULL;
$an_vid = NULL;
// These taxonomic terms are hard coded because we
// konw we have these relationships in the chado tables
// through foreign key relationships. The tripal
// modules that correspond to these chado "modules" don't
// need to be installed for the taxonomy to work.
foreach ($vocabularies as $vocab) {
if ($vocab->name == 'Feature Type') {
$ft_vid = $vocab->vid;
}
if ($vocab->name == 'Organism') {
$op_vid = $vocab->vid;
}
if ($vocab->name == 'Library') {
$lb_vid = $vocab->vid;
}
if ($vocab->name == 'Analysis') {
$an_vid = $vocab->vid;
}
}
if (!$ft_vid) {
$form_state = array();
$values = array(
'name' => t('Feature Type'),
'nodes' => array('chado_feature' => 'chado_feature'),
'description' => t('The feature type (or SO cvterm for this feature).'),
'help' => t('Select the term that matches the feature'),
'tags' => 0,
'hierarchy' => 1,
'relations' => 1,
'multiple' => 0,
'required' => 0,
'weight' => 1,
);
drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
drupal_execute('taxonomy_form_vocabulary', $form_state);
}
if (!$op_vid) {
$form_state = array();
$values = array(
'name' => t('Organism'),
'nodes' => array('chado_feature' => 'chado_feature'),
'description' => t('The organism to which this feature belongs.'),
'help' => t('Select the term that matches the feature'),
'tags' => 0,
'hierarchy' => 1,
'relations' => 1,
'multiple' => 0,
'required' => 0,
'weight' => 2,
);
drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
drupal_execute('taxonomy_form_vocabulary', $form_state);
}
if (!$lb_vid) {
$form_state = array();
$values = array(
'name' => t('Library'),
'nodes' => array('chado_feature' => 'chado_feature'),
'description' => t('Chado features associated with a library are assigned the term associated with the library'),
'help' => t('Select the term that matches the feature'),
'tags' => 0,
'hierarchy' => 1,
'relations' => 1,
'multiple' => 0,
'required' => 0,
'weight' => 3,
);
drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
drupal_execute('taxonomy_form_vocabulary', $form_state);
}
if (!$an_vid) {
$form_state = array();
$values = array(
'name' => t('Analysis'),
'nodes' => array('chado_feature' => 'chado_feature'),
'description' => t('Any analysis to which this feature belongs.'),
'help' => t('Select the term that matches the feature'),
'tags' => 0,
'hierarchy' => 1,
'relations' => 1,
'multiple' => 1,
'required' => 0,
'weight' => 4,
);
drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
drupal_execute('taxonomy_form_vocabulary', $form_state);
}
}