code: private void appendValue(RelationQueryNode node, StringBuilder b)
              throws RepositoryException {
          if (node.getValueType() == TYPE_LONG) {
              b.append(node.getLongValue());
          } else if (node.getValueType() == TYPE_DOUBLE) {
              b.append(node.getDoubleValue());
          } else if (node.getValueType() == TYPE_STRING) {
              b.append("'").append(node.getStringValue().replaceAll("'", "''")).append("'");
          } else if (node.getValueType() == TYPE_DATE || node.getValueType() == TYPE_TIMESTAMP) {
              Calendar cal = Calendar.getInstance(Tools.getTimeZone("UTC"));
              cal.setTime(node.getDateValue());
              b.append(resolver.createJCRName(XPathQueryBuilder.XS_DATETIME).getAsString());
              b.append("('").append(ISO8601.format(cal)).append("')");
          } else if (node.getValueType() == TYPE_POSITION) {
              if (node.getPositionValue() == LocationStepQueryNode.LAST) {
                  b.append("last()");
              } else {
                  b.append(node.getPositionValue());
              }
          } else {
              exceptions.add(new InvalidQueryException("Invalid type: " + node.getValueType()));
          }
      }
docs: Appends the value of a relation node to the <code>StringBuilder</code>
  <code>sb</code>.
  
  @param node the relation node.
  @param b    where to append the value.
  @throws RepositoryException