use of com.sri.ai.praise.lang.translate.impl.HOGMv1_to_UAI_Translator in project aic-praise by aic-sri-international.
the class SGSolverDemoController method exportUAIModel.
private void exportUAIModel(ActionEvent ae) {
try {
callCurrentModelPageEditor(modelPage -> {
File uaiModelFile = uaiFileChooser.showSaveDialog(mainStage);
if (uaiModelFile != null) {
if (!uaiModelFile.getName().endsWith(ModelLanguage.UAI.getDefaultFileExtension())) {
uaiModelFile = new File(uaiModelFile.getParent(), uaiModelFile.getName() + ModelLanguage.UAI.getDefaultFileExtension());
}
File uaiEvidenceFile = new File(uaiModelFile.getParent(), uaiModelFile.getName() + ModelLanguage.UAI.getDefaultFileExtension() + ".evid");
try (PrintWriter uaiModelWriter = new PrintWriter(uaiModelFile);
PrintWriter uaiEvidenceWriter = new PrintWriter(uaiEvidenceFile)) {
HOGMv1_to_UAI_Translator translator = new HOGMv1_to_UAI_Translator();
translator.translate(uaiModelFile.getName(), new Reader[] { new StringReader(modelPage.getCurrentPageContents()) }, new PrintWriter[] { uaiModelWriter, uaiEvidenceWriter }, new TranslatorOptions());
} catch (Throwable th) {
FXUtil.exception(th);
}
}
});
} catch (Throwable th) {
FXUtil.exception(th);
}
}
Aggregations