示例#1
0
  // TEMPORARY
  private boolean checkResultsByModel(
      Query query, Model expectedModel, ResultSetRewindable results) {
    // Fudge - can't cope with ordered results properly.  The output writer for ResultSets does nto
    // add rs:index.

    results.reset();
    Model actualModel = ResultSetFormatter.toModel(results);
    // Tidy the models.
    // Very regretable.

    expectedModel.removeAll(null, RDF.type, ResultSetGraphVocab.ResultSet);
    expectedModel.removeAll(null, RDF.type, ResultSetGraphVocab.ResultSolution);
    expectedModel.removeAll(null, RDF.type, ResultSetGraphVocab.ResultBinding);
    expectedModel.removeAll(null, ResultSetGraphVocab.size, (RDFNode) null);
    expectedModel.removeAll(null, ResultSetGraphVocab.index, (RDFNode) null);

    actualModel.removeAll(null, RDF.type, ResultSetGraphVocab.ResultSet);
    actualModel.removeAll(null, RDF.type, ResultSetGraphVocab.ResultSolution);
    actualModel.removeAll(null, RDF.type, ResultSetGraphVocab.ResultBinding);
    actualModel.removeAll(null, ResultSetGraphVocab.size, (RDFNode) null);
    actualModel.removeAll(null, ResultSetGraphVocab.index, (RDFNode) null);

    boolean b = expectedModel.isIsomorphicWith(actualModel);
    if (!b) {
      System.out.println("---- Expected");
      expectedModel.write(System.out, "TTL");
      System.out.println("---- Actual");
      actualModel.write(System.out, "TTL");
      System.out.println("----");
    }
    return b;
  }
示例#2
0
 void printFailedModelTest(Query query, Model expected, Model results) {
   PrintWriter out = FileUtils.asPrintWriterUTF8(System.out);
   out.println("=======================================");
   out.println("Failure: " + description());
   results.write(out, "TTL");
   out.println("---------------------------------------");
   expected.write(out, "TTL");
   out.println();
 }