code: private boolean stage2(final Document document) {
          beginStage(PHASE1_STAGE2_HDR, "2", NUM_PHASES);
          final StringBuilder bldr = new StringBuilder();
  
          Collection<Namespace> namespaces = document.getNamespaceMap().values();
          final int docNSCount = namespaces.size();
  
          bldr.append("Compiling ");
          bldr.append(docNSCount);
          bldr.append(" namespace");
          if (docNSCount > 1) {
              bldr.append("s");
          }
          bldr.append(" for ");
          bldr.append(document.getName());
          stageOutput(bldr.toString());
  
          boolean success = true;
          long t1 = currentTimeMillis();
          try {
              p1.stage2NamespaceCompilation(document);
          } catch (ResourceDownloadError e) {
              success = false;
              stageError(e.getUserFacingMessage());
          } catch (IndexingFailure e) {
              success = false;
              stageError(e.getUserFacingMessage());
          }
  
          long t2 = currentTimeMillis();
          bldr.setLength(0);
          markTime(bldr, t1, t2);
          markEndStage(bldr);
          stageOutput(bldr.toString());
          return success;
      }
docs: Stage two resolution of document namespaces.
  
  @param document BEL common document
  @return boolean true if success, false otherwise