import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;


public class GoReader {
	
	public static void main(String[] args) {
		List<GoTerm> terms = new ArrayList<GoTerm>();
		List<GoTerm> roots = new ArrayList<GoTerm>();
		List<GoTerm> children = new ArrayList<GoTerm>();
		terms=readGoDatabase(args[0]);
		roots=getRoots(terms);
		String id="GO:0006854";
		children=getChildren(terms,id);
		if(children.isEmpty()){
			System.out.println("No children");
		}
		else{
			for (GoTerm child : children){
				System.out.println(child.getId());
				System.out.println(child.getName());
				System.out.println(child.getNamespace());
				System.out.println(child.getParents());
				System.out.println();
			}
		}
	}
	
	public static List<GoTerm> readGoDatabase(String path){
		String line; 
		List<GoTerm> terms = new ArrayList<GoTerm>();			
		
		try {
			FileReader fr = new FileReader(path);
			BufferedReader br = new BufferedReader(fr);

			while((line=br.readLine()) != null){
				if(line.startsWith("[Term]")){					
					String id = br.readLine().substring(4);
					String name = br.readLine().substring(6);
					String namespace = br.readLine().substring(11);
					List<String> isa = new ArrayList<String>();
					// continue reading lines until the end of the term is reached
					do {
						line=br.readLine();
						if(line.startsWith("is_a:")){
							isa.add(line.substring(6,16));							
						}
					}
					while(! line.equals(""));
					terms.add(new GoTerm(id,name,namespace,isa));
				}
		    }		
		    fr.close();
		    }		
		    catch(Exception e) {
		    System.out.println("Exception: " + e);
		}
		return terms;
	}
	
	public static List<GoTerm> getRoots(List<GoTerm> terms){
		List<GoTerm> roots = new ArrayList<GoTerm>();
		for (GoTerm term : terms){
			if(term.getParents().isEmpty()){
				roots.add(term);
			}				
		}		
		return roots;
	}
	
	public static List<GoTerm> getChildren(List<GoTerm> terms, String id){
		List<GoTerm> children = new ArrayList<GoTerm>();
		for (GoTerm term : terms){
			if(term.getParents().contains(id)){
				children.add(term);			
			}
 		}
		return children;
	}
}

@@ -459,122 +459,36 @@
 %0D%0A%09%09
-if(children.isEmpty())%7B%0D%0A%09%09%09System.out.println(%22No children%22);%0D%0A%09%09%7D%0D%0A%09%09else%7B%0D%0A%09%09%09for (GoTerm child : children
+for (GoTerm root : roots
 )%7B%0D%0A
-%09
 %09%09%09S
@@ -501,29 +501,28 @@
 out.println(
-child
+root
 .getId());%0D%0A
@@ -516,33 +516,32 @@
 t.getId());%0D%0A%09%09%09
-%09
 System.out.print
@@ -535,37 +535,36 @@
 tem.out.println(
-child
+root
 .getName());%0D%0A%09%09
@@ -556,33 +556,32 @@
 getName());%0D%0A%09%09%09
-%09
 System.out.print
@@ -579,29 +579,28 @@
 out.println(
-child
+root
 .getNamespac
@@ -602,25 +602,24 @@
 espace());%0D%0A
-%09
 %09%09%09System.ou
@@ -628,21 +628,20 @@
 println(
-child
+root
 .getPare
@@ -649,17 +649,16 @@
 ts());%0D%0A
-%09
 %09%09%09Syste
@@ -675,22 +675,16 @@
 tln();%0D%0A
-%09%09%09%7D%0D%0A
 %09%09%7D%0D%0A%09%7D%0D
@@ -1195,24 +1195,56 @@
 String%3E();%0D%0A
+%09%09%09%09%09boolean obsolete = false;%0D%0A
 %09%09%09%09%09// cont
@@ -1426,24 +1426,103 @@
 %09%0D%0A%09%09%09%09%09%09%7D%0D%0A
+%09%09%09%09%09%09if (line.startsWith(%22is_obsolete:%22))%7B%0D%0A%09%09%09%09%09%09%09obsolete = true;%0D%0A%09%09%09%09%09%09%7D%0D%0A
 %09%09%09%09%09%7D%0D%0A%09%09%09%09
@@ -1545,24 +1545,47 @@
 uals(%22%22));%0D%0A
+%09%09%09%09%09if (!obsolete)%7B%0D%0A%09
 %09%09%09%09%09terms.a
@@ -1620,24 +1620,32 @@
 ace,isa));%0D%0A
+%09%09%09%09%09%7D%0D%0A
 %09%09%09%09%7D%0D%0A%09%09   

Problem solved.