Call the NERC Vocab with Python

In this example the NERC Vocabulary Server documentation is followed, with some adaptations (check code block below).

from suds.client import Client

url = 'http://vocab.nerc.ac.uk/vocab2.wsdl'
client = Client(url)
uris = 'http://vocab.nerc.ac.uk/collection/P01/current/'
result = client.service.SearchVocab('*alinity*',False,'definition',10,True,uris,'all')

# call the function print_results, see below
print_results(result)

The following code gives a listing of a few of the characteristics

def print_results(result):
    if result[1] != 0:
        for i in range(len(result[3][0])):
            print 'concept    =',result[3][0][i][1] 
            print 'label      =',result[3][0][i][2][0][0]
            print 'definition =',result[3][0][i][4][0][0]
            print 'member of  =',result[3][0][i][8][0][0]
            print 'identifier =',result[3][0][i][9]
            print '------------------------------------------'
            print ' '
    else:
        print 'no results found'