public static String createSqlAssertionFromProposition(Proposition proposition, Keyword mode) {
    { Surrogate relationRef = Proposition.getPropositionBaseOperator(proposition);
      NamedDescription relation = Logic.getDescription(relationRef);
      boolean isfunctionP = Logic.functionP(relationRef);
      RelationTableInfo tableInfo = RDBMS.getRelationTableInfo(relation);
      String tableAlias = tableInfo.tableAlias;
      Skolem skolemTerm = null;
      Stella_Object functionValue = null;
      Vector arguments = null;
      OutputStringStream sql = OutputStringStream.newOutputStringStream();
      boolean firstP = true;

      tableInfo.tableAlias = null;
      if (isfunctionP) {
        {
          { Object [] caller_MV_returnarray = new Object[1];

            skolemTerm = Proposition.getSkolemAndValueTerms(proposition, caller_MV_returnarray);
            functionValue = ((Stella_Object)(caller_MV_returnarray[0]));
          }
          { Vector args = skolemTerm.definingProposition.arguments;
            int argsLength = args.length();

            arguments = Vector.newVector(((mode == RDBMS.KWD_CLIP) ? (argsLength - 1) : argsLength));
            { int i = Stella.NULL_INTEGER;
              int iter000 = 0;
              int upperBound000 = argsLength - 2;

              for (;iter000 <= upperBound000; iter000 = iter000 + 1) {
                i = iter000;
                (arguments.theArray)[i] = ((args.theArray)[i]);
              }
            }
            if (!(mode == RDBMS.KWD_CLIP)) {
              (arguments.theArray)[(argsLength - 1)] = functionValue;
            }
          }
        }
      }
      else {
        arguments = proposition.arguments;
      }
      if (mode == RDBMS.KWD_ASSERT) {
        sql.nativeStream.print("INSERT INTO " + tableInfo.tableName);
        sql.nativeStream.print(" (");
        RDBMS.printSqlColumnList(sql, tableInfo);
        sql.nativeStream.print(") VALUES (");
        { RelationColumnInfo column = null;
          Cons iter001 = tableInfo.columnList;
          Stella_Object arg = null;
          Vector vector000 = arguments;
          int index000 = 0;
          int length000 = vector000.length();

          for (;(!(iter001 == Stella.NIL)) &&
                    (index000 < length000); iter001 = iter001.rest, index000 = index000 + 1) {
            column = ((RelationColumnInfo)(iter001.value));
            arg = (vector000.theArray)[index000];
            if ((arg == null) ||
                Logic.skolemP(arg)) {
              { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

                stream000.nativeStream.print("Can't assert non-ground items to table from `" + proposition + "'");
                throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
              }
            }
            else if (firstP) {
              firstP = false;
            }
            else {
              sql.nativeStream.print(", ");
            }
            RDBMS.printSqlValue(sql, arg, column);
          }
        }
        sql.nativeStream.print(")");
      }
      else if ((mode == RDBMS.KWD_RETRACT) ||
          (mode == RDBMS.KWD_CLIP)) {
        sql.nativeStream.print("DELETE FROM " + tableInfo.tableName + " ");
        RDBMS.printSqlConstraintList(sql, tableInfo, arguments);
      }
      else {
        { OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

          stream001.nativeStream.print("`" + mode + "' is not a valid case option");
          throw ((StellaException)(StellaException.newStellaException(stream001.theStringReader()).fillInStackTrace()));
        }
      }
      tableInfo.tableAlias = tableAlias;
      Keyword.bumpMemoizationTimestamp(RDBMS.KWD_EXTERNAL_DB_UPDATE);
      return (sql.theStringReader());
    }
  }