Skip to content

Commit 80158bb

Browse files
Started adding version option and dataset description to PubMed
1 parent c154d9a commit 80158bb

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

pubmed/pubmed.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class PubmedParser extends Bio2RDFizer
3434
function __construct($argv) {
3535
parent::__construct($argv, "pubmed");
3636
parent::addParameter('files',true,'all','all','files to process');
37+
parent::addParameter('version',false,'2012','2012','date version of files');
3738
parent::initialize();
3839
}//constructor
3940

@@ -67,6 +68,47 @@ function process_dir(){
6768
}
6869
closedir($lhandle);
6970
}
71+
72+
73+
$source_file = (new DataResource($this))
74+
->setURI("http://www.ncbi.nlm.nih.gov/pubmed")
75+
->setTitle("NCBI PubMed")
76+
->setRetrievedDate( date ("Y-m-d\TG:i:s\Z", filemtime($ldir)))
77+
->setFormat("text/xml")
78+
->setFormat("application/zip")
79+
->setPublisher("http://ncbi.nlm.nih.gov/")
80+
->setHomepage("http://www.ncbi.nlm.nih.gov/pubmed/")
81+
->setRights("use-share-modify")
82+
->setLicense("http://www.nlm.nih.gov/databases/license/license.html")
83+
->setDataset("http://identifiers.org/pubmed/");
84+
85+
$prefix = $this->getPcbPrefix();
86+
$bVersion = parent::getParameterValue('bio2rdf_release');
87+
$date = date ("Y-m-d\TG:i:s\Z");
88+
$output_file = (new DataResource($this))
89+
->setURI("http://download.bio2df.org/release/$bVersion/$prefix")
90+
->setTitle("Bio2RDF v$bVersion RDF version of $prefix (generated at $date)")
91+
->setSource($source_file->getURI())
92+
->setCreator("https://github.com/bio2rdf/bio2rdf-scripts/blob/master/pubchem/pubchem.php")
93+
->setCreateDate($date)
94+
->setHomepage("http://download.bio2rdf.org/release/$bVersion/$prefix/$prefix.html")
95+
->setPublisher("http://bio2rdf.org")
96+
->setRights("use-share-modify")
97+
->setRights("by-attribution")
98+
->setRights("restricted-by-source-license")
99+
->setLicense("http://creativecommons.org/licenses/by/3.0/")
100+
->setDataset(parent::getDatasetURI());
101+
102+
if($gz) $output_file->setFormat("application/gzip");
103+
if(strstr(parent::getParameterValue('output_format'),"nt")) $output_file->setFormat("application/n-triples");
104+
else $output_file->setFormat("application/n-quads");
105+
106+
$dataset_description .= $source_file->toRDF().$output_file->toRDF();
107+
108+
// write the dataset description
109+
$this->setWriteFile($this->getParameterValue('outdir')."/bioassay/".$this->getBio2RDFReleaseFile());
110+
$this->getWriteFile()->write($dataset_description);
111+
$this->getWriteFile()->close();
70112
}//process)dir
71113

72114
function process_file($infile){

0 commit comments

Comments
 (0)