private static String getVarName(ValueExpr v) {
   if (v instanceof Var) {
     Var var = (Var) v;
     if (!var.isConstant()) {
       return var.getName();
     }
   }
   return null;
 }
  /**
   * Provides a string representation of an SP which contains info about whether each component
   * (subj, pred, obj) is constant and its data and data type if it is constant.
   *
   * @param sp - The statement pattern to convert. (not null)
   * @return A String representation of the statement pattern that may be used to do triple
   *     matching.
   */
  public static String toStatementPatternString(final StatementPattern sp) {
    checkNotNull(sp);

    final Var subjVar = sp.getSubjectVar();
    String subj = subjVar.getName();
    if (subjVar.isConstant()) {
      subj = subj + TYPE_DELIM + URI_TYPE;
    }

    final Var predVar = sp.getPredicateVar();
    String pred = predVar.getName();
    if (predVar.isConstant()) {
      pred = pred + TYPE_DELIM + URI_TYPE;
    }

    final Var objVar = sp.getObjectVar();
    String obj = objVar.getName();
    if (objVar.isConstant()) {
      final RyaType rt = RdfToRyaConversions.convertValue(objVar.getValue());
      obj = obj + TYPE_DELIM + rt.getDataType().stringValue();
    }

    return subj + DELIM + pred + DELIM + obj;
  }