Skip to content

Commit db9cda1

Browse files
Finished adding version option and dataset description to PubMed parser
1 parent 80158bb commit db9cda1

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

pubmed/pubmed.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,26 @@ function process_dir(){
4949
$this->setCheckPoint('dataset');
5050

5151
$ldir = parent::getParameterValue('indir');
52+
$odir = parent::getParameterValue('outdir');
53+
54+
$graph_uri = parent::getGraphURI();
55+
56+
$dataset_description = '';
57+
58+
$gz = (strstr(parent::getParameterValue('output_format'),".gz") === FALSE)?false:true;
59+
60+
//set graph URI to dataset graph
61+
if(parent::getParameterValue('dataset_graph') == true) parent::setGraphURI(parent::getDatasetURI());
5262

5363
//make sure directories end with slash
5464
if(substr($ldir, -1) !== "/"){
5565
$ldir = $ldir."/";
5666
}
5767

68+
if(substr($odir, -1) !== "/"){
69+
$odir = $odir."/";
70+
}
71+
5872
if ($lhandle = opendir($ldir)) {
5973
while (($lfilename = readdir($lhandle)) !== FALSE) {
6074
if ($lfilename != "." && $lfilename != "..") {
@@ -69,20 +83,18 @@ function process_dir(){
6983
closedir($lhandle);
7084
}
7185

72-
7386
$source_file = (new DataResource($this))
7487
->setURI("http://www.ncbi.nlm.nih.gov/pubmed")
7588
->setTitle("NCBI PubMed")
7689
->setRetrievedDate( date ("Y-m-d\TG:i:s\Z", filemtime($ldir)))
7790
->setFormat("text/xml")
78-
->setFormat("application/zip")
7991
->setPublisher("http://ncbi.nlm.nih.gov/")
8092
->setHomepage("http://www.ncbi.nlm.nih.gov/pubmed/")
8193
->setRights("use-share-modify")
8294
->setLicense("http://www.nlm.nih.gov/databases/license/license.html")
8395
->setDataset("http://identifiers.org/pubmed/");
8496

85-
$prefix = $this->getPcbPrefix();
97+
$prefix = parent::getPrefix();
8698
$bVersion = parent::getParameterValue('bio2rdf_release');
8799
$date = date ("Y-m-d\TG:i:s\Z");
88100
$output_file = (new DataResource($this))
@@ -105,8 +117,11 @@ function process_dir(){
105117

106118
$dataset_description .= $source_file->toRDF().$output_file->toRDF();
107119

120+
//set graph URI back to default
121+
parent::setGraphURI($graph_uri);
122+
108123
// write the dataset description
109-
$this->setWriteFile($this->getParameterValue('outdir')."/bioassay/".$this->getBio2RDFReleaseFile());
124+
$this->setWriteFile($odir.$this->getBio2RDFReleaseFile());
110125
$this->getWriteFile()->write($dataset_description);
111126
$this->getWriteFile()->close();
112127
}//process)dir

0 commit comments

Comments
 (0)