Exemplo n.º 1
0
  /**
   * This method delivers a Hashtable which contains the Attributs names (Attributes of the case)
   * combined with their respective values.
   *
   * @author weber,koehler,namuth
   * @param r = An Instance.
   * @param concept = A Concept
   * @return List = List containing the Attributes of a case with their values.
   */
  public static Hashtable<String, String> getAttributes(
      final Pair<Instance, Similarity> r, final Concept concept) {

    Hashtable<String, String> table = new Hashtable<String, String>();
    ArrayList<String> cats = getCategories(r);
    // Add the similarity of the case
    table.put("Sim", String.valueOf(r.getSecond().getValue()));
    for (String cat : cats) {
      // Add the Attribute name and its value into the Hashtable
      table.put(
          cat,
          r.getFirst().getAttForDesc(concept.getAllAttributeDescs().get(cat)).getValueAsString());
    }
    return table;
  }
Exemplo n.º 2
0
  /**
   * This Method generates an ArrayList, which contains all Categories of aa Concept.
   *
   * @author weber,koehler,namuth
   * @param r = An Instance.
   * @return List = List containing the Attributes names.
   */
  public static ArrayList<String> getCategories(final Pair<Instance, Similarity> r) {

    ArrayList<String> cats = new ArrayList<String>();

    // Read all Attributes of a Concept
    Set<AttributeDesc> catlist = r.getFirst().getAttributes().keySet();

    for (AttributeDesc cat : catlist) {
      if (cat != null) {
        // Add the String literals for each Attribute into the ArrayList
        cats.add(cat.getName());
      }
    }
    return cats;
  }