Error message for generic context tables

123 views
Skip to first unread message

Elisheva Buchsbaum

unread,
Dec 3, 2020, 2:45:12 AM12/3/20
to Kogito development mailing list
Hi, 

In continuation to previous questions i've had here, I have a DMN model that has as an input a general context table (i.e. we haven't specified a structure for it). 
However, when I run it on MVN I get the following message:
2020-12-03 09:31:50,961 ERROR [org.kie.dmn.cor.com.DMNFEELHelper] (executor-thread-131) Error compiling FEEL expression 'if X != null then X.y
else Z.a' for name 'Level' on node 'Level': Unknown variable 'X.y'

But when I test the actual result on swagger - it calculates it without a problem. 

I need the input to be a generic context. Is there a way to avoid this error in the log? I'm worried that when we move this to run on Seldon it will crash because of this error. 

Thanks, 
Elisheva

Matteo Mortari

unread,
Dec 3, 2020, 4:49:42 AM12/3/20
to Kogito development mailing list
Hi Elisheva,

the error on compilation is correct, since this is a bad-practice in DMN: in DMN you are expected to define an ItemDefinition for your InputData nodes, so while building the decision-logic of the several DRG elements the compiler can verify the expressions are valid, statically.

In this case, since the ItemDefinition seems to be missing for 'X', the compiler cannot know for certain that property 'y' exists while accessing it with 'X.y'.
I would expect similarly it would happen for 'Z' if an ItemDefinition is not defined.

That said, you can define your InputData as having the type FEEL:Any.
In this case, this is an indication to the compiler that say the InputData node 'X' as a generic ~"top type", hence the compiler would not emit an error if accessing 'X.a' since it's considered valid as explicitly given the Any type.
However naturally, this may break at run-time as this is in fact just circumventing type checking at compile-time, and iterating on the DMN bad-practice mentioned above.
I tested this locally and seems to me it would work for your sample.

I hope this clarifies and helps!
MM

--
You received this message because you are subscribed to the Google Groups "Kogito development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/f3920818-dd15-4779-86b5-c51093061a95n%40googlegroups.com.

Elisheva Buchsbaum

unread,
Dec 3, 2020, 4:54:41 AM12/3/20
to kogito-de...@googlegroups.com
I'll check it out,thank you! 

You received this message because you are subscribed to a topic in the Google Groups "Kogito development mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kogito-development/DnxDcrKBUmw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/CAHOoiEqTPgVgbVPbbdFZ0eN5pS55zDF5-x-m4rNVzSVNSJm5wA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages