浏览代码

Fixed URL for SWO vocab

Stephen Ficklin 7 年之前
父节点
当前提交
6689fe9155

+ 2 - 4
tripal_chado/includes/tripal_chado.semweb.inc

@@ -1488,12 +1488,11 @@ function tripal_chado_populate_vocab_SWO() {
   tripal_insert_db(array(
     'name' => 'SWO',
     'description' => 'Software Ontology',
-    'url' => 'http://theswo.sourceforge.net/',
-    'urlprefix' => '',
+    'url' => 'http://purl.obolibrary.org/obo/swo',
+    'urlprefix' => 'http://www.ebi.ac.uk/swo/',
   ));
   tripal_insert_cv('swo','Software Ontology.');
 
-
   $term = tripal_insert_cvterm(array(
     'id' => 'SWO:0000001',
     'name' => 'software',
@@ -1506,7 +1505,6 @@ function tripal_chado_populate_vocab_SWO() {
       'specific operations.',
   ));
   tripal_associate_chado_semweb_term('analysis', 'program', $term);
-
 }
 
 /**

+ 10 - 6
tripal_chado/includes/tripal_chado.vocab_storage.inc

@@ -45,9 +45,11 @@ function tripal_chado_vocab_get_vocabulary($vocabulary) {
     $result['name'] = $result['short_name'];
   }
   $sw_url = $result['urlprefix'];
-  $sw_url = preg_replace('/\{db\}/', $result['short_name'], $sw_url);
-  $sw_url = preg_replace('/\{accession\}/', '', $sw_url);
-  $sw_url = url($sw_url, array('absolute' => TRUE));
+  if ($sw_url) {
+    $sw_url = preg_replace('/\{db\}/', $result['short_name'], $sw_url);
+    $sw_url = preg_replace('/\{accession\}/', '', $sw_url);
+    $sw_url = url($sw_url, array('absolute' => TRUE));
+  }
   $result['sw_url'] = $sw_url;
   unset($result['short_name']);
   return $result;
@@ -86,9 +88,11 @@ function tripal_chado_vocab_get_term($vocabulary, $accession) {
 
   // Generate the URL that can be used for semantic web applications.
   $sw_url = $urlprefix;
-  $sw_url = preg_replace('/{db}/', $cvterm->dbxref_id->db_id->name, $sw_url);
-  $sw_url = preg_replace('/{accession}/', '', $sw_url);
-  $sw_url = url($sw_url, array('absolute' => TRUE));
+  if ($sw_url) {
+    $sw_url = preg_replace('/{db}/', $cvterm->dbxref_id->db_id->name, $sw_url);
+    $sw_url = preg_replace('/{accession}/', '', $sw_url);
+    $sw_url = url($sw_url, array('absolute' => TRUE));
+  }
 
   $term = array(
     'vocabulary' => array(

+ 11 - 2
tripal_chado/tripal_chado.install

@@ -1437,7 +1437,7 @@ function tripal_chado_update_7321() {
   }
 }
 /**
- * Fixing the TPUB and TContact vocabulary URLs
+ * Fixing the SWO, TPUB and TContact vocabulary URLs
  */
 function tripal_chado_update_7322() {
   try {
@@ -1454,9 +1454,18 @@ function tripal_chado_update_7322() {
       'urlprefix' => 'cv/lookup/TContact/{accession}',
     ));
     tripal_insert_cv('tripal_contact', 'Tripal Contact Ontology. A temporary ontology until a more formal appropriate ontology an be identified.');
+
+    tripal_insert_db(array(
+      'name' => 'SWO',
+      'description' => 'Software Ontology',
+      'url' => 'http://purl.obolibrary.org/obo/swo',
+      'urlprefix' => 'http://www.ebi.ac.uk/swo/',
+    ));
   }
   catch (\PDOException $e) {
     $error = $e->getMessage();
     throw new DrupalUpdateException('Could not perform update: '. $error);
   }
-}
+}
+
+