[
https://issues.jboss.org/browse/DROOLS-2411?page=com.atlassian.jira.plugi...
]
Matteo Mortari commented on DROOLS-2411:
----------------------------------------
Not a bug.
The first expression:
{code:java}
for m in my input.numbers return ceiling(m)
{code}
is a Qualified name. Hence it would return the attribute "numbers" on the
"my input", which is the list of {{\[0.5, 1.5, 2.5\]}}.
But these other expressions are actually leveraging the property of spec "10.3.2.5
Lists and filters" for
bq. Singleton lists are equal to their single item. Therefore, any function or operator
that expects a list as input but instead receives a non-list semantic domain element e
behaves as if it had received {{\[e\]}} as input.
So the result of the first part:
{code:java}
my input[name="asd"]
{code}
is a List, and in turn the second part
{code:java}
.numbers
{code}
is the spec:
bq. For convenience, a selection using the "." operator with a list of contexts
on its left hand side returns a list of selections
So in turn the result of
{code:java}
my input[name="asd"].numbers
{code}
is
{code:java}
[[0.5, 1.5, 2.5]]
{code}
and correctly so. Please notice it is a list, of a List of numbers.
Hence the other expression make only sense to rewrite then as:
{code:java}
for m in my input[name="asd"].numbers, n in m return ceiling(n)
for m in my input[item.name="asd"].numbers, n in m return ceiling(n)
{code}
For loop using filter in iteration context
------------------------------------------
Key: DROOLS-2411
URL:
https://issues.jboss.org/browse/DROOLS-2411
Project: Drools
Issue Type: Bug
Components: dmn engine
Reporter: Matteo Mortari
Assignee: Matteo Mortari
Attachments: image-2018-03-21-16-48-52-704.png,
image-2018-03-21-16-49-14-236.png, image-2018-03-21-16-49-30-158.png,
image-2018-03-21-16-50-08-712.png
In the following model:
!image-2018-03-21-16-48-52-704.png!
for the following input:
!image-2018-03-21-16-49-14-236.png!
with number being:
!image-2018-03-21-16-49-30-158.png!
The following expression works:
{code:java}
for m in my input.numbers return ceiling(m)
{code}
returning:
!image-2018-03-21-16-50-08-712.png!
But these other expressions fail:
{code:java}
for m in my input[name="asd"].numbers return ceiling(m)
for m in my input[item.name="asd"].numbers return ceiling(m)
{code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)