Skip to content

Commit a06064c

Browse files
fix to bioportal
1 parent 2697e06 commit a06064c

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

bioportal/bioportal.php

+33-30
Original file line numberDiff line numberDiff line change
@@ -516,37 +516,40 @@ function OBO2RDF($abbv)
516516
$buf .= parent::triplify($tid,"rdfs:seeAlso", str_replace( array(" ",'"wiki"',"\\"), array("+","",""), $a[1]));
517517
} else {
518518
$b = explode(":",$a[1],2);
519-
if(substr($b[1],0,4) == "http") {
520-
$buf .= parent::triplify($tid,"rdfs:seeAlso", stripslashes($b[1]));
521-
} else {
522-
$ns = str_replace(array(" ","\\",) ,"",strtolower($b[0]));
523-
$id = trim($b[1]);
524-
525-
// there may be a comment to remove
526-
if(FALSE !== ($pos = strrpos($id,' "'))) {
527-
$comment = substr($id,$pos+1,-1);
528-
$id = substr($id,0,$pos);
529-
}
530-
$id = stripslashes($id);
531-
// there may be a source statement to remove
532-
$id = preg_replace("/{.*\}/","",$id);
533-
if($ns == "pmid") {
534-
$ns = "pubmed";
535-
$y = explode(" ",$id);
536-
$id = $y[0];
537-
}
538-
if($ns == "xx") continue;
539-
if($ns == "icd9cm") {
540-
$y = explode(" ",$id);
541-
$id = $y[0];
542-
}
543-
if($ns == "xref; umls_cui") continue;
544-
if($ns == "submitter") $ns = "chebi.submitter";
545-
if($ns == "wikipedia" || $ns == "mesh") $id = str_replace(" ","+",$id);
546-
if($ns == "id-validation-regexp") {
547-
$buf .= parent::triplifyString($tid,"obo_vocabulary:$ns", addslashes($id));
519+
if(isset($b[1])) {
520+
if(substr($b[1],0,4) == "http") {
521+
$buf .= parent::triplify($tid,"rdfs:seeAlso", stripslashes($b[1]));
548522
} else {
549-
$buf .= parent::triplify($tid,"obo_vocabulary:x-$ns", "$ns:".str_replace(" ","-",$id));
523+
$ns = str_replace(array(" ","\\",) ,"",strtolower($b[0]));
524+
$id = trim($b[1]);
525+
526+
// there may be a comment to remove
527+
if(FALSE !== ($pos = strrpos($id,' "'))) {
528+
$comment = substr($id,$pos+1,-1);
529+
$id = substr($id,0,$pos);
530+
}
531+
$id = stripslashes($id);
532+
// there may be a source statement to remove
533+
$id = preg_replace("/{.*\}/","",$id);
534+
if($ns == "pmid") {
535+
$ns = "pubmed";
536+
$y = explode(" ",$id);
537+
$id = $y[0];
538+
}
539+
if($ns == "xx") continue;
540+
if($ns == "icd9cm") {
541+
$y = explode(" ",$id);
542+
$id = $y[0];
543+
}
544+
if($ns == "xref; umls_cui") continue;
545+
if($ns == "submitter") $ns = "chebi.submitter";
546+
if($ns == "wikipedia" || $ns == "mesh") $id = str_replace(" ","+",$id);
547+
if($ns == "id-validation-regexp") {
548+
$buf .= parent::triplifyString($tid,"obo_vocabulary:$ns", addslashes($id));
549+
} else {
550+
if($ns)
551+
$buf .= parent::triplify($tid,"obo_vocabulary:x-$ns", "$ns:".str_replace(" ","-",$id));
552+
}
550553
}
551554
}
552555
}

0 commit comments

Comments
 (0)