code: protected void writeAnnotations(
              Map<String, List<String>> effectiveAnnotationMap,
              Map<String, List<String>> currentAnnotationMap, Writer writer)
              throws IOException, BELRuntimeException {
  
          List<Map.Entry<String, List<String>>> entriesToSet =
                  new ArrayList<Map.Entry<String, List<String>>>();
          for (Map.Entry<String, List<String>> effEntry : effectiveAnnotationMap
                  .entrySet()) {
              if (!currentAnnotationMap.containsKey(effEntry.getKey())) {
                  //set annotation that are unique to the effective map
                  entriesToSet.add(effEntry);
              } else {
                  List<String> currentValues =
                          currentAnnotationMap.get(effEntry.getKey());
                  List<String> effectiveValues = effEntry.getValue();
                  if (currentValues == null || effectiveValues == null) {
                      throw new BELRuntimeException("Invalid annotation value",
                              ExitCode.PARSE_ERROR);
                  }
                  //set annotation that exist in both map, but values are different in effective map
                  //this will override the annotation
                  if (!currentValues.equals(effectiveValues)) {
                      entriesToSet.add(effEntry);
                  }
              }
          }
  
          //remove annotations that are no longer in the effective set
          currentAnnotationMap.keySet()
                  .removeAll(effectiveAnnotationMap.keySet());
          if (!currentAnnotationMap.keySet().isEmpty() || !entriesToSet.isEmpty()) {
              writer.write("\n");
              //unset
              for (String name : currentAnnotationMap.keySet()) {
                  unsetAnnotation(name, writer);
              }
              //set
              for (Map.Entry<String, List<String>> entry : entriesToSet) {
                  setAnnotation(entry.getKey(), entry.getValue(), writer);
              }
              writer.write("\n");
          }
  
          //current annotation map now reflects the effective annotations
          currentAnnotationMap.clear();
          currentAnnotationMap.putAll(effectiveAnnotationMap);
      }
docs: Writes a series of BEL script control statements via the writer to match current annotations to the effective
  annotations. At the end of this function, the content of currentAnnotationMap will be equivalent to the
  content of effectiveAnnotationMap.
  
  @param effectiveAnnotationMap
  @param currentAnnotationMap
  @param writer
  @throws IOException