anchor.diff:      
       String subjectName = ((Individual)request.getAttribute("subject")).getName();
       
  -    // Get largest existing rank value, increment by 1, for hidden rank field value
  +    // Get largest existing rank value
       int maxRank = 0; // default value 
       if (objectUri == null) { // adding new webpage   
  -        log.debug("getting max existing rank for subject");
           String queryStr = QueryUtils.subUriForQueryVar(RANK_QUERY, "subject", subjectUri);
           log.debug("Query string is: " + queryStr);
           try {
               ResultSet results = QueryUtils.getQueryResults(queryStr, vreq);
               if (results != null && results.hasNext()) { // there is at most one result
  -                log.debug("found a rank");
                   QuerySolution soln = results.next(); 
                   RDFNode node = soln.get("rank");
                   if (node != null && node.isLiteral()) {
  -                    log.debug("node value =" + node.asLiteral().getLexicalForm());
  -                    int rank = node.asLiteral().getInt(); // what if it's not an int? - what gets returned?
  +                    // node.asLiteral().getInt() won't return an xsd:string that 
  +                    // can be parsed as an int.
  +                    int rank = Integer.parseInt(node.asLiteral().getLexicalForm());
                       if (rank > maxRank) {  
                           log.debug("setting maxRank to " + rank);
                           maxRank = rank;
                       }
                   }
               }
  +        } catch (NumberFormatException e) {
  +            log.error("Invalid rank returned from query: not an integer value.");
           } catch (Exception e) {
               log.error(e, e);
           }
       }
  -    maxRank++;
  +
   %>
   
   <c:choose>
  
positive.code:     <v:input type="text" label="Webpage Name" id="anchor" size="70"/>
      <p><em>If left blank, the URL will be used when displaying a link to this webpage.</em></p>
      <c:if test="${editMode == 'add'}">
          <input type="hidden" name="rank" value="<%= maxRank %>" />
      </c:if>
      <p class="submit"><v:input type="submit" id="submit" value="${submitButtonText}" cancel="true"/></p>
  </form>
  
  <jsp:include page="${postForm}"/>
  
negative.code:          "literalOptions"   : [ ],
           "predicateUri"     : "",
           "objectClassUri"   : "",
           "rangeDatatypeUri" : "${intDatatypeUriJson}",
           "rangeLang"        : "",
           "assertions"       : [ "${rankAssertion}" ]      
        }
  