ByteArrayOutputStream baos = new ByteArrayOutputStream();
CountingTripleHandler cth1 = new CountingTripleHandler();
RDFXMLWriter ctw1 = new RDFXMLWriter(baos);
CompositeTripleHandler compositeTH1 = new CompositeTripleHandler();
compositeTH1.addChild(cth1);
compositeTH1.addChild(ctw1);
runner.extract(
new ExtractionParameters(DefaultConfiguration.singleton(),
ValidationMode.None, true), source, compositeTH1);
compositeTH1.close();
logger.debug("Out1: " + baos.toString());
Assert.assertEquals("Unexpected number of triples.",
EXPECTED_TRIPLES + 3, cth1.getCount());
baos.reset();
CountingTripleHandler cth2 = new CountingTripleHandler();
NTriplesWriter ctw2 = new NTriplesWriter(baos);
CompositeTripleHandler compositeTH2 = new CompositeTripleHandler();
compositeTH2.addChild(cth2);
compositeTH2.addChild(ctw2);
runner.extract(
new ExtractionParameters(DefaultConfiguration.singleton(),
ValidationMode.ValidateAndFix, false), source,
compositeTH2);
compositeTH2.close();
logger.debug("Out2: " + baos.toString());
Assert.assertEquals("Unexpected number of triples.", EXPECTED_TRIPLES,
cth2.getCount());
}