How to get the largest value less than a specified value from a list of integers #776
-
I am trying to work with lists and while I can take the max of a list of integers, I need to get the max of the list of integers where the integers are less than a specified value. I have been unable to do this, any ideas / suggestions. Here is a simple project of what I have. uri "http://sadl.org/TestList.sadl". TestClass is a class // For instance m1, the prop1 values are [3, 5, 8, 10]. // Trying to do it without using list, but again no able to do so m1 is a TestClass, Ask: "select * where {?x ?y ?z} limit 1". |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@AbhaMoitra , I think that you must either separate the comparison operation from the list operation or else create a custom built-in function that combines the two. Following the former approach, consider this model:
When executed, the following is output to the console window:
I'm concerned that the print function outputs are repeated with incomplete lists of values, but then there is only one value assigned for maxLessThanThreshold, so that leaves me a little confused. The 3rd line of R2 is meant to tell the Rete Engine that R1 should be fired to completion before R2 is fired, which appears to be happening per the final outcome but placed in question by the print function output. |
Beta Was this translation helpful? Give feedback.
@AbhaMoitra , I think that you must either separate the comparison operation from the list operation or else create a custom built-in function that combines the two. Following the former approach, consider this model: