code: private boolean stage4(final Document document) {
          beginStage(PHASE1_STAGE4_HDR, "4", NUM_PHASES);
          final StringBuilder bldr = new StringBuilder();
          if (hasOption(NO_SEMANTIC_CHECK)) {
              bldr.append(SEMANTIC_CHECKS_DISABLED);
              markEndStage(bldr);
              stageOutput(bldr.toString());
              return true;
          }
  
          bldr.append("Verifying semantics in ");
          bldr.append(document.getName());
          stageOutput(bldr.toString());
  
          boolean warnings = false;
          long t1 = currentTimeMillis();
          try {
              p1.stage4SemanticVerification(document);
          } catch (SemanticFailure sf) {
              warnings = true;
              String resname = sf.getName();
              if (resname == null) {
                  sf.setName(document.getName());
              } else {
                  sf.setName(resname + " (" + document.getName() + ")");
              }
              stageWarning(sf.getUserFacingMessage());
          } catch (IndexingFailure e) {
              stageError("Failed to process namespace index files for semantic" +
              		" verification.");
          }
          long t2 = currentTimeMillis();
  
          bldr.setLength(0);
          if (warnings) {
              bldr.append("Semantic verification resulted in warnings in ");
              bldr.append(document.getName());
              bldr.append("\n");
          }
          markTime(bldr, t1, t2);
          markEndStage(bldr);
          stageOutput(bldr.toString());
  
          if (warnings) {
              return false;
          }
          return true;
      }
docs: Stage four semantic verification of the document.
  
  @param document BEL common document
  @return boolean true if success, false otherwise