tripal_project.api.inc 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /**
  3. * @file
  4. * Provides an application programming interface (API) to manage projects
  5. */
  6. /**
  7. * @defgroup tripal_project_api Project Module API
  8. * @ingroup tripal_api
  9. * @{
  10. * Provides an application programming interface (API) to manage projects
  11. * @}
  12. */
  13. /**
  14. * Retrieve properties of a given type for a given project
  15. *
  16. * @param $project_id
  17. * The project_id of the properties you would like to retrieve
  18. * @param $property
  19. * The cvterm name of the properties to retrieve
  20. *
  21. * @return
  22. * An project chado variable with the specified properties expanded
  23. *
  24. * @ingroup tripal_project_api
  25. */
  26. function tripal_project_get_property($project_id, $property) {
  27. return chado_get_property('project', $project_id, $property, 'project_property');
  28. }
  29. /**
  30. * Insert a given property
  31. *
  32. * @param $project_id
  33. * The project_id of the property to insert
  34. * @param $property
  35. * The cvterm name of the property to insert
  36. * @param $value
  37. * The value of the property to insert
  38. * @param $update_if_present
  39. * A boolean indicated whether to update the record if it's already present
  40. *
  41. * @return
  42. * True of success, False otherwise
  43. *
  44. * @ingroup tripal_project_api
  45. */
  46. function tripal_project_insert_property($project_id, $property, $value, $update_if_present = 0) {
  47. return chado_insert_property('project', $project_id, $property, 'project_property', $value, $update_if_present);
  48. }
  49. /**
  50. * Update a given property
  51. *
  52. * @param $project_id
  53. * The project_id of the property to update
  54. * @param $property
  55. * The cvterm name of the property to update
  56. * @param $value
  57. * The value of the property to update
  58. * @param $insert_if_missing
  59. * A boolean indicated whether to insert the record if it's absent
  60. *
  61. * Note: The property will be identified using the unique combination of the $project_id and $property
  62. * and then it will be updated with the supplied value
  63. *
  64. * @return
  65. * True of success, False otherwise
  66. *
  67. * @ingroup tripal_project_api
  68. */
  69. function tripal_project_update_property($project_id, $property, $value, $insert_if_missing = 0) {
  70. return chado_update_property('project', $project_id, $property, 'project_property', $value, $insert_if_missing);
  71. }
  72. /**
  73. * Delete a given property
  74. *
  75. * @param $project_id
  76. * The project_id of the property to delete
  77. * @param $property
  78. * The cvterm name of the property to delete
  79. *
  80. * Note: The property will be identified using the unique combination of the $project_id and $property
  81. * and then it will be deleted
  82. *
  83. * @return
  84. * True of success, False otherwise
  85. *
  86. * @ingroup tripal_project_api
  87. */
  88. function tripal_project_delete_property($project_id, $property) {
  89. return chado_delete_property('project', $project_id, $property, 'project_property');
  90. }