code: public static Vector getRelatedElementsVector(String pathname,
              GraphEntity element, String relationshipname, String role)
              throws NullEntity {
          Vector rels = element.getAllRelationships();
          Enumeration enumeration = rels.elements();
          Vector related = new Vector();
          while (enumeration.hasMoreElements()) {
              GraphRelationship gr = (GraphRelationship) enumeration
                      .nextElement();
              String[] path = gr.getGraph().getPath();
              boolean found = false;
              for (int k = 0; k < path.length && !found; k++) {
                  found = path[k].toLowerCase().indexOf(pathname) >= 0;
              }
              if (found
                      && gr.getType().toLowerCase()
                      .equals(relationshipname.toLowerCase())) {
                  GraphRole[] roles = gr.getRoles();
                  for (int k = 0; k < roles.length; k++) {
                      if (roles[k].getName().toLowerCase()
                              .equals(role.toLowerCase())) {
                          related.add(roles[k].getPlayer());
                      }
                  }
              }
          }
          return new Vector(new HashSet(related));
      }
docs: It obtains all elements related with "element" with "relationshipname"
  and occupying the extreme "role. Also, the association where these
  elements appear must be allocated in the package whose pathname matches
  the "pathname" parameter
  
  @param pathname Part of a path name. It will force located relationships
  to belong to concrete sets of diagrams allocated in concrete packages
  @param element The element to be studied
  @param relationshipname The name of the relationship which will be
  studied
  @param role The name of the extreme of the relationship that has to be
  studied
  @return A list of entities.
  @throws NullEntity