Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Call the NERC Vocab with Python

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

Code Block
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

Code Block
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'