### Question:
SGDStreamingInference extends InferenceApplication { @Override public void close() { termStore.close(); reasoner.close(); termStore = null; reasoner = null; model = null; db = null; } SGDStreamingInference(Model model, Database db); @Override void close();  }### Answer:
@Test public void baseTest() { TestModel.ModelInformation info = TestModel.getModel(); Set<StandardPredicate> toClose = new HashSet<StandardPredicate>(); Database inferDB = info.dataStore.getDatabase(info.targetPartition, toClose, info.observationPartition); SGDStreamingInference mpe = new SGDStreamingInference(info.model, inferDB); mpe.inference(); mpe.close(); inferDB.close(); }
@Test public void testBasePostgres() { DatabaseDriver driver = DatabaseTestUtil.getPostgresDriver(); if (driver == null) { return; } TestModel.ModelInformation info = TestModel.getModel(false, driver); Set<StandardPredicate> toClose = new HashSet<StandardPredicate>(); Database inferDB = info.dataStore.getDatabase(info.targetPartition, toClose, info.observationPartition); SGDStreamingInference mpe = new SGDStreamingInference(info.model, inferDB); mpe.inference(); mpe.close(); inferDB.close(); }