source: TI01-discovery/branches/ingestion-MEDIN/ingestAutomation-upgrade/OAIBatch/testISO.py @ 6310

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/branches/ingestion-MEDIN/ingestAutomation-upgrade/OAIBatch/testISO.py@6310
Revision 6310, 1.9 KB checked in by sdonegan, 11 years ago (diff)

Initial classes for creating a data object to aid ingestion of ISO metadata records. difConvertedtoISO19139.py is the xpath definition class for the results of dif2iso xqueries. testIso.py is a test class to check output

Line 
1from ExtractISO import ExtractISO
2import logging,os
3
4logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(filename)s:%(lineno)d %(levelname)s %(message)s')
5
6#test dif2stubIso xml file - converted from dif via xquery
7dif2stubIso_file = 'data/NEODC/stub_iso/neodc.nerc.ac.uk__stubISO__dataent_11658383444211836_DIF.xml'
8
9isoData = ExtractISO(dif2stubIso_file,'dif2stubIso')
10
11if isoData.createISOdataStructure() is True:
12        logging.info("ISO extractor worked fine! (here are the variables...)")
13elif isoData.createISOdataStructure() is True:
14        logging.info ("Something wrong with ISO extractor... (ExtractISO returned False: xml access problem?)")
15        sys.exit()
16else:
17        logging.info( "Something SERIOUSELY wrong with extractor (couldnt get at ExtractISO class)")
18        sys.exit()
19
20
21print "\nTesting for keywords..."
22for i in isoData.keywords:
23        print "keywords: " + i
24       
25print "\nTesting for revision date (List)..."
26for i in isoData.revisionDate:
27        print "revisionDate: " + i
28       
29print "\nTesting for creation date (List) ..."
30for i in isoData.createDate:
31        print "createDate: " + i
32       
33print "\nTesting for dataset name (List) ..."
34for i in isoData.datasetName:
35        print "datasetName: " + i
36       
37print "\nTesting for bounding dates (dictionary) ..."
38for i in isoData.boundingDates.keys():
39        print "boundingDates: " + i + " = " + isoData.boundingDates[i]
40       
41print "\nTesting for original format (List) ..."
42for i in isoData.originalFormat:
43        print "originalFormat: " + i   
44       
45print "\nTesting for authors (List) ..."
46for i in isoData.authors:
47        print "authors: " + i
48               
49print "\nTesting for data centre name (List) ..."
50for i in isoData.datacentreName:
51        print "datacentreName: " + i
52       
53print "\nTesting for parameters (List) ..."
54for i in isoData.parameters:
55        print "parameters: " + i
56       
57print "\nTesting for data centre name (dictionary) ..."
58for i in isoData.boundingBoxCoordinates.keys():
59        print "boundingBoxCoordinates: " + i + " = " + isoData.boundingBoxCoordinates[i]
Note: See TracBrowser for help on using the repository browser.