tripal_entities.install 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. <?php
  2. /**
  3. * @file
  4. * Install for a tripal data entity - creates the base table for our entity.
  5. */
  6. /**
  7. * Implements hook_install().
  8. */
  9. function tripal_entities_install() {
  10. // Create a number of Chado custom tables to keep track of vocabularies and terms
  11. // that are available for use with entities.
  12. // @TODO: Ask Stephen why these are chado instead of drupal tables...
  13. chado_create_custom_table(
  14. 'tripal_vocabulary',
  15. tripal_entities_tripal_vocabulary_schema(),
  16. TRUE
  17. );
  18. chado_create_custom_table(
  19. 'tripal_vocabulary_usage',
  20. tripal_entities_tripal_vocabulary_usage_schema(),
  21. TRUE
  22. );
  23. chado_create_custom_table(
  24. 'tripal_term',
  25. tripal_entities_tripal_term_schema(),
  26. TRUE
  27. );
  28. chado_create_custom_table(
  29. 'tripal_term_usage',
  30. tripal_entities_tripal_term_usage_schema(),
  31. TRUE
  32. );
  33. chado_create_custom_table(
  34. 'tripal_term_relationship',
  35. tripal_entities_tripal_term_relationship_schema(),
  36. TRUE
  37. );
  38. }
  39. /**
  40. * Implements hook_schema().
  41. */
  42. function tripal_entities_schema() {
  43. // Biological Data
  44. $schema['tripal_entity'] = tripal_entities_tripal_entity_schema();
  45. // Biological Data Types
  46. $schema['tripal_bundle'] = tripal_entities_tripal_bundle_schema();
  47. // Links Biological Data Entities to the chado "base" table the data is stored in.
  48. $schema['chado_entity'] = tripal_entities_chado_entity_schema();
  49. // @TODO: Move these tables into the tripal_fields_layout module.
  50. $schema['tripal_panels'] = array(
  51. 'description' => 'The list of panels into which fields can be placed.',
  52. 'fields' => array(
  53. 'panel_id' => array(
  54. 'description' => 'The primary identifier for this table.',
  55. 'type' => 'serial',
  56. 'unsigned' => TRUE,
  57. 'not null' => TRUE,
  58. ),
  59. 'bundle_id' => array(
  60. 'description' => 'A bundle ID from the tripal_bundle table.',
  61. 'type' => 'int',
  62. 'not null' => TRUE,
  63. ),
  64. 'name' => array(
  65. 'description' => 'The computer readable name for the panel. This name must only have alphanumerical characters and underscores and must not begin with a number. ',
  66. 'type' => 'varchar',
  67. 'length' => 128,
  68. 'not null' => TRUE,
  69. 'default' => '',
  70. ),
  71. 'label' => array(
  72. 'description' => 'A human readable name for panel. This name will be shown to users in the sidebar menu.',
  73. 'type' => 'varchar',
  74. 'length' => 128,
  75. 'not null' => TRUE,
  76. 'default' => '',
  77. ),
  78. 'settings' => array(
  79. 'description' => 'Contains a serialized array tripal_fields_layoutof settings for the panel.',
  80. 'type' => 'text',
  81. 'not null' => FALSE,
  82. ),
  83. 'weight' => array(
  84. 'type' => 'int',
  85. 'not null' => FALSE,
  86. 'default' => 0
  87. ),
  88. ),
  89. 'indexes' => array(
  90. 'bundle_id' => array('bundle_id'),
  91. ),
  92. 'unique keys' => array(
  93. 'bundle_panel' => array('bundle_id', 'name'),
  94. ),
  95. 'foreign keys' => array(
  96. 'tripal_bundle' => array(
  97. 'table' => 'tripal_bundle',
  98. 'columns' => array(
  99. 'bundle_id' => 'id',
  100. ),
  101. ),
  102. ),
  103. 'primary key' => array('panel_id'),
  104. );
  105. $schema['tripal_panel_fields'] = array(
  106. 'description' => 'The list of panels into which fields can be placed.',
  107. 'fields' => array(
  108. 'panel_field_id' => array(
  109. 'description' => 'The primary identifier for this table.',
  110. 'type' => 'serial',
  111. 'unsigned' => TRUE,
  112. 'not null' => TRUE,
  113. ),
  114. 'panel_id' => array(
  115. 'description' => 'The primary identifier for this table.',
  116. 'type' => 'int',
  117. 'not null' => TRUE,
  118. ),
  119. 'field_id' => array(
  120. 'description' => 'A bundle ID from the tripal_bundle table.',
  121. 'type' => 'int',
  122. 'not null' => TRUE,
  123. ),
  124. ),
  125. 'indexes' => array(
  126. 'panel_id' => array('panel_id'),
  127. 'field_id' => array('field_id'),
  128. ),
  129. 'unique keys' => array(
  130. 'panel_field' => array('panel_id', 'field_id'),
  131. ),
  132. 'foreign keys' => array(
  133. 'tripal_panel' => array(
  134. 'table' => 'tripal_panel',
  135. 'columns' => array(
  136. 'panel_id' => 'panel_id',
  137. ),
  138. ),
  139. 'field_config' => array(
  140. 'table' => 'field_config',
  141. 'columns' => array(
  142. 'field_id' => 'id',
  143. ),
  144. ),
  145. ),
  146. 'primary key' => array('panel_field_id'),
  147. );
  148. return $schema;
  149. }
  150. /**
  151. * Implements hook_uninstall().
  152. *
  153. * At uninstall time we'll notify field.module that the entity was deleted
  154. * so that attached fields can be cleaned up.
  155. */
  156. function tripal_entities_uninstall() {
  157. $terms = chado_generate_var('tripal_term', array('publish' => 1), array('return_array' => 1));
  158. foreach ($terms as $term) {
  159. $bundle_id = $term->cvterm_id->dbxref_id->db_id->name . '_' . $term->cvterm_id->dbxref_id->accession;
  160. field_attach_delete_bundle('BioData', $bundle_id);
  161. }
  162. }
  163. /**
  164. * @section
  165. * Schema Definitions.
  166. */
  167. /**
  168. * The base table for Biological Data Entities.
  169. *
  170. * This contains the actual data. For example, if you have a 5 genes and 10 mRNA then
  171. * this table will have 15 records and include both genes and mRNA's.
  172. */
  173. function tripal_entities_tripal_entity_schema() {
  174. $schema = array(
  175. 'description' => 'The base table for Tripal Vocabulary-based entities.',
  176. 'fields' => array(
  177. 'id' => array(
  178. 'description' => 'The primary identifier for a vocabulary entity.',
  179. 'type' => 'serial',
  180. 'unsigned' => TRUE,
  181. 'not null' => TRUE,
  182. ),
  183. 'type' => array(
  184. 'description' => 'The type of entity. This should be an official vocabulary ID (e.g. SO, RO, GO).',
  185. 'type' => 'varchar',
  186. 'length' => 64,
  187. 'not null' => TRUE,
  188. 'default' => '',
  189. ),
  190. 'bundle' => array(
  191. 'description' => 'The type of bundle. This should be an official vocabulary ID (e.g. SO, RO, GO) followed by an underscore and the term accession.',
  192. 'type' => 'varchar',
  193. 'length' => 1024,
  194. 'not null' => TRUE,
  195. 'default' => '',
  196. ),
  197. 'cvterm_id' => array(
  198. 'description' => 'The cvterm_id for the type of entity. This cvterm_id should match a record in the Chado cvterm table.',
  199. 'type' => 'int',
  200. 'not null' => TRUE,
  201. ),
  202. 'title' => array(
  203. 'description' => 'The title of this node, always treated as non-markup plain text.',
  204. 'type' => 'text',
  205. 'not null' => TRUE,
  206. 'default' => '',
  207. ),
  208. 'uid' => array(
  209. 'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.',
  210. 'type' => 'int',
  211. 'not null' => TRUE,
  212. 'default' => 0,
  213. ),
  214. 'status' => array(
  215. 'description' => 'Boolean indicating whether the node is published (visible to non-administrators).',
  216. 'type' => 'int',
  217. 'not null' => TRUE,
  218. 'default' => 1,
  219. ),
  220. 'created' => array(
  221. 'description' => 'The Unix timestamp when the node was created.',
  222. 'type' => 'int',
  223. 'not null' => TRUE,
  224. 'default' => 0,
  225. ),
  226. 'changed' => array(
  227. 'description' => 'The Unix timestamp when the node was most recently saved.',
  228. 'type' => 'int',
  229. 'not null' => TRUE,
  230. 'default' => 0,
  231. ),
  232. ),
  233. 'indexes' => array(
  234. 'cvterm_id' => array('cvterm_id'),
  235. 'entity_changed' => array('changed'),
  236. 'entity_created' => array('created'),
  237. 'type' => array('type'),
  238. 'uid' => array('uid'),
  239. ),
  240. 'unique keys' => array(
  241. ),
  242. 'primary key' => array('id'),
  243. );
  244. return $schema;
  245. }
  246. /**
  247. * The base table for Biological Data Type Entites.
  248. * This table contains a list of Biological Data Types.
  249. * For the example above (5 genes and 10 mRNAs), there would only be two records in
  250. * this table one for "gene" and another for "mRNA".
  251. */
  252. function tripal_entities_tripal_bundle_schema() {
  253. $schema = array(
  254. 'description' => 'Stores information about defined tripal data types.',
  255. 'fields' => array(
  256. 'id' => array(
  257. 'type' => 'serial',
  258. 'not null' => TRUE,
  259. 'description' => 'Primary Key: Unique Chado data type identifier.',
  260. ),
  261. 'type' => array(
  262. 'description' => 'The type of entity. This should be an official vocabulary ID (e.g. SO, RO, GO).',
  263. 'type' => 'varchar',
  264. 'length' => 64,
  265. 'not null' => TRUE,
  266. 'default' => '',
  267. ),
  268. 'bundle' => array(
  269. 'description' => 'The type of bundle. This should be an official vocabulary ID (e.g. SO, RO, GO) followed by an underscore and the term accession.',
  270. 'type' => 'varchar',
  271. 'length' => 1024,
  272. 'not null' => TRUE,
  273. 'default' => '',
  274. ),
  275. 'label' => array(
  276. 'description' => 'The human-readable name of this bundle.',
  277. 'type' => 'varchar',
  278. 'length' => 255,
  279. 'not null' => TRUE,
  280. 'default' => '',
  281. ),
  282. 'weight' => array(
  283. 'type' => 'int',
  284. 'not null' => TRUE,
  285. 'default' => 0,
  286. 'size' => 'tiny',
  287. 'description' => 'The weight of this tripal data type in relation to others.',
  288. ),
  289. 'data' => array(
  290. 'type' => 'text',
  291. 'not null' => FALSE,
  292. 'size' => 'big',
  293. 'serialize' => TRUE,
  294. 'description' => 'A serialized array of additional data related to this tripal data type.',
  295. ),
  296. ) + entity_exportable_schema_fields(),
  297. 'primary key' => array('id'),
  298. 'unique keys' => array(
  299. 'bundle' => array('bundle'),
  300. ),
  301. );
  302. return $schema;
  303. }
  304. /**
  305. * Links Biological Data Entities to the chado "base" table the data is stored in.
  306. * This is where we would specify that a particular gene maps to the record in the
  307. * chado.feature table with a feature_id=2432;
  308. */
  309. function tripal_entities_chado_entity_schema() {
  310. $schema = array(
  311. 'description' => 'The linker table that associates an enitity from the public.tripal_entity table with a "base" record in Chado',
  312. 'fields' => array(
  313. 'chado_entity_id' => array(
  314. 'description' => 'The primary identifier for this table.',
  315. 'type' => 'serial',
  316. 'unsigned' => TRUE,
  317. 'not null' => TRUE,
  318. ),
  319. 'entity_id' => array(
  320. 'description' => 'The unique entity id.',
  321. 'type' => 'int',
  322. 'not null' => TRUE,
  323. ),
  324. 'record_id' => array(
  325. 'description' => 'The unique numerical identifier for the record that this entity is associated with (e.g. feature_id, stock_id, library_id, etc.).',
  326. 'type' => 'int',
  327. 'not null' => TRUE,
  328. ),
  329. 'data_table' => array(
  330. 'description' => 'Indicates the table in Chado that this term services (e.g. feature, stock, library, etc.)',
  331. 'type' => 'varchar',
  332. 'length' => 128,
  333. 'not null' => TRUE,
  334. 'default' => '',
  335. ),
  336. 'type_table' => array(
  337. 'description' => 'Sometimes the record in the data table doesn’t have a field that specifies the record type. For example, an analysis type is stored in the analysisprop table. If the data_table does have a type field then this value will be the same as the data_table.',
  338. 'type' => 'varchar',
  339. 'length' => 128,
  340. 'not null' => TRUE,
  341. 'default' => '',
  342. ),
  343. 'field' => array(
  344. 'description' => 'The name of the field in the typetable that contains the cvterm record.',
  345. 'type' => 'varchar',
  346. 'length' => 128,
  347. 'not null' => FALSE,
  348. 'default' => ''
  349. ),
  350. ),
  351. 'indexes' => array(
  352. 'record_id' => array('record_id'),
  353. 'entity_id' => array('entity_id'),
  354. 'data_table' => array('data_table'),
  355. ),
  356. 'unique keys' => array(
  357. 'record' => array('data_table', 'record_id'),
  358. 'entity_id' => array('entity_id'),
  359. ),
  360. 'primary key' => array('chado_entity_id'),
  361. );
  362. return $schema;
  363. }
  364. /**
  365. * A list of published vocabularies.
  366. *
  367. * Usage: This table will be used by the Entity type admin page that lets the site admin
  368. * specify which vocabularies should be used as entity types. This table will only be
  369. * populated with vocabularies that are actually used within the Chado database. This
  370. * table will also be used by web services to provide a list of all of the entity types
  371. * that are available for access.
  372. */
  373. function tripal_entities_tripal_vocabulary_schema() {
  374. $schema = array (
  375. 'table' => 'tripal_vocabulary',
  376. 'fields' => array (
  377. 'vocabulary_id' => array(
  378. 'type' => 'serial',
  379. 'not null' => TRUE
  380. ),
  381. 'cv_id' => array (
  382. 'type' => 'int',
  383. 'not null' => TRUE
  384. ),
  385. 'db_id' => array (
  386. 'type' => 'int',
  387. 'not null' => TRUE
  388. ),
  389. 'publish' => array (
  390. 'type' => 'int',
  391. 'not null' => TRUE,
  392. 'default' => 0
  393. ),
  394. ),
  395. 'primary key' => array (
  396. 0 => 'vocabulary_id'
  397. ),
  398. 'foreign keys' => array (
  399. 'cv' => array (
  400. 'table' => 'cv',
  401. 'columns' => array (
  402. 'cv_id' => 'cv_id'
  403. )
  404. ),
  405. 'db' => array (
  406. 'table' => 'db',
  407. 'columns' => array (
  408. 'db_id' => 'db_id'
  409. )
  410. ),
  411. ),
  412. 'unique keys' => array (
  413. 'tripal_vocabulary_cvdb' => array (
  414. 'cv_id', 'db_id'
  415. ),
  416. ),
  417. 'indexes' => array(
  418. 'tripal_vocabulary_cv_id' => array('cv_id'),
  419. 'tripal_vocabulary_db_id' => array('db_id'),
  420. )
  421. );
  422. return $schema;
  423. }
  424. /**
  425. * A list of published terms.
  426. *
  427. * Usage: This table is used by web services to provide a list of all of the bundles
  428. * (i.e. vocabulary terms) that have data in the site. It is also used by the Entity
  429. * administrative pages to allow the site admin to specify which terms should be
  430. * publishable (i.e. used as bundles).
  431. */
  432. function tripal_entities_tripal_term_schema() {
  433. $schema = array (
  434. 'table' => 'tripal_term',
  435. 'fields' => array (
  436. 'term_id' => array(
  437. 'type' => 'serial',
  438. 'not null' => TRUE
  439. ),
  440. 'vocabulary_id' => array (
  441. 'type' => 'int',
  442. 'not null' => TRUE
  443. ),
  444. 'cvterm_id' => array (
  445. 'type' => 'int',
  446. 'not null' => TRUE
  447. ),
  448. 'publish' => array (
  449. 'type' => 'int',
  450. 'not null' => TRUE,
  451. 'default' => 0
  452. ),
  453. ),
  454. 'primary key' => array (
  455. 0 => 'term_id'
  456. ),
  457. 'foreign keys' => array (
  458. 'cvterm' => array (
  459. 'table' => 'cvterm',
  460. 'columns' => array (
  461. 'cvterm_id' => 'cvterm_id'
  462. )
  463. ),
  464. 'tripal_vocabulary' => array (
  465. 'table' => 'tripal_vocabulary',
  466. 'columns' => array (
  467. 'vocabulary_id' => 'vocabulary_id'
  468. )
  469. ),
  470. ),
  471. 'unique keys' => array (
  472. 'tripal_term_unq' => array (
  473. 'vocabulary_id', 'cvterm_id'
  474. ),
  475. ),
  476. 'indexes' => array(
  477. 'tripal_term_vocabulary_id' => array('vocabulary_id'),
  478. 'tripal_term_cvterm_id' => array('cvterm_id'),
  479. ),
  480. );
  481. return $schema;
  482. }
  483. /**
  484. *
  485. *
  486. * Specifies the source table in Chado where this entity will pull data. Because
  487. * vocabularies can be used in multiple tables there could be many entries here for each
  488. * vocabulary.
  489. *
  490. * Usage: This table is used by web services when querying for all of the records of a
  491. * given type. Web services must know where to look for records of a given term.
  492. */
  493. function tripal_entities_tripal_vocabulary_usage_schema(){
  494. $schema = array (
  495. 'table' => 'tripal_vocabulary_usage',
  496. 'fields' => array (
  497. 'vocabulary_usage_id' => array(
  498. 'type' => 'serial',
  499. 'not null' => TRUE
  500. ),
  501. 'vocabulary_id' => array (
  502. 'type' => 'int',
  503. 'not null' => TRUE
  504. ),
  505. 'data_table' => array (
  506. 'type' => 'varchar',
  507. 'length' => 128,
  508. 'not null' => TRUE
  509. ),
  510. 'type_table' => array (
  511. 'type' => 'varchar',
  512. 'length' => 128,
  513. 'not null' => TRUE
  514. ),
  515. 'field' => array (
  516. 'type' => 'varchar',
  517. 'length' => 128,
  518. 'not null' => TRUE
  519. ),
  520. ),
  521. 'primary key' => array (
  522. 0 => 'vocabulary_usage_id'
  523. ),
  524. 'foreign keys' => array (
  525. 'tripal_vocabulary' => array (
  526. 'table' => 'tripal_vocabulary',
  527. 'columns' => array (
  528. 'vocabulary_id' => 'vocabulary_id'
  529. ),
  530. ),
  531. ),
  532. 'unique keys' => array (
  533. 'tripal_vocabulary_ridbase' => array (
  534. 'vocabulary_id', 'data_table'
  535. ),
  536. ),
  537. 'indexes' => array(
  538. 'tripal_vocabulary_vocabulary_id' => array('vocabulary_id'),
  539. 'tripal_vocabulary_data_table' => array('data_table'),
  540. 'tripal_vocabulary_type_table' => array('type_table'),
  541. ),
  542. );
  543. return $schema;
  544. }
  545. /**
  546. *
  547. *
  548. * Specifies the source table in Chado where this bundle will pull data. Because terms
  549. * can be used in multiple tables there could be many entries here for each term.
  550. *
  551. * Note: this table contains the list of tables where a particular cvterm is used,
  552. * whereas, the tripal_entity_type_source just provides a list of where cvterms from a
  553. * particular vocabulary might be found.
  554. */
  555. function tripal_entities_tripal_term_usage_schema() {
  556. $schema = array (
  557. 'table' => 'tripal_term_usage',
  558. 'fields' => array (
  559. 'term_usage_id' => array(
  560. 'type' => 'serial',
  561. 'not null' => TRUE
  562. ),
  563. 'term_id' => array (
  564. 'type' => 'int',
  565. 'not null' => TRUE
  566. ),
  567. 'data_table' => array (
  568. 'type' => 'varchar',
  569. 'length' => 128,
  570. 'not null' => TRUE
  571. ),
  572. 'type_table' => array (
  573. 'type' => 'varchar',
  574. 'length' => 128,
  575. 'not null' => TRUE
  576. ),
  577. 'field' => array (
  578. 'type' => 'varchar',
  579. 'length' => 128,
  580. 'not null' => TRUE
  581. ),
  582. ),
  583. 'primary key' => array (
  584. 0 => 'term_usage_id'
  585. ),
  586. 'foreign keys' => array (
  587. 'tripal_term' => array (
  588. 'table' => 'tripal_term',
  589. 'columns' => array (
  590. 'term_id' => 'term_id'
  591. ),
  592. ),
  593. ),
  594. 'unique keys' => array (
  595. 'tripal_term_usage_ridbase' => array (
  596. 'term_id', 'type_table', 'field'
  597. ),
  598. ),
  599. 'indexes' => array(
  600. 'tripal_term_usage_term_id' => array('term_id'),
  601. ),
  602. );
  603. return $schema;
  604. }
  605. /**
  606. *
  607. *
  608. * Specifies the predicates used for the semantic web for all properties of a bundle.
  609. *
  610. * Usage: When fields are added to an entity then there must be some “relationship” term
  611. * (i.e. predicate) that indicates the meaning of the relationship. This predicate must
  612. * itself be a cvterm from a vocabulary. For all fields that are automatically added to
  613. * bundles by tripal there should be a record here. The site admin should be able to
  614. * change these if desired, but there should be some sort of default set by Tripal
  615. * itself. This will require that all fields for all tables in Chado have some default
  616. * predicate value. Also, relationship between two different bundles (whether published
  617. * or not) should also have a relationship predicate. See the section in the
  618. * specification for how default predicates are set.
  619. */
  620. function tripal_entities_tripal_term_relationship_schema() {
  621. $schema = array (
  622. 'table' => 'tripal_term_relationship',
  623. 'fields' => array (
  624. 'relationship_id' => array(
  625. 'type' => 'serial',
  626. 'not null' => TRUE
  627. ),
  628. 'subject_id' => array (
  629. 'type' => 'int',
  630. 'not null' => TRUE
  631. ),
  632. 'type_id' => array (
  633. 'type' => 'int',
  634. 'not null' => TRUE
  635. ),
  636. 'object_id' => array (
  637. 'type' => 'int',
  638. 'not null' => FALSE
  639. ),
  640. 'fieldname' => array(
  641. 'type' => 'varchar',
  642. 'length' => 128,
  643. 'not null' => FALSE,
  644. )
  645. ),
  646. 'primary key' => array (
  647. 0 => 'relationship_id'
  648. ),
  649. 'foreign keys' => array (
  650. 'tripal_term' => array (
  651. 'table' => 'tripal_term',
  652. 'columns' => array (
  653. 'subject_id' => 'term_id',
  654. 'object_id' => 'term_id',
  655. ),
  656. ),
  657. ),
  658. 'unique keys' => array (
  659. 'tripal_term_relationship_unq' => array (
  660. 'subject_id', 'type_id', 'object_id'
  661. ),
  662. ),
  663. 'indexes' => array(
  664. 'tripal_term_relationship_subject_id' => array('subject_id'),
  665. 'tripal_term_relationship_object_id' => array('object_id'),
  666. 'tripal_term_relationship_type_id' => array('type_id'),
  667. ),
  668. );
  669. return $schema;
  670. }