@@ -34,6 +34,7 @@ class PubmedParser extends Bio2RDFizer
34
34
function __construct ($ argv ) {
35
35
parent ::__construct ($ argv , "pubmed " );
36
36
parent ::addParameter ('files ' ,true ,'all ' ,'all ' ,'files to process ' );
37
+ parent ::addParameter ('version ' ,false ,'2012 ' ,'2012 ' ,'date version of files ' );
37
38
parent ::initialize ();
38
39
}//constructor
39
40
@@ -67,6 +68,47 @@ function process_dir(){
67
68
}
68
69
closedir ($ lhandle );
69
70
}
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 ();
70
112
}//process)dir
71
113
72
114
function process_file ($ infile ){
0 commit comments