@@ -89,8 +89,9 @@ function Run()
8989 foreach ($ ontologies AS $ i => $ o ) {
9090 $ label = (string ) $ o ->name ;
9191 $ abbv = (string ) $ o ->acronym ;
92-
93- if (array_search ($ abbv ,$ exclude_list ) !== FALSE ) continue ;
92+ if (array_search ($ abbv ,$ exclude_list ) !== FALSE ) {
93+ continue ;
94+ }
9495 if ($ include_list [0 ] != 'all ' ) {
9596 // ignore if we don't find it in the include list OR we do find it in the exclude list
9697 if ( (array_search ($ abbv ,$ include_list ) === FALSE )
@@ -106,9 +107,7 @@ function Run()
106107 if (!isset ($ ls ['hasOntologyLanguage ' ])) {echo 'insufficient metadata ' .PHP_EOL ;continue ;}
107108
108109 $ format = strtolower ($ ls ['hasOntologyLanguage ' ]);
109- /***********/
110110 if ($ format != 'owl ' and $ format != 'obo ' ) continue ;
111-
112111 echo "Processing ( $ i/ $ total) $ abbv ... " ;
113112
114113 $ version = $ ls ['version ' ];
@@ -117,7 +116,6 @@ function Run()
117116
118117 $ rfile = $ ls ['ontology ' ]['links ' ]['download ' ];
119118
120-
121119 $ lfile = $ abbv .". " .$ format .".gz " ;
122120 if (parent ::getParameterValue ('download ' ) == 'true ' ) {
123121 echo "downloading ... " ;
@@ -138,6 +136,7 @@ function Run()
138136 if (isset ($ m [1 ])) {
139137 $ filename = $ m [1 ];
140138 if (strstr ($ filename ,".zip " )) continue ;
139+
141140 } else {echo "error: no filename " .PHP_EOL ;continue ;}
142141
143142 $ body = substr ($ ret , $ header_size );
@@ -148,6 +147,7 @@ function Run()
148147
149148 $ lz = "compress.zlib:// " .$ idir .$ lfile ;
150149 file_put_contents ($ lz ,$ body );
150+
151151 echo "done " .PHP_EOL ;
152152 }
153153
@@ -160,6 +160,11 @@ function Run()
160160 // process
161161 echo "converting ... " ;
162162 set_time_limit (0 );
163+ // let's double check the format
164+ $ fp = gzopen ($ idir .$ lfile ,"r " );
165+ $ l = gzgets ($ fp );
166+ if (strstr ($ l ,"xml " )) $ format = "owl " ;
167+ gzclose ($ fp );
163168 if ($ format == 'obo ' ) {
164169 $ this ->OBO2RDF ($ abbv );
165170 } else if ($ format == 'owl ' ) {
@@ -366,6 +371,7 @@ function OBO2RDF($abbv)
366371 if ($ abbv == "doid " ) $ abbv = "do " ;
367372 $ minimal = (parent ::getParameterValue ('detail ' ) == 'min ' )?true :false ;
368373 $ minimalp = (parent ::getParameterValue ('detail ' ) == 'min+ ' )?true :false ;
374+ $ version = parent ::getParameterValue ("bio2rdf_release " );
369375
370376 $ tid = '' ;
371377 $ first = true ;
@@ -374,7 +380,7 @@ function OBO2RDF($abbv)
374380 $ min = $ buf = '' ;
375381 $ ouri = "http://bio2rdf.org/lsr: " .$ abbv ;
376382
377- $ dataset_uri = $ abbv ."_resource:bio2rdf.dataset. $ abbv.R3 " ;
383+ $ dataset_uri = $ abbv ."_resource:bio2rdf.dataset. $ abbv.R " . $ version ;
378384 parent ::setGraphURI ($ dataset_uri );
379385 $ buf = parent ::triplify ($ ouri ,"rdf:type " ,"owl:Ontology " );
380386 $ graph_uri = '< ' .parent ::getRegistry ()->getFQURI (parent ::getGraphURI ()).'> ' ;
0 commit comments