URI guernica = vf.createURI(EXAMPLE_NS, GUERNICA);
context1 = vf.createURI(EXAMPLE_NS, CONTEXT_1);
context2 = vf.createURI(EXAMPLE_NS, CONTEXT_2);
URI unknownContext = new URIImpl(EXAMPLE_NS + "unknown");
Thread.sleep(2000); // increase modified age
assertEquals(0, testCon.sizeMatch(null, null, null, false));
for (Resource subj : Arrays.asList(null, picasso)) {
for (URI pred : Arrays.asList(null, paints, RDF.TYPE)) {
for (Value obj : Arrays.asList(null, guernica)) {
for (Resource[] ctx : Arrays.asList(new Resource[0], new Resource[] { context1 },
new Resource[] { unknownContext }))
{
assertEquals(0, testCon.sizeMatch(subj, pred, obj, false, ctx));
}
}
}
}
// Add some data to the repository
testCon.begin();
testCon.add(painter, RDF.TYPE, RDFS.CLASS);
testCon.add(painting, RDF.TYPE, RDFS.CLASS);
testCon.add(picasso, RDF.TYPE, painter, context1);
testCon.add(guernica, RDF.TYPE, painting, context1);
testCon.add(picasso, paints, guernica, context1);
testCon.commit();
Thread.sleep(1000); // increase modified age
assertEquals(5, testCon.sizeMatch(null, null, null, false));
assertEquals(5, testCon.sizeMatch(null, null, null, false));
assertEquals(3, testCon.sizeMatch(null, null, null, false, context1));
assertEquals(4, testCon.sizeMatch(null, RDF.TYPE, null, false));
assertEquals(1, testCon.sizeMatch(null, paints, null, false));
assertEquals(2, testCon.sizeMatch(picasso, null, null, false));
assertEquals(2, testCon.sizeMatch(picasso, null, null, false));
assertEquals(0, testCon.sizeMatch(null, null, null, false, unknownContext));
assertEquals(0, testCon.sizeMatch(null, picasso, null, false));
URIImpl uriImplContext1 = new URIImpl(context1.toString());
assertEquals(3, testCon.sizeMatch(null, null, null, false, uriImplContext1));
}