tripal_library.api.inc 2.6 KB

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