-
Notifications
You must be signed in to change notification settings - Fork 40
DMN 15b - no-name imports #674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hi @StrayAlien |
HI @gitgabrio .. hmm, that could have something to do with the test runner - whichever one it is you're using (Java?). I don't use the Java one. My understanding was that the Java test runner would run each test xml in a folder and use the 'modelName' referenced in the xml as the root model for tests. That root model may import other models in the same folder. I've just checked the TCK and, how about that, this PR has the first test folder to contain more than one xml test file. It has sometimes been spoken about to write tests like this, but, perhaps the Java test runner is not respecting multiple test files in a folder. |
Hi @StrayAlien
I'm not sure if there is a "rule" for that |
@gitgabrio ACK |
@saig0 FYI as we just talked about imports yesterday. |
I would say if the format of the filename is different than elsewhere, it should be aligned as it may cause problems for the runners. |
I can change the test files name. Though, that seems a pretty odd restriction. It could be changed to something like "\d+" and be more flexible and backwards compatible .... |
@StrayAlien |
@gitgabrio - test names have been changed. |
@gitgabrio It seems the tests are still not consumed by Java-based engines, at least in my local. |
Any more information that that? I don't use Java for DMN - fancy debugging it? |
I just tried the drools runner on TCK master - I assume that is the one your using (?). I get 121 errors. I see the import tests are failing. I can run the validation profile locally and it works. Here are some sample drools runner errors:
As an FYI, I think the way others may have done the imports functionality with a test runner is kind of like this:
That's it I think. I can see the Java DmnTckRunner class does collect all dmn files in the same folder as the test suite and passes them to the the "beforeTestCases" function of the vendor runner impl. The drools runner takes those and adds them as extra resources to the drools DMN runtime .... Given that it seems to fail on master ... perhaps a drools crew member could could check it out? |
I guess the problem is that the common runner, that all the runners can extend, uses this pattern to match files. tck/runners/dmn-tck-runner/src/main/java/org/omg/dmn/tck/runner/junit4/DmnTckSuite.java Line 75 in 7c85cec
So either you doublecheck, that test xml files in this PR satisfy this pattern, please, or I could change that filter, if we all agree, to just take all xml files from a test folder. What do you think please? @dmn-tck/contributors |
Hi @baldimir - just pushed another bounce at renaming things. Hopefully that works now. |
@StrayAlien Thank you for the test. I believe there is an issue with the Here is an example of an incorrect href https://github.com/StrayAlien/tck/blob/c7a65b8af372cb92cd37a4688d4ad5d0a67fae37/TestCases/compliance-level-3/1158-noname-imports/1158-noname-imports-01-A.dmn#L16 |
@opatrascoiu
"nonamed import" should have the same namespace as the importing model itself, and then I have the impression the "namespace" will be redundant (since it is the same of the importing model). All the above, in my opinion, overrule the 12.3.2 References within the DMN XSD you pointed at. Please correct me if I'm misunderstanding your observation or missing something else of the context |
@gitgabrio I disagree. The paragraph that you mentioned does not say explicitly that the syntactic structure of the hrefs should change. It defines the operational semantics of the imports when no prefix is needed in the feel expressions. The section that I mentioned is about the syntax of the hrefs. |
@opatrascoiu
So, I think that in this case it should be better to apply a consistent interpretation, since spec - as whole - sometime are not very well described or "coherent" |
DMN borrowed the reference mechanism via HREFs from XML. They refer to the physical location (the file that contains the definition) of the referred element, not the namespace. The physical location (in a file) and adding the definition via import in the current DMN context are two different things to me.
|
@StrayAlien I think we need to populate the namespace attributes from the TCK schema to avoid name ambiguities and make tests more readable (e.g. there are two inputDatas with the same name , but only one is imported and populated). Here is an example of what I have in mind: Change test
The semantics of these attributes is as follows: If a node (inputNode or resultNode) has a namespace, theappheron this one is used to find the corresponding DRG element, otherwise the namespace at the testCases level (the namespace of the model under test / root model). testCase has a namespace as well if we want to mix tests for models in the same test files. I personally think we should avoid mixing tests for several models in the same test file. |
Hi @opatrascoiu / @gitgabrio . Thanks for the comments. Very interesting. It's great there is some discussion on these. Having those imported hrefs as 'local' is intentional. According to the spec:
IMO, they become available under the default namespace of the imported model. In a sense, the existence of the import namespace is 'erased'. That also means the those imported inputs are available in the default namespace. I feel the intention here is really the equivalent of an old-fashioned "include" - such that the imported model becomes 'included' or 'copied into' in the importing model - in that sense, the "physical location" actually becomes the same as the importing model. That's my take on it. If it is not the case, then I'm not too sure what " imported in the default namespace of the model" might mean in practice. If I were calling this model via an API I would not expect to have to qualify that input data name with a namespace - because, it has become 'part' of the importing model. So, that TCK test passing an imported input as if it was part of the importing model is intentional and there to assert same. EDIT: I think the namespace qualification that you mention is applicable to named imports for sure. |
Regarding the paragraph mentioned here #674 (comment) The HREFs contain the physical location (e.g. file that contains the definition) not the namespace of the model described in that file. These are different things. DMN 1.5. states the physical location should always be present if the DRG element is not described in the same file. |
@opatrascoiu
But with that:
it seems you were talking of physical location. But that "References within the DMN XSD" paragraph has not been modified since 1.4, and the need of physical path seems to derive from
that was true then, but not with no-named import. As @StrayAlien mentioned, it seems
If you think there is a real need, beside the specs that maybe are simply outdated, could you please explain ? Thanks References https://datatracker.ietf.org/doc/html/rfc3986
|
@gitgabrio I checked all the DMN files in the master of the TCK project. The only ones that use the namespace instead of location (see 12.3.2 References within the DMN XSD) are the ones in 0086-import and the DMN files in this PR. All the other test cases have only one DMN model hence the HREFs don't contain a location. Also, the testCases contain a property called We need to discuss in the next meeting how are we going to move forward on the references, both in DMN files and TCK files (references of DRG elements and inputNode and resultNode). |
This spec change was driven by Trisotech? Perhaps @SimonRinguette could chime in? |
Just to add some context here. A while back @StrayAlien added a test where the namespace is always specified in href, including the DRG elements defined in the same file. This use case was addressed in DMN 1.6 https://issues.omg.org/browse/DMN16-64: the namespace for hrefs to DRG elements defined in the same DMN is optional, is not an error to have it. |
Based on the discussion on the meeting:
|
Similar FEEL context: 10.3.2.11 Scope and context stack. |
I believe that the ambiguity in this thread is caused by
Following our discussion in the meeting, I believe this means
|
I think we all agree on ambiguity of explanation, but any attempt to disambiguate it, seems to me just a matter of personal opinion. |
@gitgabrio I think the above proposal should solve the ambiguity: I believe that confusion was created by the following paragraph in 6.3.3 Import metamodel:
As @SimonRinguette, the author of the change in DMN, mentioned in the meeting:
IMO there is no ambiguity in 12.3.2 References within the DMN XSD. The proposed solution addresses the issue for 2 (execution of expressions in a certain context) and does not give the impression that the DMN / XML namespaces are mutable. @gitgabrio Is there any other aspect of the operational semantics, apart from referencing and defining the context for the execution of the logic associated to the DRG elements, that is still ambiguous in your view? @SimonRinguette Please let me know if the above summarizes your views accurately. |
@opatrascoiu
|
@StrayAlien I looked at tests 1158-noname-imports-test-14.xml and 1158-noname-imports-test-15.xml. I like the intention behind them! However, I disagree with the expected result. IMO it should be:
and
I think that according to sections Once we address the issue with the hrefs in the DNN files and #686 we are good to merge :) |
We need to review based on the latest agreement from RTF. Based on the discussion in RTF, the href reference contains namespace, not location. It may be possible the namespace is missing in some test cases in the hrefs. This needs to be worked on. |
Hold onto your hats. Tests for the new "no-name" import feature of DMN 1.5b.
Import tests can be very confusing, so, I have broken these up into lots of small models with an associated test suite comprising of (generally) just one assertion.
Here is the new spec text:
Some things to note:
Each test suite has some small notes in it describing the model structure and expectations.
Comments welcome.