@@ -233,12 +233,11 @@ function parse_dir(){
233
233
**/
234
234
function process_file ($ infile ) {
235
235
$ indir = parent ::getParameterValue ('indir ' );
236
- $ xml = new CXML ($ indir , basename ( $ infile) );
236
+ $ xml = new CXML ($ infile );
237
237
$ this ->setCheckPoint ('file ' );
238
238
while ($ xml ->Parse ("clinical_study " ) == TRUE ) {
239
239
$ this ->setCheckPoint ('record ' );
240
240
$ this ->root = $ root = $ xml ->GetXMLRoot ();
241
-
242
241
$ this ->nct_id = $ nct_id = $ this ->getString ("//id_info/nct_id " );
243
242
$ this ->study_id = $ study_id = parent ::getNamespace ()."$ nct_id " ;
244
243
@@ -759,7 +758,7 @@ function process_file($infile) {
759
758
parent ::triplifyString ($ location_uri ,parent ::getVoc ()."status " , $ this ->getString ('//status ' ,$ location )).
760
759
parent ::triplify ($ study_id ,parent ::getVoc ()."location " ,$ location_uri ).
761
760
parent ::triplify ($ location_uri , parent ::getVoc ()."address " , $ this ->makeAddress ($ address )).
762
- parent ::triplify ($ location_uri , parent ::getVoc ()."contact " , $ this ->makeContact ($ contact ))
761
+ ( $ contact != null ? parent ::triplify ($ location_uri , parent ::getVoc ()."contact " , $ this ->makeContact ($ contact )): "" )
763
762
);
764
763
if ($ backups ) {
765
764
foreach ($ backups AS $ backup ) {
@@ -831,11 +830,13 @@ function process_file($infile) {
831
830
try {
832
831
$ links = $ root ->xpath ('//link ' );
833
832
foreach ($ links AS $ i => $ link ) {
834
- $ lid = parent ::getRes ().md5 ($ this ->getString ('./url ' ,$ link ));
833
+ $ url = $ this ->getString ('./url ' ,$ link );
834
+ $ url = preg_replace ("/>.*$/ " ,"" ,$ url );
835
+ $ lid = parent ::getRes ().md5 ($ url );
835
836
parent ::addRDF (
836
837
parent ::describeIndividual ($ lid , $ this ->getString ('./description ' ,$ link ), parent ::getVoc ()."Link " ).
837
838
parent ::describeClass (parent ::getVoc ()."Link " ,"Link " ).
838
- parent ::triplify ($ lid ,parent ::getVoc ()."url " ,preg_replace ( " />$/ " , "" , $ this -> getString ( ' ./ url' , $ link )) ).
839
+ parent ::triplify ($ lid ,parent ::getVoc ()."url " ,$ url ).
839
840
parent ::triplify ($ study_id ,parent ::getVoc ()."link " ,$ lid )
840
841
);
841
842
}
@@ -1166,7 +1167,7 @@ function process_file($infile) {
1166
1167
if (!$ et ) continue ;
1167
1168
$ ev_uri = parent ::getVoc ().str_replace (" " ,"- " ,$ ev_label );
1168
1169
1169
- $ categories = array_shift ($ et ->xpath ('./category_list ' ));
1170
+ $ categories = @ array_shift ($ et ->xpath ('./category_list ' ));
1170
1171
foreach ($ categories AS $ category ) {
1171
1172
$ major_title = $ this ->getString ('./title ' , $ category );
1172
1173
$ major_title_uri = parent ::getRes ().md5 ($ major_title );
@@ -1272,8 +1273,8 @@ public function getDatetimeFromDate($date)
1272
1273
1273
1274
public function makeContact ($ contact )
1274
1275
{
1275
- if ($ contact == null ) return null ;
1276
- $ contact_uri = parent ::getRes ().md5 ($ contact ->asXML ());
1276
+ if ($ contact == null ) return '' ;
1277
+ $ contact_uri = parent ::getRes ().md5 ($ contact ->asXML ());
1277
1278
$ contact_type_uri = parent ::getVoc ()."Contact " ;
1278
1279
$ contact_label = trim ($ this ->getString ('//first_name ' ,$ contact )." " .$ this ->getString ('//last_name ' , $ contact ));
1279
1280
parent ::addRDF (
0 commit comments