@@ -38,7 +38,7 @@ function __construct($argv) {
3838
3939 // set and print application parameters
4040 parent ::addParameter ('files ' ,true ,null ,'all|curated|biomodel#|start#-end# ' ,'entries to process: comma-separated list or hyphen-separated range ' );
41- parent ::addParameter ('download_url ' ,false ,null ,'http://www.ebi.ac.uk/biomodels/models-main/publ/ ' );
41+ parent ::addParameter ('download_url ' ,false ,null ,'http://www.ebi.ac.uk/biomodels/models-main/ ' );
4242 parent ::initialize ();
4343 }
4444
@@ -116,16 +116,21 @@ function Run()
116116 foreach ($ entries AS $ id ) {
117117 echo "processing " .(++$ i )." of $ total - biomodel# " .$ id ;
118118 $ download_file = $ ldir .$ id .".owl.gz " ;
119- $ url = parent ::getParameterValue ('download_url ' )."$ id/ $ id-biopax3.owl " ;
119+ $ url = parent ::getParameterValue ('download_url ' )."publ/ $ id/ $ id-biopax3.owl " ;
120120 // download if the file doesn't exist or we are told to
121121 if (!file_exists ($ download_file ) || $ this ->GetParameterValue ('download ' ) == 'true ' ) {
122122 // download
123123 echo " - downloading " ;
124- $ buf = file_get_contents ($ url );
125- if (strlen ($ buf ) != 0 ) {
126- file_put_contents ("compress.zlib:// " .$ download_file , $ buf );
127- // usleep(500000); // limit of 4 requests per second
124+ $ ret = utils::downloadsingle ($ url ,'compress.zlib:// ' .$ download_file , true );
125+ if ($ ret === false ) {
126+ echo "\nTrying non-curated model " ;
127+ $ url = parent ::getParametervalue ('download_url ' )."uncura_publ/ $ id/ $ id-biopax3.owl " ;
128+ $ ret = utils::downloadsingle ($ url ,'compress.zlib:// ' .$ download_file , true );
129+ if ($ ret === false ) {
130+ continue ;
131+ }
128132 }
133+ echo " - downloaded " ;
129134 }
130135
131136 // load entry, parse and write to file
@@ -143,12 +148,8 @@ function Run()
143148 $ rdf = $ converter ->Parse ();
144149 parent ::addRDF ($ rdf );
145150 parent ::writeRDFBufferToWriteFile ();
146- parent ::getWriteFile ()->Close ();
147151
148- echo "done! " .PHP_EOL ;
149-
150152 //generate dataset description
151- echo "Generating dataset description for BioModel # $ id... " ;
152153 $ source_file = (new DataResource ($ this ))
153154 ->setURI ($ url )
154155 ->setTitle ("EBI BioModels Database - BioModel # $ id " )
@@ -165,7 +166,7 @@ function Run()
165166
166167 }//foreach
167168
168- echo " Generating dataset description for Bio2RDF BioModels... " ;
169+ parent :: getWriteFile ()-> close () ;
169170
170171 $ prefix = parent ::getPrefix ();
171172 $ bVersion = parent ::getParameterValue ('bio2rdf_release ' );
0 commit comments