// 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; }
private void compareGraphResults(Model resultsActual, Query query) { if (results != null) { try { if (!results.isGraph()) fail("Expected results are not a graph: " + testItem.getName()); Model resultsExpected = results.getModel(); if (!resultsExpected.isIsomorphicWith(resultsActual)) { printFailedModelTest(query, resultsExpected, resultsActual); fail("Results do not match: " + testItem.getName()); } } catch (Exception ex) { String typeName = (query.isConstructType() ? "construct" : "describe"); fail("Exception in result testing (" + typeName + "): " + ex); } } }