Ontopia now supports numbers in tolog
Peter-Paul Kruijsen announces support for numbers in tolog:
Over the past years Ontopia was not able to work with numbers. Sorting e.g. a list of occurrence values could result in ‘123’, ’45’, ‘6’, ’78’. For one of our customers, we needed an implementation that would sort these as ‘6’, ’45’, ’78’, ‘123’, as well as an implementation for adding, subtracting, multiplying and diving numbers.
I have just committed NumbersModule to Ontopia [1]. It will be available in the upcoming 5.2.0 release. With this addition, tolog queries can now work with numbers. It supports these predicates:
- value(string, result): Parses a string (e.g. an occurrence value) into a number. Pattern and locale are optional, e.g. to parse ‘€ 5.026,34’ for us Europeans
- format(number, result): Formats a number into a string. Pattern and locale are optional, e.g. to format a number as ‘42.6 %’.
- absolute(result, number): Calculates the absolute value of a number.
- add(result, number, number): Adds numbers. Providing more than 2 input values is allowed.
- subtract(result, number, number): Subtracts numbers. Providing more than 2 input values is allowed.
- multiply(result, number, number): Multiplies numbers. Providing more than 2 input values is allowed.
- divide(result, number, number): Divides numbers. Providing more than 2 input values is allowed.
- min(result, number, number): Calculates the minimum value. Providing more than 2 input values is allowed.
- max(result, number, number): Calculates the maximum value. Providing more than 2 input values is allowed.
….
See the post for full details.
Thanks Peter-Paul!