/** * {@inheritDoc} */ @Override public Model difference(Model model) { return super.object.difference(model); }
public Model difference(Model model) { return model.difference(model); }
private boolean compareNormalized(Model a, Model b) { Model na = normalizeModel(a); Model nb = normalizeModel(b); boolean isIso = na.isIsomorphicWith(nb); if (!isIso) { System.err.println(">> beforehand: " + na.isIsomorphicWith(nb)); Model shared = na.intersection(nb); Model nams = na.difference(shared); Model nbms = nb.difference(shared); System.err.println(">> shared:"); shared.write(System.err, "Turtle"); System.err.println(">> expected [-shared]: "); nams.write(System.err, "Turtle"); System.err.println(">> computed [-shared]: "); nbms.write(System.err, "Turtle"); System.err.println(">> afterhand: " + na.difference(shared).isIsomorphicWith(nb.difference(shared))); } return isIso; }
private void assertContains(Model expect, Model rs) { if (!rs.containsAll(expect)) { Model spoo = expect.difference( rs ); StringBuilder them = new StringBuilder(); for (Statement s: spoo.listStatements().toList()) { them.append( s ).append( "\n" ); } // expect.write( System.err, "Turtle" ); // rs.write( System.err, "Turtle" ); System.err.println( them ); fail( "result set doesn't contain all expected triples: missing\n" + them ); } }
/** Compare <code>expected</code> and <code>obtained</code> for isomorphism. If they are not isomorphic, print out their shared submodel and the two different parts. Answer whether or not they're isomorphic. */ public static boolean compareAndDisplayDifferences( Model expected, Model obtained ) { boolean isIso = expected.isIsomorphicWith( obtained ); if (!isIso) { Model shared = expected.intersection(obtained); System.err.println( ">> shared:" ); shared.write( System.err, "Turtle" ); System.err.println( ">> expected [-shared]: " ); expected.difference(shared).write(System.err, "Turtle" ); System.err.println( ">> computed [-shared]: " ); obtained.difference(shared).write(System.err, "Turtle" ); } return isIso; }
Model G = given.difference(common), R = recon.difference(common);
Model differenceModel = resultModel.difference(existingDbModel); StmtIterator stmtDiffIter = differenceModel.listStatements(); while (stmtDiffIter.hasNext()) {