コード例 #1
0
 private void validateDescription(I_ConceptualizeLocally local)
     throws IOException, TerminologyException {
   boolean found = false;
   for (I_DescribeConceptLocally desc : local.getDescriptions()) {
     if (desc.getText().equals(description)) {
       found = true;
       break;
     }
   }
   if (found == false) {
     throw new RuntimeException(
         "No description matching: " + description + " found for: " + local);
   }
 }
コード例 #2
0
  private boolean validateRelationships(I_ConceptualizeLocally local)
      throws IOException, TerminologyException {
    if (relSpecs == null || relSpecs.length == 0) {
      return true;
    }

    for (RelSpec relSpec : relSpecs) {
      I_ConceptualizeLocally relType = relSpec.getRelType().localize();
      I_ConceptualizeLocally destination = relSpec.getDestination().localize();
      boolean foundDestination = false;
      boolean foundType = false;
      List<I_ConceptualizeLocally> destinationsOfType = new ArrayList<I_ConceptualizeLocally>();

      for (I_RelateConceptsLocally rel : local.getSourceRels()) {
        if (rel.getRelType().equals(relType)) {
          foundType = true;
          destinationsOfType.add(rel.getC2());
          if (rel.getC2().equals(destination)) {
            foundDestination = true;
            break;
          }
        }
      }
      if (foundDestination == false) {
        boolean foundTransitively = false;
        if (foundType == true && relSpec.isTransitive()) {
          for (I_ConceptualizeLocally destinationOfType : destinationsOfType) {
            if (validateRelationships(destinationOfType)) {
              foundTransitively = true;
              break;
            }
          }
        }
        if (foundTransitively == false) {
          throw new RuntimeException("No matching rel: " + relSpec + " found for: " + local);
        }
      }
    }
    return true;
  }