/**
   * 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;
  }