public static void listUnificationXrefsPerPathway ( Model model ) { // This is a visitor for elements in a pathway - direct and indirect Visitor visitor = new Visitor ( ) { public void visit ( BioPAXElement domain , Object range , Model model , PropertyEditor editor ) { if ( range instanceof physicalEntity ) { // Do whatever you want with the pe and xref here physicalEntity pe = ( physicalEntity ) range ; ClassFilterSet < xref , unificationXref > unis = new ClassFilterSet < xref , unificationXref > ( pe . getXREF ( ) , unificationXref . class ) ; for ( unificationXref uni : unis ) { System . out . println ( "pe.getNAME() = " + pe . getNAME ( ) ) ; System . out . println ( "uni = " + uni . getID ( ) ) ; } } } } ; Traverser traverser = new Traverser ( SimpleEditorMap . L2 , visitor ) ; Set < pathway > pathways = model . getObjects ( pathway . class ) ; for ( pathway pathway : pathways ) { traverser . traverse ( pathway , model ) ; } }
Here is a more elegant way of doing the previous method!