From 202fd56cb71c070243eda3947df9901ae5d7e940 Mon Sep 17 00:00:00 2001 From: awcrapo Date: Tue, 22 Oct 2019 14:44:34 -0400 Subject: [PATCH] added DBN INPUT JSON GENERATION service to preferences --- .../darpa/aske/ui/answer/DialogAnswerProvider.java | 4 ++++ .../ui/answer/imports/JavaImportOperation.java | 4 ++++ .../ui/preferences/DialogRootPreferencePage.java | 5 +++++ .../darpa/aske/preferences/DialogPreferences.java | 4 +++- .../processing/JenaBasedDialogModelProcessor.java | 14 ++++++++++++++ 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/answer/DialogAnswerProvider.java b/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/answer/DialogAnswerProvider.java index 1268f701..3892bdc2 100644 --- a/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/answer/DialogAnswerProvider.java +++ b/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/answer/DialogAnswerProvider.java @@ -740,6 +740,10 @@ public Map getPreferences(URI uri) { if (dbncgsburl != null) { map.put(DialogPreferences.ANSWER_DBN_CG_SERVICE_BASE_URI.getId(), dbncgsburl); } + String dbnjsongensburl = preferenceValues.getPreference(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI); + if (dbnjsongensburl != null) { + map.put(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI.getId(), dbnjsongensburl); + } String usedbn = preferenceValues.getPreference(DialogPreferences.USE_DBN_CG_SERVICE); if (usedbn != null) { map.put(DialogPreferences.USE_DBN_CG_SERVICE.getId(), usedbn); diff --git a/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/answer/imports/JavaImportOperation.java b/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/answer/imports/JavaImportOperation.java index b1854411..602a6e1a 100644 --- a/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/answer/imports/JavaImportOperation.java +++ b/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/answer/imports/JavaImportOperation.java @@ -1322,6 +1322,10 @@ protected Map getPreferences(URI uri) { if (dbncgsburl != null) { map.put(DialogPreferences.ANSWER_DBN_CG_SERVICE_BASE_URI.getId(), dbncgsburl); } + String dbnjsongensburl = preferenceValues.getPreference(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI); + if (dbnjsongensburl != null) { + map.put(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI.getId(), dbnjsongensburl); + } String usedbn = preferenceValues.getPreference(DialogPreferences.USE_DBN_CG_SERVICE); if (usedbn != null) { map.put(DialogPreferences.USE_DBN_CG_SERVICE.getId(), usedbn); diff --git a/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/preferences/DialogRootPreferencePage.java b/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/preferences/DialogRootPreferencePage.java index 5f32303a..11ffd5f9 100644 --- a/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/preferences/DialogRootPreferencePage.java +++ b/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog.ui/src/com/ge/research/sadl/darpa/aske/ui/preferences/DialogRootPreferencePage.java @@ -143,6 +143,7 @@ protected void createFieldEditors() { Composite computationalGraphSettings = createSettingsGroup(generalSettings, SWT.NONE, "Computational Graph Settings"); addField(new BooleanFieldEditorExt(DialogPreferences.USE_DBN_CG_SERVICE.getId(), "Use DBN", computationalGraphSettings)); addField(new StringFieldEditorExt(DialogPreferences.ANSWER_DBN_CG_SERVICE_BASE_URI.getId(), "DBN Service Host and Port:", computationalGraphSettings)); + addField(new StringFieldEditorExt(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI.getId(), "DBN Json Generation Service Host and Port:", computationalGraphSettings)); addField(new BooleanFieldEditorExt(DialogPreferences.USE_ANSWER_KCHAIN_CG_SERVICE.getId(), "Use K-CHAIN", computationalGraphSettings)); addField(new StringFieldEditorExt(DialogPreferences.ANSWER_KCHAIN_CG_SERVICE_BASE_URI.getId(), "K-CHAIN Service Host and Port:", computationalGraphSettings)); // addField(new StringFieldEditorExt(DialogPreferences.ANSWER_CODE_EXTRACTION_KBASE_ROOT.getId(), "Code Extraction KBase Root:", generalSettings)); @@ -160,6 +161,10 @@ private void initializeDefaultPreferences() { //General Settings store.setDefault(DialogPreferences.ANSWER_TEXT_SERVICE_BASE_URI.getId(), DialogPreferences.ANSWER_TEXT_SERVICE_BASE_URI.getDefaultValue()); store.setDefault(DialogPreferences.ANSWER_KCHAIN_CG_SERVICE_BASE_URI.getId(), DialogPreferences.ANSWER_KCHAIN_CG_SERVICE_BASE_URI.getDefaultValue()); + store.setDefault(DialogPreferences.USE_ANSWER_KCHAIN_CG_SERVICE.getId(), DialogPreferences.USE_ANSWER_KCHAIN_CG_SERVICE.getDefaultValue()); + store.setDefault(DialogPreferences.ANSWER_DBN_CG_SERVICE_BASE_URI.getId(), DialogPreferences.ANSWER_DBN_CG_SERVICE_BASE_URI.getDefaultValue()); + store.setDefault(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI.getId(), DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI.getDefaultValue()); + store.setDefault(DialogPreferences.USE_DBN_CG_SERVICE.getId(), DialogPreferences.USE_DBN_CG_SERVICE.getDefaultValue()); store.setDefault(DialogPreferences.ANSWER_JAVA_TO_PYTHON_SERVICE_BASE_URI.getId(), DialogPreferences.ANSWER_JAVA_TO_PYTHON_SERVICE_BASE_URI.getDefaultValue()); store.setDefault(DialogPreferences.ANSWER_CODE_EXTRACTION_KBASE_ROOT.getId(), DialogPreferences.ANSWER_CODE_EXTRACTION_KBASE_ROOT.getDefaultValue()); setPreferenceStore(store); diff --git a/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog/src/com/ge/research/sadl/darpa/aske/preferences/DialogPreferences.java b/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog/src/com/ge/research/sadl/darpa/aske/preferences/DialogPreferences.java index 226177c0..6dec1b3a 100644 --- a/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog/src/com/ge/research/sadl/darpa/aske/preferences/DialogPreferences.java +++ b/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog/src/com/ge/research/sadl/darpa/aske/preferences/DialogPreferences.java @@ -48,7 +48,8 @@ public class DialogPreferences { public static final PreferenceKey USE_ANSWER_KCHAIN_CG_SERVICE = new PreferenceKey("useKChainCgService", String.valueOf(false)); public static final PreferenceKey ANSWER_KCHAIN_CG_SERVICE_BASE_URI = new PreferenceKey("kChainCgServiceBaseUri", "http://localhost:12345"); public static final PreferenceKey USE_DBN_CG_SERVICE = new PreferenceKey("useDbnCgService", String.valueOf(true)); - public static final PreferenceKey ANSWER_DBN_CG_SERVICE_BASE_URI = new PreferenceKey("dbnCgServiceBaseUri", "http://localhost:46000"); + public static final PreferenceKey ANSWER_DBN_CG_SERVICE_BASE_URI = new PreferenceKey("dbnCgServiceBaseUri", "http://localhost:5000"); + public static final PreferenceKey DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI = new PreferenceKey("DbnInputJsonGenerationServiceBaseUri", "http://localhost:46000"); public static final PreferenceKey ANSWER_CODE_EXTRACTION_KBASE_ROOT = new PreferenceKey("codeExtractionKbaseRoot", "resources/CodeModel"); private static final PreferenceKey[] allKeys = { @@ -58,6 +59,7 @@ public class DialogPreferences { ANSWER_KCHAIN_CG_SERVICE_BASE_URI, USE_DBN_CG_SERVICE, ANSWER_DBN_CG_SERVICE_BASE_URI, + DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI, ANSWER_CODE_EXTRACTION_KBASE_ROOT }; diff --git a/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog/src/com/ge/research/sadl/darpa/aske/processing/JenaBasedDialogModelProcessor.java b/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog/src/com/ge/research/sadl/darpa/aske/processing/JenaBasedDialogModelProcessor.java index 992e2323..d5ee036f 100644 --- a/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog/src/com/ge/research/sadl/darpa/aske/processing/JenaBasedDialogModelProcessor.java +++ b/com.ge.research.sadl.darpa.aske.dialog.parent/com.ge.research.sadl.darpa.aske.dialog/src/com/ge/research/sadl/darpa/aske/processing/JenaBasedDialogModelProcessor.java @@ -154,6 +154,7 @@ public class JenaBasedDialogModelProcessor extends JenaBasedSadlModelProcessor { private String textServiceUrl = null; private String dbnCgServiceUrl = null; + private String dbninputjsongenerationserviceurl = null; private boolean useDbn = true; private String kchainCgServiceUrl = null; private boolean useKchain = false; @@ -1367,6 +1368,10 @@ public void initializePreferences(ProcessorContext context) { if (dbncgserviceurl != null) { setDbnCgServiceUrl(dbncgserviceurl); } + String dbninputjsongenerationserviceurl = context.getPreferenceValues().getPreference(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI); + if (dbninputjsongenerationserviceurl != null) { + setDbnInputJsonGenerationServiceUrl(dbninputjsongenerationserviceurl); + } String kchaincgserviceurl = context.getPreferenceValues().getPreference(DialogPreferences.ANSWER_KCHAIN_CG_SERVICE_BASE_URI); if (kchaincgserviceurl != null) { setKchainCgServiceUrl(kchaincgserviceurl); @@ -1395,6 +1400,15 @@ private void setDbnCgServiceUrl(String cgServiceUrl) { this.dbnCgServiceUrl = cgServiceUrl; } + private void setDbnInputJsonGenerationServiceUrl(String dbninputjsongenerationserviceurl) { + this.dbninputjsongenerationserviceurl = dbninputjsongenerationserviceurl; + + } + + public String getDbnInputJsonGenerationServiceUrl() { + return dbninputjsongenerationserviceurl; + } + public String getKchainCgServiceUrl() { return kchainCgServiceUrl; }