tripal_library.api.inc 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * @file
  4. * Provides an application programming interface (API) to manage libraries
  5. */
  6. /**
  7. * @defgroup tripal_library_api Library API
  8. * @ingroup tripal_api
  9. * @{
  10. * Provides an application programming interface (API) to manage libraries
  11. * @}
  12. */
  13. /**
  14. * Retrieve properties of a given type for a given library
  15. *
  16. * @param $library_id
  17. * The library_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 library chado variable with the specified properties expanded
  23. *
  24. * @ingroup tripal_library_api
  25. */
  26. function tripal_library_get_property($library_id, $property) {
  27. return chado_get_property('library', $library_id, $property, 'library_property');
  28. }
  29. /**
  30. * Insert a given property
  31. *
  32. * @param $library_id
  33. * The library_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_library_api
  45. */
  46. function tripal_library_insert_property($library_id, $property, $value, $update_if_present = 0) {
  47. return chado_insert_property('library', $library_id, $property, 'library_property', $value, $update_if_present);
  48. }
  49. /**
  50. * Update a given property
  51. *
  52. * @param $library_id
  53. * The library_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 $library_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_library_api
  68. */
  69. function tripal_library_update_property($library_id, $property, $value, $insert_if_missing = 0) {
  70. return chado_update_property('library', $library_id, $property, 'library_property', $value, $insert_if_missing);
  71. }
  72. /**
  73. * Delete a given property
  74. *
  75. * @param $library_id
  76. * The library_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 $library_id and $property
  81. * and then it will be deleted
  82. *
  83. * @return
  84. * True of success, False otherwise
  85. *
  86. * @ingroup tripal_library_api
  87. */
  88. function tripal_library_delete_property($library_id, $property) {
  89. return chado_delete_property('library', $library_id, $property, 'library_property');
  90. }