use of com.sri.ai.praise.core.representation.translation.ciaranframework.core.uai.HOGMv1_to_UAI_Translator in project aic-praise by aic-sri-international.
the class PRAiSEController 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