public int getPropertiesNotPresent(NType p) {
   int count = 0;
   for (Property pid : app.getProperties(p, true, true)) {
     if (!definedProperty(pid.getID())) {
       count++;
     }
   }
   return count;
 }
  public void addNewPattern(String patternID) {
    if (!detail.getTypes().contains(patternID)) {
      NType p = app.getType(patternID);
      if (p != null) {
        detail.addType(patternID);

        for (Property pr : app.getAvailableProperties(detail).keySet()) {
          if (pr.getCardinalityMin() > 0) {
            for (int i = getPropertiesPresent(pr.getID()); i < pr.getCardinalityMin(); i++) {
              addProperty(pr.getID());
            }
          }
        }
      }

      refreshPatternBar();
      refreshProperties();
    }
  }