Browse Source

Fix for bug with db names containing slashes

Stephen Ficklin 4 years ago
parent
commit
ad07ca84cc
1 changed files with 7 additions and 11 deletions
  1. 7 11
      tripal_chado/includes/TripalImporter/OBOImporter.inc

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

@@ -874,17 +874,13 @@ class OBOImporter extends TripalImporter {
     if (array_key_exists('idspace', $header)) {
       $matches = [];
       foreach ($header['idspace'] as $idspace) {
-        if (preg_match('/^(.*?)\s+(.*?)\s+"(.*)"$/', $idspace, $matches)) {
-          $idname = $matches[1];
-          $idname = preg_replace('/^EDAM_/', '', $idname);
-          $idspaces[$idname]['url'] = $matches[2];
-          $idspaces[$idname]['description'] = $matches[3];
+        if (preg_match('/^(.+?)\s+(.+?)\s+"(.+)"$/', $idspace, $matches)) {
+          $idspaces[$matches[1]]['url'] = $matches[2];
+          $idspaces[$matches[1]]['description'] = $matches[3];
         }
-        elseif (preg_match('/^(.*?)\s+(.*?)$/', $idspace, $matches)) {
-          $idname = $matches[1];
-          $idname = preg_replace('/^EDAM_/', '', $idname);
-          $idspaces[$idname]['url'] = $matches[2];
-          $idspaces[$idname]['description'] = '';
+        elseif (preg_match('/^(.+?)\s+(.+?)$/', $idspace, $matches)) {
+          $idspaces[$matches[1]]['url'] = $matches[2];
+          $idspaces[$matches[1]]['description'] = '';
         }
       }
     }
@@ -2144,7 +2140,7 @@ class OBOImporter extends TripalImporter {
 
       // For EDAM, we have to unfortuantely hard-code a fix as the
       // short names of terms are correct.
-      $line = preg_replace('/EDAM_(.+?):(.+?)/', '/\1:\2', $line);
+      $line = preg_replace('/EDAM_(\w+)/', '\1', $line);
 
 
       // break apart the line into the tag and value but ignore any escaped colons