public static MatchingTaskPreset[] getMatchingTaskPresets() {
    List<MatchingTaskPreset> loadedTaskList = loadMatchingTaskPresets();

    if (loadedTaskList == null) {
      return new MatchingTaskPreset[0];
    }

    // make sure the files exist
    List<MatchingTaskPreset> filteredTaskList = new LinkedList<>();
    for (MatchingTaskPreset p : loadedTaskList) {
      File sourceOntFile = new File(p.getSourceOntology());
      if (!sourceOntFile.exists()) {
        LOG.debug("Source ontology file not found. Ignoring preset:" + p);
        continue;
      }

      File targetOntFile = new File(p.getTargetOntology());
      if (!targetOntFile.exists()) {
        LOG.debug("Target ontology file not found. Ignoring preset:" + p);
        continue;
      }

      filteredTaskList.add(p);
    }

    return filteredTaskList.toArray(new MatchingTaskPreset[0]);
  }
  /**
   * Verify that a MatchingTaskPreset is correctly specified.
   *
   * @return true if the MatchingTaskPreset is valid, false otherwise.
   */
  public static boolean isValid(MatchingTaskPreset p) {
    if (p == null) {
      LOG.trace("MatchingTaskPreset is null.");
      return false;
    }

    if (p.getName() == null || p.getName().isEmpty()) {
      LOG.trace("MatchingTaskPreset name is missing.");
      return false;
    }

    if (p.getSourceOntology() == null) {
      LOG.trace("MatchingTaskPreset sourceOntology cannot be null");
      return false;
    }
    File sourceFile = new File(p.getSourceOntology());
    if (!sourceFile.exists() || sourceFile.isDirectory()) {
      LOG.trace("MatchingTaskPreset sourceOntology file not found.");
      return false;
    }

    if (p.getTargetOntology() == null) {
      LOG.trace("MatchingTaskPreset targetOntology cannot be null");
      return false;
    }
    File targetFile = new File(p.getTargetOntology());
    if (!targetFile.exists() || targetFile.isDirectory()) {
      LOG.trace("MatchingTaskPreset targetOntology file not found.");
      return false;
    }

    if (p.hasReference()) {
      if (p.getReference() == null) {
        LOG.trace("MatchingTaskPreset reference cannot be null when hasReference() is true.");
        return false;
      }
      File refFile = new File(p.getReference());
      if (!refFile.exists() || refFile.isDirectory()) {
        LOG.trace("MatchingTaskPreset reference file not found.");
        return false;
      }
    }

    return true;
  }