소스 검색

still testing this fix to see if it address the slow load time

Shawna Spoor 6 년 전
부모
커밋
87fd46f30c
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 2
      tripal_chado/includes/TripalImporter/OBOImporter.inc

+ 7 - 2
tripal_chado/includes/TripalImporter/OBOImporter.inc

@@ -763,7 +763,7 @@ class OBOImporter extends TripalImporter {
       $pair = explode(":", $t['id']);
       $ontology_id = $pair[0];
       $accession_num = $pair[1];
-      if (is_numeric($accession_num)) {
+      if (is_numeric($accession_num) && ($ontology_id != $default_db)) {
         $results = $this->oboEbiLookup($t['id'], 'term');
         if (isset($results['label'])) {
           $t['name'] = $results['label'];
@@ -863,6 +863,7 @@ class OBOImporter extends TripalImporter {
     $t['cv_name'] = $defaultcv;
     $t['is_relationship'] = $is_relationship;
     $t['db_name'] = $default_db;
+
     $cvterm = tripal_insert_cvterm($t, array('update_existing' => TRUE));
     if (!$cvterm) {
       throw new Exception("Cannot add the term " . $term['id'][0]);
@@ -1029,19 +1030,23 @@ class OBOImporter extends TripalImporter {
   private function addRelationship($cvterm, $defaultcv, $rel,
       $objname, $object_is_relationship = 0, $default_db = 'OBO_REL') {
     $reference_term = FALSE;
+    $in_obo = $this->getTerm($objname);
     // If an accession was passed we need to see if we can find the actual label.
-    if (strpos($rel, ':') || strpos($objname, ':')) {
+    if (strpos($rel, ':') || strpos($objname, ':') && empty($in_obo['name'])) {
+
       if (strpos($rel, ':')) {
         $term_id = $rel;
       }
       elseif (strpos($objname, ':')) {
         $term_id = $objname;
       }
+
       $reference_term = TRUE;
       $pair = explode(":", $term_id);    
       $ontology_id = $pair[0];
       $accession_num = $pair[1];
       $rel_name = '';
+
       if (is_numeric($accession_num)) {
         $results = $this->oboEbiLookup($term_id, 'term');
         if (isset($results['label'])) {