@@ -38,7 +38,7 @@ function __construct($argv) {
38
38
39
39
// set and print application parameters
40
40
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/ ' );
42
42
parent ::initialize ();
43
43
}
44
44
@@ -116,16 +116,21 @@ function Run()
116
116
foreach ($ entries AS $ id ) {
117
117
echo "processing " .(++$ i )." of $ total - biomodel# " .$ id ;
118
118
$ 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 " ;
120
120
// download if the file doesn't exist or we are told to
121
121
if (!file_exists ($ download_file ) || $ this ->GetParameterValue ('download ' ) == 'true ' ) {
122
122
// download
123
123
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
+ }
128
132
}
133
+ echo " - downloaded " ;
129
134
}
130
135
131
136
// load entry, parse and write to file
@@ -143,12 +148,8 @@ function Run()
143
148
$ rdf = $ converter ->Parse ();
144
149
parent ::addRDF ($ rdf );
145
150
parent ::writeRDFBufferToWriteFile ();
146
- parent ::getWriteFile ()->Close ();
147
151
148
- echo "done! " .PHP_EOL ;
149
-
150
152
//generate dataset description
151
- echo "Generating dataset description for BioModel # $ id... " ;
152
153
$ source_file = (new DataResource ($ this ))
153
154
->setURI ($ url )
154
155
->setTitle ("EBI BioModels Database - BioModel # $ id " )
@@ -165,7 +166,7 @@ function Run()
165
166
166
167
}//foreach
167
168
168
- echo " Generating dataset description for Bio2RDF BioModels... " ;
169
+ parent :: getWriteFile ()-> close () ;
169
170
170
171
$ prefix = parent ::getPrefix ();
171
172
$ bVersion = parent ::getParameterValue ('bio2rdf_release ' );
0 commit comments