code: public Map<UUID, String> getClassInstanceKeys(final Instance _instance)
          throws EFapsException
      {
          final Map<UUID, String> ret = new HashMap<UUID, String>();
          UIClassification clazz = this;
          while (!clazz.isRoot()) {
              clazz = clazz.getParent();
          }
          Type reltype = null;
          for (final UIClassification child : clazz.getChildren()) {
              final Classification classType = (Classification) Type.get(child.getClassificationUUID());
              if (!classType.getClassifyRelationType().equals(reltype)) {
                  final QueryBuilder queryBldr = new QueryBuilder(classType.getClassifyRelationType());
                  queryBldr.addWhereAttrEqValue(classType.getRelLinkAttributeName(), _instance.getId());
                  final MultiPrintQuery multi = queryBldr.getPrint();
                  multi.addAttribute(classType.getRelTypeAttributeName());
                  multi.execute();
                  while (multi.next()) {
                      final Long typeid = multi.<Long>getAttribute(classType.getRelTypeAttributeName());
                      final Classification subClassType = (Classification) Type.get(typeid);
                      final QueryBuilder subQueryBldr = new QueryBuilder(subClassType);
                      subQueryBldr.addWhereAttrEqValue(subClassType.getLinkAttributeName(), _instance.getId());
                      subQueryBldr.addOrderByAttributeAsc("ID");
                      final InstanceQuery query = subQueryBldr.getQuery();
                      query.execute();
                      if (query.next()) {
                          // TODO must return an instanceKey!!! not necessary the
                          // oid
                          final String instanceKey = query.getCurrentValue().getOid();
                          ret.put(query.getCurrentValue().getType().getUUID(), instanceKey);
                          this.selectedUUID.add(query.getCurrentValue().getType().getUUID());
                      }
                  }
              }
              reltype = classType.getClassifyRelationType();
          }
          return ret;
      }
docs: Method to get the key to the instances related to this classification.
  
  @param _instance Instance the related instance key are searched for
  @return Map of instance keys
  @throws EFapsException on error