Forráskód Böngészése

Added FK relationships to v1.11 schema API and adjusted hooks to remove FK definitions in other modules

spficklin 12 éve
szülő
commit
5340d4b068

+ 13 - 77
tripal_analysis/tripal_analysis.api.inc

@@ -116,7 +116,7 @@ function tripal_analysis_get_node($analysis_id) {
  */
 
 /**
- * Implements hook_chado_analysis_schema()
+ * Implements hook_chado_schema_v1_11_table()
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
@@ -125,10 +125,10 @@ function tripal_analysis_get_node($analysis_id) {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_analysis_chado_analysis_schema() {
+function tripal_analysis_chado_schema_v1_11_analysis() {
   $description = array();
 
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_analysis_schema()
+  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_schema_v1_11_analysis()
 
   $referring_tables = array(
       'analysisfeature',
@@ -142,91 +142,27 @@ function tripal_analysis_chado_analysis_schema() {
 }
 
 /**
- * Implements hook_chado_analysisfeature_schema()
+ * Implements hook_chado_schema_v1_2_table()
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
- *    Array describing the analysisfeature table
+ *    Array describing the analysis table
  *
  * @ingroup tripal_schema_api
  */
-function tripal_analysis_chado_analysisfeature_schema() {
+function tripal_analysis_chado_schema_v1_2_analysis() {
   $description = array();
 
-  $description['foreign keys']['feature'] = array(
-        'table' => 'feature',
-        'columns' => array(
-          'feature_id' => 'feature_id',
-        ),
-  );
-
-  $description['foreign keys']['analysis'] = array(
-        'table' => 'analysis',
-        'columns' => array(
-          'analysis_id' => 'analysis_id',
-        ),
-  );
-
-  return $description;
-}
-
-/**
- * Implements hook_chado_analysisfeatureprop_schema()
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the analysisfeatureprop table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_analysis_chado_analysisfeatureprop_schema() {
-  $description = array();
+  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_schema_v1_2_analysis()
 
-  $description['foreign keys']['analysisfeature'] = array(
-        'table' => 'analysisfeature',
-        'columns' => array(
-          'analysisfeature_id' => 'analysisfeature_id',
-        ),
-  );
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-  return $description;
-}
-
-
-/**
-  * Implements hook_chado_analysisprop_schema()
-  * Purpose: To add descriptions and foreign keys to default table description
-  * Note: This array will be merged with the array from all other implementations
-  *
-  * @return
-  *    Array describing the analysisprop table
-  *
-  * @ingroup tripal_schema_api
-  */
-function tripal_analysis_chado_analysisprop_schema() {
-  $description = array();
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-
-  $description['foreign keys']['analysis'] = array(
-        'table' => 'analysis',
-        'columns' => array(
-          'analysis_id' => 'analysis_id',
-        ),
+  $referring_tables = array(
+      'analysisfeature',
+      'analysisprop',
+      'phylotree',
+      'quantification'
   );
+  $description['referring_tables'] = $referring_tables;
 
   return $description;
 }

+ 0 - 57
tripal_contact/tripal_contact.api.inc

@@ -1,60 +1,3 @@
 <?php
 
-/**
- * @file
- * @todo Add file header description
- */
 
-/**
- * @section Chado Table Descriptions
- */
-
- /**
- * Implements hook_chado_contact_schema()
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the contact table
- */
-function tripal_stock_chado_contact_schema() {
-  $description = array();
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-
-  return $description;
-}
-
- /**
- * Implements hook_chado_contact_relationship_schema()
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the contact_relationship table
- */
-function tripal_stock_chado_contact_relationship_schema() {
-  $description = array();
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-
-  $description['foreign keys']['contact'] = array(
-        'table' => 'contact',
-        'columns' => array(
-          'subject_id' => 'contact_id',
-          'object_id' => 'contact_id',
-        ),
-  );
-
-  return $description;
-}

+ 10 - 2
tripal_core/api/get_FKs.php

@@ -11,8 +11,11 @@
 //
 // example usage in drupal directory root:
 //
-// php ./sites/all/modules/tripal/tripal_core/get_FKs.php -v 1.2 > \
-//   ./sites/all/modules/tripal/tripal_core/tripal_core.schema_v1.2.api.inc.new
+// php ./sites/all/modules/tripal/tripal_core/api/get_FKs.php -v 1.11 > \
+//   ./sites/all/modules/tripal/tripal_core/apitripal_core.schema_v1.11.api.inc.new
+//
+// php ./sites/all/modules/tripal/tripal_core/api/get_FKs.php -v 1.2 > \
+//   ./sites/all/modules/tripal/tripal_core/api/tripal_core.schema_v1.2.api.inc.new
 
 
 $arguments = getopt("v:");
@@ -56,8 +59,13 @@ function get_chado_fk_relationships($version){
   // iterate through the tables and get the foreign keys
   print "<?php\n";
   foreach ($tables as $table){
+
      // get the existing table array
      $table_arr = tripal_core_get_chado_table_schema($table);
+     
+     if(empty($table_arr)){
+        print "ERROR: emptye table definition $table\n";
+     }
 
      // get the foreign keys and add them to the array
      $fks = db_query($sql,$table);

+ 1 - 2
tripal_core/api/tripal_core.api.inc

@@ -1,7 +1,7 @@
 <?php
 
-require_once "tripal_core.schema_v1.11.api.inc";
 require_once "tripal_core.schema_v1.2.api.inc";
+require_once "tripal_core.schema_v1.11.api.inc";
 
 /**
  * @file
@@ -2286,5 +2286,4 @@ function tripal_core_get_chado_table_schema($table) {
    $table_arr = module_invoke_all("chado_schema_v".$v."_" . $table);
 
    return $table_arr;
-   
 }

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 876 - 6
tripal_core/api/tripal_core.schema_v1.11.api.inc


+ 0 - 28
tripal_cv/tripal_cv.api.inc

@@ -242,35 +242,7 @@ function tripal_cv_get_cvterm_options($cv_id = 0) {
 
 }
 
-/**
- * Implements hook_chado_cvterm_schema()
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the cvterm table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_cv_chado_cvterm_schema() {
-  $description = array();
-
-  $description['foreign keys']['cv'] = array(
-        'table' => 'cv',
-        'columns' => array(
-          'cv_id' => 'cv_id',
-        ),
-  );
-
-  $description['foreign keys']['dbxref'] = array(
-        'table' => 'dbxref',
-        'columns' => array(
-          'dbxref_id' => 'dbxref_id',
-        ),
-  );
 
-  return $description;
-}
 
 /**
  * Adds a controlled vocabular to the CV table of Chado.

+ 0 - 22
tripal_db/tripal_db.api.inc

@@ -275,28 +275,6 @@ function tripal_db_get_dbxref_by_accession($accession, $db_id=0) {
   return $r;
 }
 
-/**
- * Implements hook_chado_dbxref_schema()
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the dbxref table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_db_chado_dbxref_schema() {
-  $description = array();
-
-  $description['foreign keys']['db'] = array(
-        'table' => 'db',
-        'columns' => array(
-          'db_id' => 'db_id',
-        ),
-  );
-
-  return $description;
-}
 /**
  * Adds a new database to the Chado DB table and returns the DB object.
  *

+ 32 - 22
tripal_feature/tripal_feature.api.inc

@@ -14,10 +14,10 @@
  *
  * @ingroup tripal_schema_api
  */
-function tripal_feature_chado_feature_schema() {
+function tripal_feature_chado_schema_v1_11_feature() {
   $description = array();
 
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_feature_schema()
+  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_schema_v1_11_feature()
 
   $description['foreign keys']['organism'] = array(
         'table' => 'organism',
@@ -73,10 +73,10 @@ function tripal_feature_chado_feature_schema() {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_feature_chado_featureprop_schema() {
+function tripal_feature_chado_schema_v1_11_featureprop() {
   $description = array();
 
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_featureprop_schema()
+  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_schema_v1_11_featureprop()
 
   $description['foreign keys']['feature'] = array(
         'table' => 'feature',
@@ -101,7 +101,7 @@ function tripal_feature_chado_featureprop_schema() {
 }
 
 /**
- * Implements hook_chado_featureloc_schema()
+ * Implements hook_chado_schema_v1_11_table()
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
@@ -110,18 +110,28 @@ function tripal_feature_chado_featureprop_schema() {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_feature_chado_featureloc_schema() {
+function tripal_feature_chado_schema_v1_11_featureloc() {
   $description = array();
 
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_featureloc_schema()
-
-  $description['foreign keys']['feature'] = array(
-        'table' => 'feature',
-        'columns' => array(
-          'feature_id' => 'feature_id',
-          'srcfeature_id' => 'feature_id'
-        ),
+  $referring_tables = array('analysisfeature',
+    'featureloc_pub',
   );
+  $description['referring_tables'] = $referring_tables;
+
+  return $description;
+}
+/**
+ * Implements hook_chado_schema_v1_2_table()
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the featureloc table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_feature_chado_schema_v1_2_featureloc() {
+  $description = array();
 
   $referring_tables = array('analysisfeature',
     'featureloc_pub',
@@ -141,10 +151,10 @@ function tripal_feature_chado_featureloc_schema() {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_feature_chado_feature_dbxref_schema() {
+function tripal_feature_chado_schema_v1_11_feature_dbxref() {
   $description = array();
 
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_feature_dbxref_schema()
+  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_schema_v1_11_feature_dbxref()
 
   $description['foreign keys']['feature'] = array(
         'table' => 'feature',
@@ -172,10 +182,10 @@ function tripal_feature_chado_feature_dbxref_schema() {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_feature_chado_feature_relationship_schema() {
+function tripal_feature_chado_schema_v1_11_feature_relationship() {
   $description = array();
 
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_feature_dbxref_schema()
+  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_schema_v1_11_feature_dbxref()
 
   $description['foreign keys']['feature'] = array(
         'table' => 'feature',
@@ -202,10 +212,10 @@ function tripal_feature_chado_feature_relationship_schema() {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_feature_chado_feature_cvterm_schema() {
+function tripal_feature_chado_schema_v1_11_feature_cvterm() {
   $description = array();
 
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_feature_dbxref_schema()
+  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_schema_v1_11_feature_dbxref()
 
   $description['foreign keys']['feature'] = array(
         'table' => 'feature',
@@ -232,10 +242,10 @@ function tripal_feature_chado_feature_cvterm_schema() {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_feature_chado_feature_synonym_schema() {
+function tripal_feature_chado_schema_v1_11_feature_synonym() {
   $description = array();
 
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_feature_dbxref_schema()
+  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_schema_v1_11_feature_dbxref()
 
   $description['foreign keys']['feature'] = array(
         'table' => 'feature',

+ 11 - 25
tripal_genetic/tripal_genetic.api.inc

@@ -43,7 +43,7 @@ function tripal_genetic_get_genotypes_by_feature_id($feature_id) {
 
 
 /**
- * Implements hook_chado_genotype_schema()
+ * Implements hook_chado_schema_v1_11_table()
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
@@ -52,7 +52,7 @@ function tripal_genetic_get_genotypes_by_feature_id($feature_id) {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_genetic_chado_genotype_schema() {
+function tripal_genetic_chado_schema_v1_11_genotype() {
   $description = array();
 
   $referring_tables = array('analysisfeature',
@@ -67,9 +67,8 @@ function tripal_genetic_chado_genotype_schema() {
   return $description;
 
 }
-
 /**
- * Implements hook_chado_genotype_schema()
+ * Implements hook_chado_schema_v1_2_table()
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
@@ -78,30 +77,17 @@ function tripal_genetic_chado_genotype_schema() {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_genetic_chado_feature_genotype_schema() {
+function tripal_genetic_chado_schema_v1_2_genotype() {
   $description = array();
 
-  $description['foreign keys']['feature'] = array(
-        'table' => 'feature',
-        'columns' => array(
-          'feature_id' => 'feature_id',
-          'chromosome_id' => 'feature_id',
-        ),
-  );
-
-  $description['foreign keys']['genotype'] = array(
-        'table' => 'genotype',
-        'columns' => array(
-          'genotype_id' => 'genotype_id',
-        ),
-  );
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'cvterm_id' => 'cvterm_id',
-        ),
+  $referring_tables = array('analysisfeature',
+    'feature_genotype',
+    'phendesc',
+    'phenotype_comparison',
+    'phenstatement',
+    'stock_genotype',
   );
+  $description['referring_tables'] = $referring_tables;
 
   return $description;
 

+ 12 - 66
tripal_library/tripal_library.api.inc

@@ -11,7 +11,7 @@
  */
 
 /**
- * Implements hook_chado_library_schema()
+ * Implements hook_chado_schema_v1_11_table()
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
@@ -20,25 +20,8 @@
  *
  * @ingroup tripal_schema_api
  */
-function tripal_library_chado_library_schema() {
+function tripal_library_chado_schema_v1_11_library() {
   $description = array();
-
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_feature_schema()
-
-  $description['foreign keys']['organism'] = array(
-        'table' => 'organism',
-        'columns' => array(
-          'organism_id' => 'organism_id',
-        ),
-  );
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-
   $referring_tables = array(
       'library_cvterm',
       'library_feature',
@@ -52,67 +35,30 @@ function tripal_library_chado_library_schema() {
 }
 
 /**
- * Implements hook_chado_library_feature_schema()
+ * Implements hook_chado_schema_v1_2_table()
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
- *    Array describing the library_feature table
+ *    Array describing the library table
  *
  * @ingroup tripal_schema_api
  */
-function tripal_library_chado_library_feature_schema() {
+function tripal_library_chado_schema_v1_2_library() {
   $description = array();
-
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_library_feature_schema()
-
-  $description['foreign keys']['library'] = array(
-        'table' => 'library',
-        'columns' => array(
-          'library_id' => 'library_id',
-        ),
-  );
-
-  $description['foreign keys']['feature'] = array(
-        'table' => 'feature',
-        'columns' => array(
-          'feature_id' => 'feature_id',
-        ),
+  $referring_tables = array(
+      'library_cvterm',
+      'library_feature',
+      'library_pub',
+      'library_synonym',
+      'libraryprop'
   );
+  $description['referring_tables'] = $referring_tables;
 
   return $description;
 }
-/**
- * Implements hook_chado_libraryprop_schema()
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the libraryprop table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_library_chado_libraryprop_schema() {
-  $description = array();
-
-  // Default table description in tripal_core.schema.api.inc: tripal_core_chado_library_feature_schema()
-
-  $description['foreign keys']['library'] = array(
-        'table' => 'library',
-        'columns' => array(
-          'library_id' => 'library_id',
-        ),
-  );
 
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
 
-  return $description;
-}
 
 /**
  * Retrieve properties of a given type for a given library

+ 336 - 35
tripal_natural_diversity/tripal_natural_diversity.api.inc

@@ -4,7 +4,18 @@
  * @todo Add file header description
  */
 
-function tripal_natural_diversity_chado_nd_experiment_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment() {
   $description = array();
 
   $description = array(
@@ -55,8 +66,48 @@ function tripal_natural_diversity_chado_nd_experiment_schema() {
 
   return $description;
 }
+/**
+ * Implements hook_chado_schema_v1_2_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_2_nd_experiment() {
+  $description = array();
+
+  $description = array(
+    'referring_tables' => array(
+      'nd_experiment_contact',
+      'nd_experiment_dbxref',
+      'nd_experiment_genotype',
+      'nd_experiment_phenotype',
+      'nd_experiment_project',
+      'nd_experiment_protocol',
+      'nd_experiment_pub',
+      'nd_experiment_stock',
+      'nd_experimentprop'
+    ),
+  );
 
-function tripal_natural_diversity_chado_nd_experiment_contact_schema() {
+  return $description;
+}
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_contact table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_contact() {
   $description = array();
 
   $description = array(
@@ -99,8 +150,18 @@ function tripal_natural_diversity_chado_nd_experiment_contact_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_experiment_dbxref_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_dbxref table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_dbxref() {
   $description = array();
 
   $description = array(
@@ -143,8 +204,18 @@ function tripal_natural_diversity_chado_nd_experiment_dbxref_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_experiment_genotype_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_genotype table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_genotype() {
   $description = array();
 
   $description = array(
@@ -187,8 +258,18 @@ function tripal_natural_diversity_chado_nd_experiment_genotype_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_experiment_phenotype_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_phenotype table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_phenotype() {
   $description = array();
 
   $description = array(
@@ -231,8 +312,18 @@ function tripal_natural_diversity_chado_nd_experiment_phenotype_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_experiment_project_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_project table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_project() {
   $description = array();
 
   $description = array(
@@ -275,8 +366,18 @@ function tripal_natural_diversity_chado_nd_experiment_project_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_experiment_protocol_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_protocol table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_protocol() {
   $description = array();
 
   $description = array(
@@ -319,8 +420,18 @@ function tripal_natural_diversity_chado_nd_experiment_protocol_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_experiment_pub_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_pub table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_pub() {
   $description = array();
 
   $description = array(
@@ -363,8 +474,18 @@ function tripal_natural_diversity_chado_nd_experiment_pub_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_experiment_stock_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_stock table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_stock() {
   $description = array();
 
   $description = array(
@@ -418,8 +539,41 @@ function tripal_natural_diversity_chado_nd_experiment_stock_schema() {
 
   return $description;
 }
+/**
+ * Implements hook_chado_schema_v1_2_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_stock table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_2_nd_experiment_stock() {
+  $description = array();
 
-function tripal_natural_diversity_chado_nd_experiment_stockprop_schema() {
+  $description = array( 
+    'referring_tables' => array(
+      'nd_experiment_stock_dbxref',
+      'nd_experiment_stockprop',
+    ),
+  );
+
+  return $description;
+}
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_stockprop table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_stockprop() {
   $description = array();
 
   $description = array(
@@ -469,8 +623,18 @@ function tripal_natural_diversity_chado_nd_experiment_stockprop_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_experiment_stock_dbxref_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experiment_stock_dbxref table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experiment_stock_dbxref() {
   $description = array();
 
   $description = array(
@@ -513,8 +677,18 @@ function tripal_natural_diversity_chado_nd_experiment_stock_dbxref_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_experimentprop_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_experimentprop table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_experimentprop() {
   $description = array();
 
   $description = array(
@@ -564,8 +738,18 @@ function tripal_natural_diversity_chado_nd_experimentprop_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_geolocation_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_geolocation table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_geolocation() {
   $description = array();
 
   $description = array(
@@ -602,8 +786,41 @@ function tripal_natural_diversity_chado_nd_geolocation_schema() {
 
   return $description;
 }
+/**
+ * Implements hook_chado_schema_v1_2_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_geolocation table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_2_nd_geolocation() {
+  $description = array();
 
-function tripal_natural_diversity_chado_nd_geolocationprop_schema() {
+  $description = array(
+    'referring_tables' => array(
+      'nd_experiment',
+      'nd_geolocationprop'
+    ),
+  );
+
+  return $description;
+}
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_geolocationprop table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_geolocationprop() {
   $description = array();
 
   $description = array(
@@ -653,8 +870,18 @@ function tripal_natural_diversity_chado_nd_geolocationprop_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_protocol_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_protocol table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_protocol() {
   $description = array();
 
   $description = array(
@@ -681,8 +908,42 @@ function tripal_natural_diversity_chado_nd_protocol_schema() {
 
   return $description;
 }
+/**
+ * Implements hook_chado_schema_v1_2_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_protocol table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_2_nd_protocol() {
+  $description = array();
+
+  $description = array(
+    'referring_tables' => array(
+      'nd_experiment_protocol',
+      'nd_protocol_reagent',
+      'nd_protocolprop'
+    ),
+  );
 
-function tripal_natural_diversity_chado_nd_protocol_reagent_schema() {
+  return $description;
+}
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_protocol_reagent table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_protocol_reagent() {
   $description = array();
 
   $description = array(
@@ -735,8 +996,18 @@ function tripal_natural_diversity_chado_nd_protocol_reagent_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_protocolprop_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_protocolprop table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_protocolprop() {
   $description = array();
 
   $description = array(
@@ -786,8 +1057,18 @@ function tripal_natural_diversity_chado_nd_protocolprop_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_reagent_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_reagent table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_reagent() {
   $description = array();
 
   $description = array(
@@ -826,8 +1107,18 @@ function tripal_natural_diversity_chado_nd_reagent_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_reagent_relationship_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_reagent_relationship table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_reagent_relationship() {
   $description = array();
 
   $description = array(
@@ -872,8 +1163,18 @@ function tripal_natural_diversity_chado_nd_reagent_relationship_schema() {
 
   return $description;
 }
-
-function tripal_natural_diversity_chado_nd_reagentprop_schema() {
+/**
+ * Implements hook_chado_schema_v1_11_table()
+ *
+ * Purpose: To add descriptions and foreign keys to default table description
+ * Note: This array will be merged with the array from all other implementations
+ *
+ * @return
+ *    Array describing the nd_reagentprop table
+ *
+ * @ingroup tripal_schema_api
+ */
+function tripal_natural_diversity_chado_schema_v1_11_nd_reagentprop() {
   $description = array();
 
   $description = array(

+ 16 - 17
tripal_organism/tripal_organism.api.inc

@@ -73,7 +73,7 @@ function tripal_organism_get_organism_by_organism_id($organism_id) {
  */
 
 /**
- * Implements hook_chado_organism_schema()
+ * Implements hook_chado_schema_v1_11_table()
  *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
@@ -83,7 +83,7 @@ function tripal_organism_get_organism_by_organism_id($organism_id) {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_organism_chado_organism_schema() {
+function tripal_organism_chado_schema_v1_11_organism() {
   $description = array();
 
   $referring_tables = array(
@@ -102,35 +102,34 @@ function tripal_organism_chado_organism_schema() {
 }
 
 /**
- * Implements hook_chado_organismprop_schema()
+ * Implements hook_chado_schema_v1_2_table()
  *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
- *    Array describing the organismprop table
+ *    Array describing the organism table
  *
  * @ingroup tripal_schema_api
  */
-function tripal_organism_chado_organismprop_schema() {
+function tripal_organism_chado_schema_v1_2_organism() {
   $description = array();
 
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-
-  $description['foreign keys']['organism'] = array(
-        'table' => 'organism',
-        'columns' => array(
-          'organism_id' => 'organism_id',
-        ),
+  $referring_tables = array(
+    'biomaterial',
+    'feature',
+    'library',
+    'organism_dbxref',
+    'organismprop',
+    'phylonode_organism',
+    'stock',
+    'wwwuser_organism'
   );
+  $description['referring_tables'] = $referring_tables;
 
   return $description;
 }
+
 /**
  *  Returns a list of organisms that are currently synced with Drupal
  * @ingroup tripal_organism_api

+ 15 - 354
tripal_stock/tripal_stock.api.inc

@@ -320,7 +320,7 @@ function tripal_stock_get_stock_by_name_identifier($name, $organism_id) {
 }
 
 /**
- * Implements hook_chado_stock_schema()
+ * Implements hook_chado_schema_v1_11_table()
  *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
@@ -330,32 +330,11 @@ function tripal_stock_get_stock_by_name_identifier($name, $organism_id) {
  *
  * @ingroup tripal_schema_api
  */
-function tripal_stock_chado_stock_schema() {
+function tripal_stock_chado_schema_v1_11_stock() {
   $description = array();
 
   $description['description'] = 'Any stock can be globally identified by the combination of organism, uniquename and stock type. A stock is the physical entities, either living or preserved, held by collections. Stocks belong to a collection; they have IDs, type, organism, description and may have a genotype.';
 
-  $description['foreign keys']['organism'] = array(
-        'table' => 'organism',
-        'columns' => array(
-          'organism_id' => 'organism_id',
-        ),
-  );
-
-  $description['foreign keys']['dbxref'] = array(
-        'table' => 'dbxref',
-        'columns' => array(
-          'dbxref_id' => 'dbxref_id',
-        ),
-  );
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-
   $referring_tables = array(
     'stock_cvterm',
     'stock_dbxref',
@@ -371,350 +350,32 @@ function tripal_stock_chado_stock_schema() {
 }
 
 /**
- * Implements hook_chado_stockprop_schema()
- *
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the stockprop table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_stock_chado_stockprop_schema() {
-  $description = array();
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-
-  $description['foreign keys']['stock'] = array(
-        'table' => 'stock',
-        'columns' => array(
-          'stock_id' => 'stock_id',
-        ),
-  );
-
-  return $description;
-}
-
-/**
- * Implements hook_chado_stockprop_pub_schema()
- *
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the stockprop_pub table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_stock_chado_stockprop_pub_schema() {
-  $description = array();
-
-  $description['foreign keys']['pub'] = array(
-        'table' => 'pub',
-        'columns' => array(
-          'pub_id' => 'pub_id',
-        ),
-  );
-
-  $description['foreign keys']['stockprop'] = array(
-        'table' => 'stockprop',
-        'columns' => array(
-          'stockprop_id' => 'stockprop_id',
-        ),
-  );
-
-  return $description;
-}
-
-/**
- * Implements hook_chado_stock_cvterm_schema()
- *
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the stock_cvterm table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_stock_chado_stock_cvterm_schema() {
-  $description = array();
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'cvterm_id' => 'cvterm_id',
-        ),
-  );
-
-  $description['foreign keys']['stock'] = array(
-        'table' => 'stock',
-        'columns' => array(
-          'stock_id' => 'stock_id',
-        ),
-  );
-
-  $description['foreign keys']['pub'] = array(
-        'table' => 'pub',
-        'columns' => array(
-          'pub_id' => 'pub_id',
-        ),
-  );
-
-  return $description;
-}
-
-/**
- * Implements hook_chado_stock_dbxref_schema()
- *
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the stock_dbxref table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_stock_chado_stock_dbxref_schema() {
-  $description = array();
-
-  $description['foreign keys']['dbxref'] = array(
-        'table' => 'dbxref',
-        'columns' => array(
-          'dbxref_id' => 'dbxref_id',
-        ),
-  );
-
-  $description['foreign keys']['stock'] = array(
-        'table' => 'stock',
-        'columns' => array(
-          'stock_id' => 'stock_id',
-        ),
-  );
-
-  return $description;
-}
-
-/**
- * Implements hook_chado_stock_genotype_schema()
+ * Implements hook_chado_schema_v1_2_table()
  *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
- *    Array describing the stock_genotype table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_stock_chado_stock_genotype_schema() {
-  $description = array();
-
-  $description['foreign keys']['genotype'] = array(
-        'table' => 'genotype',
-        'columns' => array(
-          'genotype_id' => 'genotype_id',
-        ),
-  );
-
-  $description['foreign keys']['stock'] = array(
-        'table' => 'stock',
-        'columns' => array(
-          'stock_id' => 'stock_id',
-        ),
-  );
-
-  return $description;
-}
-
-/**
- * Implements hook_chado_stock_pub_schema()
- *
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the stock_pub table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_stock_chado_stock_pub_schema() {
-  $description = array();
-
-  $description['foreign keys']['pub'] = array(
-        'table' => 'pub',
-        'columns' => array(
-          'pub_id' => 'pub_id',
-        ),
-  );
-
-  $description['foreign keys']['stock'] = array(
-        'table' => 'stock',
-        'columns' => array(
-          'stock_id' => 'stock_id',
-        ),
-  );
-
-  return $description;
-}
-
-/**
- * Implements hook_chado_stock_relationship_schema()
- *
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the stock_relationship table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_stock_chado_stock_relationship_schema() {
-  $description = array();
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-
-  $description['foreign keys']['stock'] = array(
-        'table' => 'stock',
-        'columns' => array(
-          'subject_id' => 'stock_id',
-          'object_id' => 'stock_id',
-        ),
-  );
-
-  return $description;
-}
-
-/**
- * Implements hook_chado_stock_relationship_pub_schema()
- *
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the stock_relationship_pub table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_stock_chado_stock_relationship_pub_schema() {
-  $description = array();
-
-  $description['foreign keys']['pub'] = array(
-        'table' => 'pub',
-        'columns' => array(
-          'pub_id' => 'pub_id',
-        ),
-  );
-
-  $description['foreign keys']['stock_relationship'] = array(
-        'table' => 'stock_relationship',
-        'columns' => array(
-          'stock_relationship_id' => 'stock_relationship_id',
-        ),
-  );
-
-  return $description;
-}
-
-/**
- * Implements hook_chado_stockcollection_schema()
- *
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the stockcollection table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_stock_chado_stockcollection_schema() {
-  $description = array();
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-
-  $description['foreign keys']['contact'] = array(
-        'table' => 'contact',
-        'columns' => array(
-          'contact_id' => 'contact_id',
-        ),
-  );
-
-  return $description;
-}
-
-/**
- * Implements hook_chado_stockcollection_stock_schema()
- *
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the stockcollection_stock table
+ *    Array describing the stock table
  *
  * @ingroup tripal_schema_api
  */
-function tripal_stock_chado_stockcollection_stock_schema() {
+function tripal_stock_chado_schema_v1_2_stock() {
   $description = array();
 
-  $description['foreign keys']['stock'] = array(
-        'table' => 'stock',
-        'columns' => array(
-          'stock_id' => 'stock_id',
-        ),
-  );
+  $description['description'] = 'Any stock can be globally identified by the combination of organism, uniquename and stock type. A stock is the physical entities, either living or preserved, held by collections. Stocks belong to a collection; they have IDs, type, organism, description and may have a genotype.';
 
-  $description['foreign keys']['stockcollection'] = array(
-        'table' => 'stockcollection',
-        'columns' => array(
-          'stockcollection_id' => 'stockcollection_id',
-        ),
+  $referring_tables = array(
+    'stock_cvterm',
+    'stock_dbxref',
+    'stock_genotype',
+    'stock_pub',
+    'stock_relationship',
+    'stockcollection_stock',
+    'stockprop'
   );
+  $description['referring_tables'] = $referring_tables;
 
   return $description;
 }
 
-/**
- * Implements hook_chado_stockcollectionprop_schema()
- *
- * Purpose: To add descriptions and foreign keys to default table description
- * Note: This array will be merged with the array from all other implementations
- *
- * @return
- *    Array describing the stockcollectionprop table
- *
- * @ingroup tripal_schema_api
- */
-function tripal_stock_chado_stockcollectionprop_schema() {
-  $description = array();
-
-  $description['foreign keys']['cvterm'] = array(
-        'table' => 'cvterm',
-        'columns' => array(
-          'type_id' => 'cvterm_id',
-        ),
-  );
-
-  $description['foreign keys']['stockcollection'] = array(
-        'table' => 'stockcollection',
-        'columns' => array(
-          'stockcollection_id' => 'stockcollection_id',
-        ),
-  );
-
-  return $description;
-}

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott