Project

General

Profile

« Previous | Next » 

Revision 2115

Added by sgarg over 20 years ago

Perl script for transfering documents from one metacat to another metacat. list_of_docids contains list of names of the documents that will be transfered.

View differences:

src/perl/list_of_docids
1
obfs.154.3
2
obfs.153.2
3
obfs.152.3
4
obfs.151.2
5
oeddins.19.1
6
oeddins.18.1
7
oeddins.17.1
8
oeddins.16.1
9
oeddins.15.1
10
oeddins.13.1
11
oeddins.12.1
12
oeddins.11.2
13
oeddins.10.4
14
obfs.148.3
15
obfs.147.2
16
obfs.142.3
17
obfs.141.2
18
obfs.140.3
19
obfs.139.2
20
obfs.130.3
21
obfs.129.2
22
obfs.126.3
23
obfs.125.2
24
obfs.124.3
25
obfs.123.2
26
obfs.122.3
27
obfs.121.2
28
obfs.120.3
29
ve_hamilton.7.1
30
ve_hamilton.6.1
31
ve_hamilton.5.1
32
ve_hamilton.4.3
33
ve_hamilton.3.1
34
obfs.119.2
35
obfs.118.3
36
obfs.117.2
37
obfs.114.3
38
obfs.113.2
39
obfs.112.3
40
obfs.111.2
41
obfs.100.3
42
nrs.188.2
43
nrs.187.2
44
nrs.180.4
45
jwalsh.36.1
46
jwalsh.35.1
47
jwalsh.34.1
48
jwalsh.32.2
49
jwalsh.31.1
50
jwalsh.30.1
51
nrs.179.2
52
nrs.178.4
53
nrs.177.2
54
nrs.170.4
55
jwalsh.29.1
56
jwalsh.28.1
57
jwalsh.27.2
58
jwalsh.26.1
59
jwalsh.25.1
60
jwalsh.24.1
61
jwalsh.23.1
62
jwalsh.22.3
63
bowles.232.1
64
wetlandsofindia.8.1
65
bowles.231.2
66
jwalsh.21.1
67
wetlandsofindia.7.1
68
bowles.230.1
69
jwalsh.20.1
70
wetlandsofindia.6.1
71
wetlandsofindia.4.2
72
wetlandsofindia.3.1
73
nrs.169.2
74
nrs.168.4
75
nrs.167.2
76
nrs.164.4
77
nrs.163.2
78
nrs.160.4
79
jwalsh.19.1
80
jwalsh.18.1
81
ve_hamilton.16.2
82
jwalsh.17.2
83
ve_hamilton.15.2
84
jwalsh.16.1
85
ve_hamilton.14.2
86
jwalsh.14.1
87
jwalsh.13.1
88
jwalsh.12.1
89
jwalsh.11.3
90
bowles.221.1
91
bowles.220.1
92
jwalsh.10.1
93
rwilliams.9.1
94
rwilliams.8.1
95
rwilliams.7.1
96
rwilliams.6.1
97
rwilliams.4.1
98
rwilliams.3.1
99
nrs.159.2
100
nrs.158.7
101
nrs.157.2
102
nrs.156.4
103
nrs.155.2
104
nrs.154.4
105
jones.299.1
106
nrs.153.2
107
nrs.152.4
108
nrs.151.2
109
jones.291.2
110
jones.290.3
111
bowles.219.1
112
bowles.211.1
113
bowles.210.1
114
nrs.146.4
115
nrs.145.2
116
nrs.144.4
117
nrs.143.2
118
jones.289.2
119
nrs.142.4
120
nrs.141.2
121
nrs.140.4
122
jones.283.1
123
jones.282.1
124
jones.281.1
125
bowles.209.1
126
wetlandsofindia.48.1
127
wetlandsofindia.47.1
128
wetlandsofindia.46.1
129
nrs.139.2
130
nrs.138.4
131
wetlandsofindia.44.1
132
nrs.137.2
133
nrs.136.4
134
wetlandsofindia.43.1
135
nrs.135.2
136
nrs.132.4
137
nrs.131.2
138
nrs.130.4
139
jones.274.2
140
jones.273.2
141
jones.272.2
142
nottrott.18.1
143
nottrott.17.1
144
nottrott.16.1
145
tao.11499.1
146
nottrott.15.1
147
tao.11498.1
148
wetlandsofindia.36.1
149
nrs.129.2
150
tao.11497.1
151
nrs.128.5
152
wetlandsofindia.35.1
153
tao.11495.1
154
wetlandsofindia.34.1
155
nrs.127.3
156
tao.11494.1
157
wetlandsofindia.32.1
158
wetlandsofindia.31.1
159
jones.264.5
160
jones.263.5
161
jones.262.5
162
jones.261.6
163
jones.260.2
164
enviroedukator.9.4
165
enviroedukator.8.4
166
enviroedukator.7.4
167
enviroedukator.5.5
168
enviroedukator.4.1
169
wetlandsofindia.29.1
170
wetlandsofindia.28.1
171
wetlandsofindia.27.1
172
nrs.116.4
173
nrs.115.2
174
nrs.114.3
175
nrs.113.2
176
jones.259.3
177
jones.258.3
178
jones.257.3
179
jones.251.3
180
jones.250.3
181
obfs.299.2
182
obfs.298.4
183
obfs.297.3
184
obfs.296.3
185
obfs.295.2
186
obfs.292.3
187
obfs.291.2
188
higgins.4630.1
189
nrs.108.4
190
nrs.107.2
191
nrs.106.4
192
nrs.105.2
193
jones.249.3
194
nrs.102.3
195
nrs.101.2
196
nrs.100.4
197
obfs.288.3
198
higgins.4629.1
199
obfs.287.2
200
higgins.4628.1
201
obfs.284.3
202
higgins.4625.1
203
obfs.282.2
204
obfs.280.3
205
obfs.279.2
206
wetlands.34.1
207
wetlands.33.1
208
wetlands.32.1
209
obfs.272.3
210
wetlands.30.1
211
obfs.271.2
212
zulvir.8.1
213
zulvir.7.1
214
zulvir.6.1
215
zulvir.4.1
216
zulvir.3.1
217
jones.228.1
218
jones.227.1
219
jones.226.1
220
jones.225.1
221
wetlands.29.1
222
obfs.266.3
223
obfs.265.2
224
obfs.264.3
225
obfs.263.2
226
jones.217.1
227
jones.216.1
228
jones.215.1
229
obfs.258.3
230
obfs.257.2
231
obfs.256.3
232
obfs.255.2
233
jones.208.3
234
jones.207.3
235
jones.206.3
236
jones.204.22
237
jones.203.2
238
tonelow13.1043.1
239
tonelow13.1042.1
240
tonelow13.1041.1
241
obfs.244.3
242
obfs.243.2
243
higgins.1334.1
244
obfs.240.3
245
obfs.239.2
246
obfs.236.3
247
obfs.235.2
248
obfs.234.3
249
obfs.233.2
250
tao.9537.1
251
tao.9536.1
252
tao.9535.1
253
tao.9533.1
254
tao.9532.1
255
Sartwell.126.2
256
Sartwell.125.1
257
Sartwell.124.5
258
tonelow13.1024.7
259
obfs.228.3
260
obfs.227.2
261
mzalamea.7.1
262
obfs.224.3
263
mzalamea.6.1
264
obfs.223.2
265
mzalamea.5.1
266
mzalamea.4.1
267
obfs.222.3
268
obfs.221.2
269
redemm.8.1
270
mzalamea.3.1
271
redemm.7.1
272
redemm.6.1
273
redemm.4.1
274
Sartwell.117.1
275
redemm.3.1
276
Sartwell.116.1
277
Sartwell.115.1
278
tonelow13.1014.1
279
tonelow13.1013.1
280
tonelow13.1012.1
281
tonelow13.1011.1
282
obfs.214.3
283
obfs.213.2
284
Sartwell.101.1
285
camuso.40.1
286
Sartwell.100.1
287
obfs.200.3
288
camuso.39.1
289
camuso.38.1
290
camuso.28.1
291
camuso.27.1
292
camuso.26.1
293
camuso.24.2
294
rwilliams.14.1
295
camuso.23.1
296
rwilliams.13.1
297
rwilliams.12.1
298
rwilliams.10.1
299
obfs.99.2
300
obfs.90.3
301
tao.9049.1
302
tao.9048.1
303
tao.9047.1
304
tao.9045.4
305
tao.9044.1
306
tao.9041.1
307
dblankman.44.1
308
tao.9040.1
309
dblankman.42.1
310
dblankman.41.1
311
dblankman.40.1
312
obfs.89.2
313
obfs.84.4
314
obfs.83.2
315
obfs.82.3
316
obfs.81.2
317
obfs.80.3
318
tao.9039.1
319
tao.9038.1
320
tao.9037.1
321
tao.9036.1
322
tao.9035.1
323
dblankman.38.1
324
tao.9034.1
325
tao.9033.1
326
dblankman.37.1
327
dblankman.36.1
328
dblankman.35.1
329
tao.9031.1
330
tao.9030.1
331
dblankman.33.1
332
dblankman.32.1
333
dblankman.31.1
334
obfs.79.2
335
obfs.78.3
336
obfs.77.2
337
obfs.76.2
338
obfs.75.2
339
obfs.74.3
340
obfs.73.2
341
obfs.70.4
342
brooke2.140.4
343
tao.9029.1
344
tao.9028.1
345
tao.9027.2
346
tao.9026.1
347
dblankman.29.1
348
dblankman.27.1
349
dblankman.26.1
350
dblankman.25.1
351
dblankman.23.2
352
dblankman.21.1
353
dblankman.20.1
354
obfs.69.3
355
obfs.66.3
356
obfs.65.2
357
obfs.64.3
358
obfs.63.2
359
obfs.62.4
360
obfs.60.4
361
dblankman.19.1
362
dblankman.17.1
363
dblankman.15.1
364
dblankman.14.1
365
dblankman.13.1
366
dblankman.12.1
367
obfs.59.2
368
obfs.58.4
369
obfs.57.2
370
obfs.56.5
371
obfs.55.3
372
obfs.54.4
373
obfs.53.2
374
obfs.50.4
375
oeddins.9.1
376
oeddins.8.1
377
oeddins.7.1
378
oeddins.6.1
379
oeddins.5.3
380
oeddins.4.1
381
obfs.49.2
382
obfs.48.4
383
obfs.47.2
384
obfs.46.4
385
obfs.45.2
386
obfs.44.4
387
obfs.43.2
388
nrs.99.2
389
nrs.98.5
390
nrs.97.4
391
obfs.36.4
392
obfs.35.2
393
piscoUCSB.21.1
394
nrs.76.3
395
nrs.75.2
396
nrs.70.3
397
VIR.8.1
398
VIR.7.1
399
VIR.6.1
400
VIR.4.1
401
VIR.3.1
402
nrs.69.2
403
nrs.68.5
404
nrs.67.2
405
nrs.64.5
406
nrs.63.2
407
nrs.54.2
408
Sartwell.99.1
409
nrs.53.2
410
nrs.52.2
411
nrs.51.2
412
Sartwell.92.2
413
Sartwell.91.2
414
Sartwell.90.2
415
nrs.48.3
416
nrs.47.2
417
nrs.46.2
418
nrs.45.2
419
nrs.44.2
420
Sartwell.88.10
421
nrs.43.2
422
nrs.42.2
423
Sartwell.87.1
424
ptorres.7.1
425
ptorres.6.1
426
nrs.40.2
427
ptorres.5.1
428
ptorres.4.1
429
ptorres.3.1
430
obfs.350.2
431
tcoll.27.1
432
tcoll.26.1
433
tcoll.25.1
434
tcoll.24.1
435
nrs.39.2
436
tcoll.23.1
437
nrs.38.2
438
tcoll.22.1
439
nrs.37.2
440
tcoll.21.1
441
tcoll.20.1
442
jones.301.1
443
jones.300.1
444
obfs.349.2
445
obfs.348.2
446
obfs.347.2
447
obfs.346.2
448
obfs.345.2
449
obfs.344.2
450
obfs.343.2
451
tcoll.19.1
452
tcoll.18.1
453
tcoll.17.1
454
tcoll.16.1
455
tcoll.15.1
456
tcoll.14.1
457
tcoll.13.1
458
nrs.26.3
459
nrs.25.3
460
nrs.24.2
461
nrs.23.2
462
nrs.22.2
463
nrs.20.2
464
obfs.338.2
465
obfs.337.2
466
obfs.336.2
467
obfs.335.2
468
obfs.334.2
469
obfs.333.2
470
obfs.332.2
471
obfs.331.2
472
obfs.330.2
473
nrs.19.2
474
obfs.329.2
475
obfs.328.2
476
obfs.327.2
477
obfs.326.2
478
obfs.325.2
479
obfs.324.3
480
obfs.323.2
481
obfs.322.3
482
obfs.321.2
483
obfs.320.3
484
umatilla.32.1
485
umatilla.31.1
486
umatilla.30.1
487
obfs.319.2
488
jwalsh.9.1
489
obfs.316.3
490
jwalsh.8.1
491
obfs.315.2
492
jwalsh.7.1
493
obfs.314.3
494
jwalsh.5.2
495
umatilla.28.3
496
obfs.313.2
497
obfs.312.3
498
umatilla.27.1
499
jwalsh.4.1
500
obfs.311.2
501
obfs.310.3
502
umatilla.25.1
503
umatilla.24.1
504
umatilla.23.2
505
obfs.309.2
506
obfs.308.3
507
obfs.307.2
508
obfs.306.3
509
obfs.305.2
510
obfs.304.3
511
tao.9608.1
512
tao.9607.1
513
obfs.303.2
514
obfs.302.3
515
tao.9606.1
516
tao.9605.1
517
obfs.301.2
518
umatilla.16.1
519
obfs.300.3
520
tao.9604.1
521
umatilla.15.1
522
umatilla.14.1
523
umatilla.12.7
524
umatilla.11.1
525
tao.9160.1
526
tao.9159.1
527
bowles.454.1
528
tao.9158.1
529
bowles.453.1
530
bowles.452.1
531
bowles.450.1
532
rellis.2677.1
533
tao.9150.1
534
hbr.9.1
535
hbr.8.2
536
hbr.7.1
537
hbr.5.3
538
hbr.4.1
539
bowles.449.1
540
bowles.448.1
541
bowles.447.1
542
bowles.446.1
543
tao.9149.1
544
bowles.444.1
545
tao.9148.1
546
tao.9147.1
547
bowles.443.1
548
bowles.442.1
549
tao.9146.1
550
bowles.441.1
551
tao.9145.1
552
bowles.440.2
553
tao.9144.1
554
tao.9143.1
555
tao.9142.1
556
tao.9141.1
557
tcoll.7.1
558
tcoll.6.1
559
tcoll.5.1
560
tcoll.4.3
561
tcoll.3.1
562
bowles.439.2
563
obfs.199.2
564
bowles.438.2
565
bowles.436.5
566
bowles.435.1
567
obfs.178.3
568
obfs.177.2
569
obfs.176.3
570
obfs.175.2
571
obfs.174.3
572
obfs.173.2
573
garciae7.13.1
574
garciae7.12.1
575
garciae7.11.1
576
garciae7.10.1
577
obfs.166.3
578
obfs.165.2
579
obfs.164.3
580
obfs.163.2
581
obfs.160.3
582
obfs.159.2
0 583

  
src/perl/transfer_emldocs_from_metacat1_to_metacat2.pl
1
#!/usr/bin/perl
2
#
3
#  '$RCSfile$'
4
#  Copyright: 2000 Regents of the University of California 
5
#
6
#   '$Author$'
7
#     '$Date$'
8
# '$Revision$' 
9
# 
10
# This program is free software; you can redistribute it and/or modify
11
# it under the terms of the GNU General Public License as published by
12
# the Free Software Foundation; either version 2 of the License, or
13
# (at your option) any later version.
14
#
15
# This program is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
# GNU General Public License for more details.
19
#
20
# You should have received a copy of the GNU General Public License
21
# along with this program; if not, write to the Free Software
22
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
#
24
#
25
# This is a CGI application for inserting metadata documents into
26
# the Metacat database.  It utilizes the Metacat.pm module for most work.
27
# You can specify two metacats and a list of documents. This script will
28
# copy documents from one metacat to another.
29

  
30

  
31
use Metacat;
32

  
33
my $metacat1;
34
my $metacat2;
35
my $docid;
36
my $error = 0;
37
my $xmldoc;
38
my $xa;
39
my $response;
40

  
41
my $listname = "list_of_docids";
42

  
43
my $metacat1_url = "http://metacat.nceas.ucsb.edu/knb/metacat";
44
my $metacat2_url = "http://indus.nceas.ucsb.edu/knb-test/metacat";
45
my $username = "uid=sgarg,o=NCEAS,dc=ecoinformatics,dc=org";
46
my $password = "xxxxxxxxxx";
47

  
48
$metacat1 = Metacat->new();
49
$metacat2 = Metacat->new();
50

  
51

  
52
if ($metacat1) {
53
    $metacat1->set_options( metacatUrl => $metacat1_url);
54
} else {
55
    #die "failed during metacat creation\n";
56
    print "Failed during metacat1 creation.";
57
    $error = 1;
58
}
59

  
60

  
61
# Login to metacat
62
print "Connecting to metacat1..........\n";
63
my $response1 = $metacat1->login($username, $password);
64
if (! $response1) {
65
    print $metacat1->getMessage();
66
    print "Failed during login: metacat1.\n";
67
    $error = 2;
68
} else {
69
    print "Connected to metacat1\n";
70
}
71

  
72
if ($metacat2) {
73
    $metacat2->set_options( metacatUrl => $metacat2_url );
74
} else {
75
    #die "failed during metacat creation\n";
76
    print "Failed during metacat2 creation.";
77
    $error = 3;
78
}
79

  
80
# Login to metacat
81
print "Connecting to metacat2..........\n";
82
my $response2 = $metacat2->login($username, $password);
83
if (! $response2) {
84
    #print $metacat->getMessage();
85
    #die "failed during login\n";
86
    print $metacat2->getMessage();
87
    print "Failed during login: metacat2.\n";
88
    $error = 4;
89
} else {
90
    print "Connected to metacat2\n";
91
}
92

  
93
if($error == 0){
94
    open(file,$listname) || die ("Couldn't open the file");
95
    while(<file>) {
96
	chomp();
97
	$xmldoc = $metacat1->read($_);
98
	$xa = $xmldoc->content;
99
	$response = $metacat2->insert($_, $xa);
100
	print $metacat2->getMessage();
101
    }
102
} else {
103
    print $error;
104
}
0 105

  

Also available in: Unified diff