GEGlobalResearch / DARPA-ASKE-TA1

ANSWER Project to demonstrate knowledge-driven extraction of scientific models from code and texts
Other
8 stars 5 forks source link

preference not getting set as expected in UI test #75

Closed crapo closed 4 years ago

crapo commented 4 years ago

@kittaakos , I'm working on more JUnit tests and have hit a show-stopper. In the dialog.ui tests project, there is a JUnit test file P2UITests.xtend with a single test case. The preference TYPE_CHECKING_WARNING_ONLY is set to true in the beginning of this test. This setting is essential to be able to load Turbo.sadl (call to reusableTurbo). But when Turbo.sadl is validated the preference is false rather than true so there are errors. I put calls inside reusableTurbo also, but that did not change the behavior. What's wrong with the preference setting?

kittaakos commented 4 years ago

@crapo, which SADL and Dialog branches should I use?

crapo commented 4 years ago

I'm on sadlos2 MissingPatterns and dialog master. I haven't tried to build development again. Once I can and all tests pass I can merge.

kittaakos commented 4 years ago

PR: https://github.com/GEGlobalResearch/DARPA-ASKE-TA1/pull/76

crapo commented 4 years ago

I would think that the setting of preferences in the beginning of the test would suffice and the setting in the individual sadl file processing (e.g., turbo) wouldn't be needed. Hence I moved the 3rd preference setting added at line 151 to the test (line 49) and commented out the preference settings in reusableTurbo. When I got the processing of the dialog preference P_USE_ARTICLES_IN_VALIDATION as retrieved by call to JenaBasedSadlModelProcessor isUseArticlesInValidation was true, not false as expected. I have a fix to that it doesn't need to be false, but that will mask what still appears to me to be an issue.

crapo commented 4 years ago

There is one other issue, which could be separate but is seen in this same test case so I'll put it here for the moment. The pre-validation of the sadl imports, e.g., the call to reusableTurbo, cause validation of the sadl model and I would expect put a copy of the generated OntModel into the OntModelProvider referenced by Resource. However, when the JenaBasedDialogModelProcessor gets to processModelImports, it re-validates the sadl models because it doesn't find the Resource in the OntModelProvider. This causes the test to run much slower than I might have expected... Why is this?

kittaakos commented 4 years ago

Hence I moved the 3rd preference setting added at line 151 to the test (line 49)

Please share your broken test case on a branch or the master, so I can look into it.

crapo commented 4 years ago

I've pushed to Dialog master, also pushed my latest after PR merge to sadlos2 MissingPatterns.

kittaakos commented 4 years ago

I've pushed to Dialog master, also pushed my latest after PR merge to sadlos2 MissingPatterns.

Thanks, I have pulled from both repositories.

I would think that the setting of preferences in the beginning of the test would suffice and the setting in the individual sadl file processing (e.g., turbo) wouldn't be needed. Hence I moved the 3rd preference setting added at line 151 to the test (line 49) and commented out the preference settings in reusableTurbo.

This is a correct assumption. It should work like this.

When I got the processing of the dialog preference P_USE_ARTICLES_IN_VALIDATION as retrieved by call to JenaBasedSadlModelProcessor isUseArticlesInValidation was true, not false as expected

I could not reproduce it. I do not know if it is mandatory or not, but I always have to do mvn install in SADL. Otherwise, the Dialog project does not see my SADL changes. Did you do that too?

I made this tiny modification:

diff --git a/sadl3/com.ge.research.sadl.parent/com.ge.research.sadl.jena/src/com/ge/research/sadl/jena/JenaBasedSadlModelProcessor.java b/sadl3/com.ge.research.sadl.parent/com.ge.research.sadl.jena/src/com/ge/research/sadl/jena/JenaBasedSadlModelProcessor.java
index 022fee6e..32059793 100644
--- a/sadl3/com.ge.research.sadl.parent/com.ge.research.sadl.jena/src/com/ge/research/sadl/jena/JenaBasedSadlModelProcessor.java
+++ b/sadl3/com.ge.research.sadl.parent/com.ge.research.sadl.jena/src/com/ge/research/sadl/jena/JenaBasedSadlModelProcessor.java
@@ -1245,6 +1245,7 @@ public class JenaBasedSadlModelProcessor extends SadlModelProcessor implements I

                setUseArticlesInValidation(false);
                String useArticles = context.getPreferenceValues().getPreference(SadlPreferences.P_USE_ARTICLES_IN_VALIDATION);
+               System.out.println(getCurrentResource().getURI().toString() + ": P_USE_ARTICLES_IN_VALIDATION => " + useArticles);
                if (useArticles != null) {
                        setUseArticlesInValidation(Boolean.parseBoolean(useArticles));
                }

And all the logged values are false:

platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Dummy.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Dummy.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Dummy.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/MetaModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/MetaModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/DBN.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/DBN.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/TableAndEquation.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/DBN.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/TableAndEquation.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Turbo.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/TableAndEquation.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/DBN.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Turbo.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/MetaModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/DBN.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/TableAndEquation.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Turbo.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/test4.dialog: P_USE_ARTICLES_IN_VALIDATION => false
Query answering disabled as no Computational Graph is selected in preferences.
"Failed to find results"
Query answering disabled as no Computational Graph is selected in preferences.
"Failed to find results"
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/MetaModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/DBN.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/TableAndEquation.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/TableAndEquation.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Turbo.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Turbo.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/test4.dialog: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/DBN.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ExtractedModels/CodeExtractionModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/MetaModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/test4.dialog: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlImplicitModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ImplicitModel/SadlBuiltinFunctions.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ScienceKnowledge.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Hypersonics_v2.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/TableAndEquation.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/Turbo.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/CompGraphModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/DBN.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/ExtractedModels/CodeExtractionModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/MetaModel.sadl: P_USE_ARTICLES_IN_VALIDATION => false
platform:/resource/P2UITests_test/test4.dialog: P_USE_ARTICLES_IN_VALIDATION => false

I could not reproduce the defect you have mentioned. I have two validation errors, and they do not seem to be related to the preferences:

[ERROR:Did not find crule variable for type 'hypersonicsV2:CF6', definite article, ordinal 1 (platform:/resource/P2UITests_test/test4.dialog line : 9 column : 50), ERROR:Did not find crule variable for type 'hypersonicsV2:CF6', definite article, ordinal 1 (platform:/resource/P2UITests_test/test4.dialog line : 9 column : 89)]
crapo commented 4 years ago

The error you list (Did not find crule variable...) only occurs because isUseArticlesInValidation returns true when it should return false per the setting.

crapo commented 4 years ago

I'm re-running to provide better information.

crapo commented 4 years ago

Ah, just saw your comment about the mvn install in sadl. Will do.

crapo commented 4 years ago

I've done a mvn install on sadlos2, refreshed my eclipse projects, run the P2UITests test case with breakpt in isUseArticlesInValidation. It stops there while processing the dialog content and the value of useArticlesInValidation is true.

crapo commented 4 years ago

Override of preference in JBDMP was responsible for the behavior.

crapo commented 4 years ago

Well, still not getting preference as expected. @kittaakos , can we have a tcon to show/discuss? This is serious blockage.

kittaakos commented 4 years ago

Well, still not getting preference as expected. @kittaakos , can we have a tcon to show/discuss? This is serious blockage.

Sure, please send the Skype link and I'll join in a few minutes.

crapo commented 4 years ago

this was due to an explicit setting of the preference in code that was meant to be temporary but was left in. Now works as expected.