Giter VIP home page Giter VIP logo

Comments (21)

DanielThanner avatar DanielThanner commented on August 22, 2024

Chapter 10.3.1.4 in the spec on page 110: "A singleton list is equal to its single item, i.e., [e] = e for all FEEL expressions e."

from tck.

arthware avatar arthware commented on August 22, 2024

@opatrascoiu @agilepro @etirelli @falko

Any thoughts / opinions / emotions on this?
From my point of view: If DMN/FEEL implementors do not agree on a consistent behavior for this, cross-runtime compatibility is theoretical for DMN. This is a crucial behavior to discuss.
The specification would allow both results - with potentially drastical impact on model behavior.

from tck.

brsilver avatar brsilver commented on August 22, 2024

from tck.

etirelli avatar etirelli commented on August 22, 2024

I agree with @arthware, that unless the semantics for this is clearly defined, it breaks interoperability between products.

Unfortunately I don't think there is a "solution" for this in DMN 1.1, because the "[a] = a" makes the whole semantics completely ambiguous.

There is also, to my knowledge, no proposal yet to fix this for DMN 1.2. So the only solution would be for us to make a proposal of what the semantics should be.

This might actually become worse in DMN 1.2 because there is a proposal to support heterogenous lists in DMN 1.2, while DMN 1.1 if I remember correctly only supports homogeneous lists.

So, I believe we could focus here on a proposal to submit for DMN 1.2, as the discussion of any function in particular would be a moot point. In particular, I believe the solution would be to constrain the "[a] = a" coercion to only the actual places where it would be applicable/safe.

from tck.

arthware avatar arthware commented on August 22, 2024

Some FEEL puzzles:

  • insert before(distinct values(["a", ["a"],[]])[1],1,["a"])
  • count(insert before(distinct values(["a", ["a"],[]]),1,["a"]))
  • count(append(distinct values(["a", [["a"]]]),[["a"],"a"]))

@brsilver
The result type is relevant if results of list functions are nested. Therefore, allowing all 3 results in the first example could end up in different runtime behaviors once invocation results are nested (I believe).

The count([[“a”]])=1 example was wrong in the original post. We meant count([[]])

from tck.

brsilver avatar brsilver commented on August 22, 2024

from tck.

etirelli avatar etirelli commented on August 22, 2024

@arthware yeah, there are plenty of problems like the ones you mentioned. There is no answer in DMN 1.1.

Would you like to try and come up with a proposal for DMN 1.2? I can help get it through the RTF process.

from tck.

DanielThanner avatar DanielThanner commented on August 22, 2024

@brsilver @etirelli

I have created a new ticket at the OMG with a proposal for DMN 1.2. It is not a change of the spec, but a clarification of the expected behavior. If the OMG solution for DMN 1.2 is compatible with 1.1 we can choose this way in DMN TCK, too (unless 1.2 is released).

(http://issues.omg.org/browse/INBOX-556)

from tck.

brsilver avatar brsilver commented on August 22, 2024

from tck.

etirelli avatar etirelli commented on August 22, 2024

@DanielThanner thank you! as soon as the issue pass the triage, we can bring it up on the RTF meeting.

from tck.

DanielThanner avatar DanielThanner commented on August 22, 2024

@brsilver
The specification says for filters: "... and a list containing only items where the filter expression is true is returned.". This means a filter always returns a list. In case only a single element is returned, it is inside a list, a singleton list.

You can use [1] to access the first element. But I don't think that this is necessary, because the spec says that "e = [e] for all FEEL expressions e". Therefore, if you are sure that the filter matches a single element, you will get a singleton list as result. You can pass the result of the filter to any FEEL expression. It doesn't makes a difference if you work with the singleton list [e] or the singleton e itself (some exceptions for built-in functions list contains(), index of() and count()).

from tck.

brsilver avatar brsilver commented on August 22, 2024

from tck.

etirelli avatar etirelli commented on August 22, 2024

@brsilver just to clarify, what I said is that the conversion sometimes is ambiguous, specially when you compose a filter into another filter or as a parameter to a function, very similar to the examples raised by @DanielThanner and @arthware .

For instance:

append( someList, MyTable[id=”abc”].x )

Lets say the filter in the example above returns ["foo"] . Are you appending ["foo"] to someList or are you appending "foo" ?

What if, because of a problem in the MyTable data, the result for x is ["foo","bar"], but someList is a list of Strings. Now it is an invalid list and in the best case raises an error at runtime. Worst case, silently fails.

from tck.

brsilver avatar brsilver commented on August 22, 2024

from tck.

DanielThanner avatar DanielThanner commented on August 22, 2024

For the filter topic there is already a JIRA issue at OMG: http://issues.omg.org/browse/DMN12-115

The text in the spec does not match the FEEL example in the spec.

from tck.

brsilver avatar brsilver commented on August 22, 2024

from tck.

falko avatar falko commented on August 22, 2024

At Camunda we agree with Edson and would like to limit the rule or clearly define when it applies. Ideally, we would like to remove the rule to prevent ambiguities completely. But that is probably not up for debate.

from tck.

DanielThanner avatar DanielThanner commented on August 22, 2024

@etirelli Can you please add example(s) of nested filters that have problems with singleton lists?

from tck.

opatrascoiu avatar opatrascoiu commented on August 22, 2024

Reminder RTF ticket is http://issues.omg.org/browse/DMN12-115

from tck.

etirelli avatar etirelli commented on August 22, 2024

Linking the ticket with the proposal: https://issues.omg.org/browse/DMN12-210

from tck.

agilepro avatar agilepro commented on August 22, 2024

Approved by RTF. Nothing we can do in short term. When this gets implemented, we might run into problems that need addressing. We probably will need a set of tests on this.

from tck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.