tripal_library.api.inc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. /**
  3. * Implements hook_chado_library_schema()
  4. * Purpose: To add descriptions and foreign keys to default table description
  5. * Note: This array will be merged with the array from all other implementations
  6. *
  7. * @return
  8. * Array describing the library table
  9. *
  10. * @ingroup tripal_library
  11. */
  12. function tripal_library_chado_library_schema() {
  13. $description = array();
  14. // Default table description in tripal_core.schema.api.inc: tripal_core_chado_feature_schema()
  15. $description['foreign keys']['organism'] = array(
  16. 'table' => 'organism',
  17. 'columns' => array(
  18. 'organism_id' => 'organism_id',
  19. ),
  20. );
  21. $description['foreign keys']['cvterm'] = array(
  22. 'table' => 'cvterm',
  23. 'columns' => array(
  24. 'type_id' => 'cvterm_id',
  25. ),
  26. );
  27. $referring_tables = array(
  28. 'library_cvterm',
  29. 'library_feature',
  30. 'library_pub',
  31. 'library_synonym',
  32. 'libraryprop'
  33. );
  34. $description['referring_tables'] = $referring_tables;
  35. return $description;
  36. }
  37. /**
  38. * Implements hook_chado_library_feature_schema()
  39. * Purpose: To add descriptions and foreign keys to default table description
  40. * Note: This array will be merged with the array from all other implementations
  41. *
  42. * @return
  43. * Array describing the library_feature table
  44. *
  45. * @ingroup tripal_library
  46. */
  47. function tripal_library_chado_library_feature_schema() {
  48. $description = array();
  49. // Default table description in tripal_core.schema.api.inc: tripal_core_chado_library_feature_schema()
  50. $description['foreign keys']['library'] = array(
  51. 'table' => 'library',
  52. 'columns' => array(
  53. 'library_id' => 'library_id',
  54. ),
  55. );
  56. $description['foreign keys']['feature'] = array(
  57. 'table' => 'feature',
  58. 'columns' => array(
  59. 'feature_id' => 'feature_id',
  60. ),
  61. );
  62. return $description;
  63. }
  64. /**
  65. * Implements hook_chado_libraryprop_schema()
  66. * Purpose: To add descriptions and foreign keys to default table description
  67. * Note: This array will be merged with the array from all other implementations
  68. *
  69. * @return
  70. * Array describing the libraryprop table
  71. *
  72. * @ingroup tripal_library
  73. */
  74. function tripal_library_chado_libraryprop_schema() {
  75. $description = array();
  76. // Default table description in tripal_core.schema.api.inc: tripal_core_chado_library_feature_schema()
  77. $description['foreign keys']['library'] = array(
  78. 'table' => 'library',
  79. 'columns' => array(
  80. 'library_id' => 'library_id',
  81. ),
  82. );
  83. $description['foreign keys']['cvterm'] = array(
  84. 'table' => 'cvterm',
  85. 'columns' => array(
  86. 'type_id' => 'cvterm_id',
  87. ),
  88. );
  89. return $description;
  90. }
  91. /**
  92. * Adds a single property to an existing library record.
  93. *
  94. * @ingroup tripal_api
  95. */
  96. function tripal_library_get_property($library_id,$property){
  97. return tripal_core_get_property('library',$library_id,$property,'tripal');
  98. }
  99. /**
  100. * Adds a single property to an existing library record.
  101. *
  102. * @ingroup tripal_api
  103. */
  104. function tripal_library_insert_property($library_id,$property,$value,$update_if_present = 0){
  105. return tripal_core_insert_property('library',$library_id,$property,'tripal',$value,$update_if_present);
  106. }
  107. /**
  108. * Adds a single property to an existing library record.
  109. *
  110. * @ingroup tripal_api
  111. */
  112. function tripal_library_update_property($library_id,$property,$value,$insert_if_missing = 0){
  113. return tripal_core_update_property('library',$library_id,$property,'tripal',$value, $insert_if_missing);
  114. }
  115. /**
  116. * Adds a single property to an existing library record.
  117. *
  118. * @ingroup tripal_api
  119. */
  120. function tripal_library_delete_property($library_id,$property){
  121. return tripal_core_delete_property('library',$library_id,$property,'tripal');
  122. }