tripal_organism.chado_node.inc 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <?php
  2. /**
  3. * @file
  4. * Implements the organims node content type
  5. */
  6. /**
  7. * Implements hook_node_info().
  8. *
  9. * Provide information to drupal about the node types that we're creating
  10. * in this module
  11. *
  12. * @ingroup tripal_organism
  13. */
  14. function tripal_organism_node_info() {
  15. $nodes = array();
  16. $nodes['chado_organism'] = array(
  17. 'name' => t('Organism'),
  18. 'base' => 'chado_organism',
  19. 'description' => t('An organism'),
  20. 'has_title' => TRUE,
  21. 'locked' => TRUE,
  22. 'chado_node_api' => array(
  23. 'base_table' => 'organism',
  24. 'hook_prefix' => 'chado_organism',
  25. 'record_type_title' => array(
  26. 'singular' => t('Organism'),
  27. 'plural' => t('Organisms')
  28. ),
  29. 'sync_filters' => array(
  30. 'type_id' => FALSE,
  31. 'organism_id' => FALSE,
  32. 'checkboxes' => array('genus', 'species'),
  33. ),
  34. )
  35. );
  36. return $nodes;
  37. }
  38. /**
  39. * Implement hook_node_access().
  40. *
  41. * This hook allows node modules to limit access to the node types they define.
  42. *
  43. * @param $node
  44. * The node on which the operation is to be performed, or, if it does not yet exist, the
  45. * type of node to be created
  46. *
  47. * @param $op
  48. * The operation to be performed
  49. *
  50. *
  51. * @param $account
  52. * A user object representing the user for whom the operation is to be performed
  53. *
  54. * @return
  55. * If the permission for the specified operation is not set then return FALSE. If the
  56. * permission is set then return NULL as this allows other modules to disable
  57. * access. The only exception is when the $op == 'create'. We will always
  58. * return TRUE if the permission is set.
  59. *
  60. * @ingroup tripal_organism
  61. */
  62. function chado_organism_node_access($node, $op, $account) {
  63. $node_type = $node;
  64. if (is_object($node)) {
  65. $node_type = $node->type;
  66. }
  67. if($node_type == 'chado_organism') {
  68. if ($op == 'create') {
  69. if (!user_access('create chado_organism content', $account)) {
  70. return NODE_ACCESS_DENY;
  71. }
  72. return NODE_ACCESS_ALLOW;
  73. }
  74. if ($op == 'update') {
  75. if (!user_access('edit chado_organism content', $account)) {
  76. return NODE_ACCESS_DENY;
  77. }
  78. }
  79. if ($op == 'delete') {
  80. if (!user_access('delete chado_organism content', $account)) {
  81. return NODE_ACCESS_DENY;
  82. }
  83. }
  84. if ($op == 'view') {
  85. if (!user_access('access chado_organism content', $account)) {
  86. return NODE_ACCESS_DENY;
  87. }
  88. }
  89. return NODE_ACCESS_IGNORE;
  90. }
  91. }
  92. /**
  93. * Implement hook_form().
  94. *
  95. * When editing or creating a new node of type 'chado_organism' we need
  96. * a form. This function creates the form that will be used for this.
  97. *
  98. * @ingroup tripal_organism
  99. */
  100. function chado_organism_form($node, $form_state) {
  101. $form = array();
  102. // we have a file upload element on the form soe we need the multipart encoding type
  103. $form['#attributes']['enctype'] = 'multipart/form-data';
  104. // if the organism is part of the node object then we are editing. If not we are inserting
  105. if (property_exists($node, 'organism')) {
  106. $organism = $node->organism;
  107. // add in the comment since it is a text field and may not be included if too big
  108. $organism = chado_expand_var($organism, 'field', 'organism.comment');
  109. // get form defaults
  110. $abbreviation = property_exists($node, 'abbreviation') ? property_exists($node, 'abbreviation') : $organism->abbreviation;
  111. $genus = property_exists($node, 'genus') ? property_exists($node, 'genus') : $organism->genus;
  112. $species = property_exists($node, 'species') ? property_exists($node, 'species') : $organism->species;
  113. $common_name = property_exists($node, 'common_name') ? property_exists($node, 'common_name') : $organism->common_name;
  114. $description = property_exists($node, 'description') ? property_exists($node, 'description') : $organism->comment;
  115. $organism_image = property_exists($node, 'organism_image') ? property_exists($node, 'organism_image') : '';
  116. // set the organism_id in the form
  117. $form['organism_id'] = array(
  118. '#type' => 'value',
  119. '#value' => $organism->organism_id,
  120. );
  121. $organism_id = $organism->organism_id;
  122. }
  123. else {
  124. // get form defaults
  125. $abbreviation = property_exists($node, 'abbreviation') ? property_exists($node, 'abbreviation') : '';
  126. $genus = property_exists($node, 'genus') ? property_exists($node, 'genus') : '';
  127. $species = property_exists($node, 'species') ? property_exists($node, 'species') : '';
  128. $common_name = property_exists($node, 'common_name') ? property_exists($node, 'common_name') : '';
  129. $description = property_exists($node, 'description') ? property_exists($node, 'description') : '';
  130. $organism_image = property_exists($node, 'organism_image') ? property_exists($node, 'organism_image') : '';
  131. $organism_id = NULL;
  132. }
  133. $form['genus']= array(
  134. '#type' => 'textfield',
  135. '#title' => t('Genus'),
  136. '#required' => TRUE,
  137. '#default_value' => $genus,
  138. );
  139. $form['species']= array(
  140. '#type' => 'textfield',
  141. '#title' => t('Species'),
  142. '#required' => TRUE,
  143. '#default_value' => $species,
  144. );
  145. $form['abbreviation']= array(
  146. '#type' => 'textfield',
  147. '#title' => t('Abbreviation'),
  148. '#required' => TRUE,
  149. '#default_value' => $abbreviation,
  150. );
  151. $form['common_name']= array(
  152. '#type' => 'textfield',
  153. '#title' => t('Common Name'),
  154. '#required' => TRUE,
  155. '#default_value' => $common_name,
  156. );
  157. $form['description']= array(
  158. '#type' => 'text_format',
  159. '#rows' => 15,
  160. '#title' => t('Description'),
  161. '#default_value' => $description,
  162. );
  163. $form['organism_image']= array(
  164. '#type' => 'managed_file',
  165. '#title' => t('Organism Image'),
  166. '#description' => t('Add an image to display for this organism.'),
  167. '#progress_indicator' => 'bar',
  168. '#upload_location' => 'public://tripal/tripal_organism/images/',
  169. );
  170. // PROPERTIES FORM
  171. //---------------------------------------------
  172. $prop_cv = tripal_get_default_cv('organismprop', 'type_id');
  173. $cv_id = $prop_cv ? $prop_cv->cv_id : NULL;
  174. $details = array(
  175. 'property_table' => 'organismprop', // the name of the prop table
  176. 'chado_id' => $organism_id, // the value of organism_id for this record
  177. 'cv_id' => $cv_id // the cv.cv_id of the cv governing organismprop.type_id
  178. );
  179. // Adds the form elements to your current form
  180. chado_add_node_form_properties($form, $form_state, $details);
  181. // ADDITIONAL DBXREFS FORM
  182. //---------------------------------------------
  183. $details = array(
  184. 'linking_table' => 'organism_dbxref', // the name of the _dbxref table
  185. 'base_foreign_key' => 'organism_id', // the name of the key in your base chado table
  186. 'base_key_value' => $organism_id // the value of organism_id for this record
  187. );
  188. // Adds the form elements to your current form
  189. chado_add_node_form_dbxrefs($form, $form_state, $details);
  190. return $form;
  191. }
  192. /**
  193. * Implementation of hook_validate().
  194. *
  195. * @param $node
  196. * @param $form
  197. * @param $form_state
  198. *
  199. * @ingroup tripal_organism
  200. */
  201. function chado_organism_validate($node, $form, &$form_state) {
  202. // We only want to validate when the node is saved.
  203. // Since this validate can be called on AJAX and Deletion of the node
  204. // we need to make this check to ensure queries are not executed
  205. // without the proper values.
  206. if(property_exists($node, "op") and $node->op != 'Save') {
  207. return;
  208. }
  209. // we are syncing if we do not have a node ID but we do have a organism_id. We don't
  210. // need to validate during syncing so just skip it.
  211. if (!property_exists($node, 'nid') and property_exists($node, 'organism_id') and $node->organism_id != 0) {
  212. return;
  213. }
  214. // remove any white space around values
  215. $node->genus = property_exists($node, 'genus') ? trim($node->genus) : '';
  216. $node->species = property_exists($node, 'species') ? trim($node->species) : '';
  217. $node->abbreviation = property_exists($node, 'abbreviation') ? trim($node->abbreviation) : '';
  218. $node->common_name = property_exists($node, 'common_name') ? trim($node->common_name) : '';
  219. // Validating for an update
  220. if (property_exists($node, 'organism_id')) {
  221. $sql = "
  222. SELECT *
  223. FROM {organism} O
  224. WHERE
  225. genus = :genus AND
  226. species = :species AND NOT
  227. organism_id = :organism_id
  228. ";
  229. $args = array(':genus' => $node->genus, ':species' => $node->species, ':organism_id' => $node->organism_id);
  230. $result = chado_query($sql, $args)->fetchObject();
  231. if ($result) {
  232. form_set_error('genus', t("Update cannot proceed. The organism genus
  233. '$node->genus' and species '$node->species' is already present in the database."));
  234. tripal_report_error('tripal_organism', TRIPAL_WARNING,
  235. 'Update organism: genus and species already exists: %values',
  236. array('%values' => "genus = $node->genus, species = $node->species"));
  237. }
  238. }
  239. // Validating for an insert
  240. else {
  241. $values = array(
  242. 'genus' => $node->genus,
  243. 'species' => $node->species,
  244. );
  245. $organism = chado_select_record('organism', array('organism_id'), $values);
  246. if (sizeof($organism) > 0) {
  247. form_set_error('genus', 'Cannot add the organism with this genus and species.
  248. The organism already exists.');
  249. tripal_report_error('tripal_organism', TRIPAL_WARNING,
  250. 'Insert organism: genus and species already exists: %values',
  251. array('%values' => "genus = $node->genus, species = $node->species"));
  252. }
  253. }
  254. }
  255. /**
  256. * Implements hook_insert().
  257. *
  258. * When a new chado_organism node is created we also need to add information
  259. * to our chado_organism table. This function is called on insert of a new node
  260. * of type 'chado_organism' and inserts the necessary information.
  261. *
  262. * @ingroup tripal_organism
  263. */
  264. function chado_organism_insert($node) {
  265. $organism_id = '';
  266. // if there is an organism_id in the $node object then this must be a sync so
  267. // we can skip adding the organism as it is already there, although
  268. // we do need to proceed with insertion into the chado/drupal linking table.
  269. if (!property_exists($node, 'organism_id')) {
  270. // remove any white space around values
  271. $node->genus = trim($node->genus);
  272. $node->species = trim($node->species);
  273. $node->abbreviation = trim($node->abbreviation);
  274. $node->common_name = trim($node->common_name);
  275. $node->description = trim($node->description['value']);
  276. $values = array(
  277. 'genus' => $node->genus,
  278. 'species' => $node->species,
  279. 'abbreviation' => $node->abbreviation,
  280. 'common_name' => $node->common_name,
  281. 'comment' => $node->description
  282. );
  283. $organism = chado_insert_record('organism', $values);
  284. if (!$organism) {
  285. drupal_set_message(t('Unable to add organism.', 'warning'));
  286. tripal_report_error('tripal_organism', TRIPAL_ERROR, 'Insert Organism: Unable to create organism where values:%values',
  287. array('%values' => print_r($values, TRUE)));
  288. return;
  289. }
  290. $organism_id = $organism['organism_id'];
  291. if ($organism_id) {
  292. // * Properties Form *
  293. $details = array(
  294. 'property_table' => 'organismprop', // the name of the prop table
  295. 'base_table' => 'organism', // the name of your chado base table
  296. 'foreignkey_name' => 'organism_id', // the name of the key in your base table
  297. 'foreignkey_value' => $organism_id // the value of the example_id key
  298. );
  299. chado_update_node_form_properties($node, $details);
  300. // * Additional DBxrefs Form *
  301. $details = array(
  302. 'linking_table' => 'organism_dbxref', // the name of your _dbxref table
  303. 'foreignkey_name' => 'organism_id', // the name of the key in your base table
  304. 'foreignkey_value' => $organism_id // the value of the organism_id key
  305. );
  306. chado_update_node_form_dbxrefs($node, $details);
  307. }
  308. }
  309. else {
  310. $organism_id = $node->organism_id;
  311. }
  312. // Make sure the entry for this organism doesn't already exist in the
  313. // chado_organism table if it doesn't exist then we want to add it.
  314. $check_org_id = chado_get_id_from_nid('organism', $node->nid);
  315. if (!$check_org_id) {
  316. $record = new stdClass();
  317. $record->nid = $node->nid;
  318. $record->vid = $node->vid;
  319. $record->organism_id = $organism_id;
  320. drupal_write_record('chado_organism', $record);
  321. }
  322. // add the image
  323. if (property_exists($node, 'organism_image')) {
  324. chado_organism_add_image($node);
  325. }
  326. }
  327. /**
  328. * Implements hook_update().
  329. *
  330. * @ingroup tripal_organism
  331. */
  332. function chado_organism_update($node) {
  333. // remove any white space around values
  334. $node->genus = trim($node->genus);
  335. $node->species = trim($node->species);
  336. $node->abbreviation = trim($node->abbreviation);
  337. $node->common_name = trim($node->common_name);
  338. $node->description = trim($node->description['value']);
  339. $organism_id = chado_get_id_from_nid('organism', $node->nid);
  340. if ($node->revision) {
  341. // there is no way to handle revisions in Chado but leave
  342. // this here just to make not we've addressed it.
  343. }
  344. $match = array(
  345. 'organism_id' => $organism_id,
  346. );
  347. $values = array(
  348. 'genus' => $node->genus,
  349. 'species' => $node->species,
  350. 'abbreviation' => $node->abbreviation,
  351. 'common_name' => $node->common_name,
  352. 'comment' => $node->description
  353. );
  354. $org_status = chado_update_record('organism', $match, $values);
  355. if ( $node->organism_image != '' ) {
  356. chado_organism_add_image($node);
  357. }
  358. // * Properties Form *
  359. $details = array(
  360. 'property_table' => 'organismprop', // the name of the prop table
  361. 'base_table' => 'organism', // the name of your chado base table
  362. 'foreignkey_name' => 'organism_id', // the name of the key in your base table
  363. 'foreignkey_value' => $organism_id // the value of the example_id key
  364. );
  365. chado_update_node_form_properties($node, $details);
  366. // * Additional DBxrefs Form *
  367. $details = array(
  368. 'linking_table' => 'organism_dbxref', // the name of your _dbxref table
  369. 'foreignkey_name' => 'organism_id', // the name of the key in your base table
  370. 'foreignkey_value' => $organism_id // the value of the organism_id key
  371. );
  372. chado_update_node_form_dbxrefs($node, $details);
  373. }
  374. /**
  375. * Adds the image to the organism node and cleans up any old images.
  376. *
  377. * @param $node
  378. * The node object.
  379. */
  380. function chado_organism_add_image($node) {
  381. // If there is already an organism image, then remove it it if
  382. // no other modules are using it
  383. $fid = db_select('file_usage', 'fu')
  384. ->fields('fu', array('fid'))
  385. ->condition('module', 'tripal_organism')
  386. ->condition('type', 'organism_image')
  387. ->condition('id', $node->nid)
  388. ->execute()
  389. ->fetchField();
  390. if ($fid) {
  391. $file = file_load($fid);
  392. file_usage_delete($file, 'tripal_organism', 'organism_image', $node->nid);
  393. file_delete($file);
  394. }
  395. // Save the uploaded file
  396. $file = file_load($node->organism_image);
  397. if ($file) {
  398. $file->status = FILE_STATUS_PERMANENT;
  399. file_save($file);
  400. file_usage_add($file, 'tripal_organism', 'organism_image', $node->nid);
  401. }
  402. }
  403. /**
  404. * Implements hook_delete().
  405. *
  406. * Delete organism from both drupal and chado databases. Check dependency before
  407. * deleting from chado.
  408. *
  409. * @ingroup tripal_organism
  410. */
  411. function chado_organism_delete($node) {
  412. $organism_id = chado_get_id_from_nid('organism', $node->nid);
  413. // if we don't have an organism id for this node then this isn't a node of
  414. // type chado_organism or the entry in the chado_organism table was lost.
  415. if (!$organism_id) {
  416. return;
  417. }
  418. // Remove data from the {chado_organism}, {node}, and {node_revisions} tables
  419. $sql_del = "DELETE FROM {chado_organism} WHERE nid = :nid AND vid = :vid";
  420. db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
  421. $sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
  422. db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
  423. $sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
  424. db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
  425. // Test dependency before deleting from chado database. If a library or
  426. // feature depends on this organism, don't delete it
  427. $sql = "SELECT feature_id FROM {feature} WHERE organism_id = :organism_id";
  428. $check_feature = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
  429. $sql = "SELECT library_id FROM {library} WHERE organism_id = :organism_id";
  430. $check_lib = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
  431. $sql = "SELECT stock_id FROM {stock} WHERE organism_id = :organism_id";
  432. $check_stock = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
  433. if (!$check_lib && !$check_feature && !$check_stock) {
  434. chado_delete_record('organism', array('organism_id' => $organism_id));
  435. }
  436. else {
  437. drupal_set_message(t("Warning: other data depends on this organism. The organism page was removed from this site but the organism was removed from Chado."), 'warning');
  438. }
  439. }
  440. /**
  441. * Implements hook_load().
  442. *
  443. * When a node is requested by the user this function is called to allow us
  444. * to add auxiliary data to the node object.
  445. *
  446. * @ingroup tripal_organism
  447. */
  448. function chado_organism_load($nodes) {
  449. foreach ($nodes as $nid => $node) {
  450. // find the organism and add in the details
  451. $organism_id = chado_get_id_from_nid('organism', $nid);
  452. // if the nid does not have a matching record then skip this node.
  453. // this can happen with orphaned nodes.
  454. if (!$organism_id) {
  455. continue;
  456. }
  457. // build the organism variable
  458. $values = array('organism_id' => $organism_id);
  459. $organism = chado_generate_var('organism', $values);
  460. // add in the description field
  461. $organism = chado_expand_var($organism, 'field', 'organism.comment');
  462. $nodes[$nid]->organism = $organism;
  463. // Now get the title
  464. $node->title = chado_get_node_title($node);
  465. }
  466. }
  467. /**
  468. * Implements hook_node_presave(). Acts on all content types.
  469. *
  470. * @param $node
  471. * The node to be saved
  472. *
  473. * @ingroup tripal_organism
  474. */
  475. function tripal_organism_node_presave($node) {
  476. switch ($node->type) {
  477. // This step is for setting the title for the Drupal node. This title
  478. // is permanent and thus is created to be unique. Title changes provided
  479. // by tokens are generated on the fly dynamically, but the node title
  480. // seen in the content listing needs to be set here. Do not call
  481. // the chado_get_node_title() function here to set the title as the node
  482. // object isn't properly filled out and the function will fail.
  483. case 'chado_organism':
  484. // when syncing the details are not present in the $node object
  485. // as they are when submitted via the form. Therefore, if we do
  486. // not see any field values from the form, we assume this fucntion
  487. // is being called for syncing, so we must set the title accordingly
  488. if (property_exists($node, 'genus')) {
  489. $node->title = $node->genus . " " . $node->species;
  490. }
  491. else if (property_exists($node, 'organism')) {
  492. $node->title = $node->organism->genus . " " . $node->organism->species;
  493. }
  494. break;
  495. }
  496. }
  497. /**
  498. * Implements hook_node_view().
  499. *
  500. * @ingroup tripal_organism
  501. */
  502. function tripal_organism_node_view($node, $view_mode, $langcode) {
  503. switch ($node->type) {
  504. case 'chado_organism':
  505. // Show feature browser and counts
  506. if ($view_mode == 'full') {
  507. $node->content['tripal_organism_base'] = array(
  508. '#theme' => 'tripal_organism_base',
  509. '#node' => $node,
  510. '#tripal_toc_id' => 'base',
  511. '#tripal_toc_title' => 'Overview',
  512. '#weight' => -100,
  513. );
  514. $node->content['tripal_organism_properties'] = array(
  515. '#theme' => 'tripal_organism_properties',
  516. '#node' => $node,
  517. '#tripal_toc_id' => 'properties',
  518. '#tripal_toc_title' => 'Properties',
  519. );
  520. $node->content['tripal_organism_references'] = array(
  521. '#theme' => 'tripal_organism_references',
  522. '#node' => $node,
  523. '#tripal_toc_id' => 'references',
  524. '#tripal_toc_title' => 'Cross References',
  525. );
  526. }
  527. if ($view_mode == 'teaser') {
  528. $node->content['tripal_organism_teaser'] = array(
  529. '#theme' => 'tripal_organism_teaser',
  530. '#node' => $node,
  531. );
  532. }
  533. break;
  534. }
  535. }
  536. /**
  537. * Implements hook_node_insert().
  538. * Acts on all content types.
  539. *
  540. * @ingroup tripal_organism
  541. */
  542. function tripal_organism_node_insert($node) {
  543. switch ($node->type) {
  544. case 'chado_organism':
  545. // find the organism and add in the details
  546. $organism_id = chado_get_id_from_nid('organism', $node->nid);
  547. $values = array('organism_id' => $organism_id);
  548. $organism = chado_generate_var('organism', $values);
  549. $node->organism = $organism;
  550. // Now get the title
  551. $node->title = chado_get_node_title($node);
  552. // Now use the API to set the path.
  553. chado_set_node_url($node);
  554. break;
  555. }
  556. }
  557. /**
  558. * Implements hook_node_update().
  559. * Acts on all content types.
  560. *
  561. * @ingroup tripal_organism
  562. */
  563. function tripal_organism_node_update($node) {
  564. switch ($node->type) {
  565. case 'chado_organism':
  566. // Now get the title.
  567. $node->title = chado_get_node_title($node);
  568. // Now use the API to set the path.
  569. chado_set_node_url($node);
  570. break;
  571. }
  572. }
  573. /**
  574. * Implements [content_type]_chado_node_default_title_format().
  575. *
  576. * Defines a default title format for the Chado Node API to set the titles on
  577. * Chado organism nodes based on chado fields.
  578. */
  579. function chado_organism_chado_node_default_title_format() {
  580. return '[organism.genus] [organism.species]';
  581. }
  582. /**
  583. * Implements hook_chado_node_default_url_format().
  584. *
  585. * Designates a default URL format for organism nodes.
  586. */
  587. function chado_organism_chado_node_default_url_format() {
  588. return '/organism/[organism.genus]/[organism.species]';
  589. }