StringWriter sw = new StringWriter();
org.openscience.cdk.interfaces.IChemModel som = theJcpp.getChemModel();
if (theJcpp.get2DHub().getRGroupHandler()!=null) {
RGroupQueryWriter rgw = new RGroupQueryWriter (sw);
rgw.write(theJcpp.get2DHub().getRGroupHandler().getrGroupQuery());
}
else {
MDLV2000Writer mdlwriter = new MDLV2000Writer(sw);
mdlwriter.write(som);
}