private static Set < String > getRelationLevelSet ( SDocumentGraph graph , String namespace , Class < ? extends SRelation > type ) { Set < String > result = new TreeSet <> ( ) ; if ( graph != null ) { List < ? extends SRelation > edges = null ; if ( type == SDominanceRelation . class ) { edges = graph . getDominanceRelations ( ) ; } else if ( type == SPointingRelation . class ) { edges = graph . getPointingRelations ( ) ; } else if ( type == SSpanningRelation . class ) { edges = graph . getSpanningRelations ( ) ; } if ( edges != null ) { for ( SRelation < ? , ? > edge : edges ) { Set < SLayer > layers = edge . getLayers ( ) ; for ( SLayer layer : layers ) { if ( namespace == null || namespace . equals ( layer . getName ( ) ) ) { for ( SAnnotation anno : edge . getAnnotations ( ) ) { result . add ( anno . getQName ( ) ) ; } // we got all annotations of this edge, jump to next edge break ; } // end if namespace equals layer name } // end for each layer } // end for each edge } } return result ; }
Get the qualified name of all annotations belonging to relations having a specific namespace .