function [ output_args ] = Tutorial7( input_args )
%TUTORIAL6 How to use annotations, part 2.

%create the JAVA object
omero = omeroconnect.Main;

%connect to the server as user X
omero.initConnectionDetails('cmpdartsvr1.cmp.uea.ac.uk', 'avondoj', 'avondo');

%we can retrieve the whole tagset vocabolary from the OMERO database,
tagsets = omero.getTagsetsAndTags();

disp(sprintf('\nALL-TAGSETS: \n'));

%iterate over the tagset colection
tagset_iterator = tagsets.iterator();
while(tagset_iterator.hasNext())
    
    %retrieve the current item
    tagset_item = tagset_iterator.next();
    
    %print the tagset name
    disp(sprintf('%s', char(tagset_item.tagset)));
    
    %now iterate over all the tags belonging to this tagset
    tag_iterator = tagset_item.tags.iterator();
    while(tag_iterator.hasNext())
        tag = tag_iterator.next();
        
        %print the tag belonging to the current tagset
        disp(sprintf('\t %s', char(tag)));
    end
end

%now we will retrieve all tags belonging to a particular tagset.
tag = 'Tissue Type';
tags = omero.getTagsFromTagset(tag);

disp(sprintf('\nTAGSETS: %s \n', tag));

%now display the tags belonging to the tagset 'Tissue Type'
tag_iterator = tags.iterator();
while(tag_iterator.hasNext())
    
    %retrieve the current item
    tag = tag_iterator.next();
    
    %print the tagset name
    disp(sprintf('%s', char(tag)));
end