Skip to content

Commit 810bfd5

Browse files
authored
Merge pull request #15 from knowsys/nemo-0.7
Include changes for v0.7
2 parents 5c6c83d + c7a8159 commit 810bfd5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/content/docs/reference/builtins.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ A language-tagged string is a value like `"Hello world"@en`. The function `LANG`
4848
All standard arithmetic operations, including addition (`+`), subtraction (`-`), multiplication (`*`), and division (`/`), are fully supported. Numeric values can also be compared via the operators `<`, `<=`, `=>`, and `>`.
4949

5050
In addition, Nemo provides many useful arithmetic functions. Currently, these include the following functions on single input parameters:
51-
`ABS` (absolute), `SQRT` (square root), `SIN` (sine), `COS` (cosine), `TAN` (tangent), `ROUND` (rounding up or down), `CEIL` (rounding up), `FLOOR` (rounding down). Moreover, the following functions require two parameters:
51+
`ABS` (absolute), `SQRT` (square root), `SIN` (sine), `COS` (cosine), `TAN` (tangent), `ROUND` (rounding up or down), `CEIL` (rounding up), `FLOOR` (rounding down),
52+
and `INVERTSIGN` (multiply by negative one). Moreover, the following functions require two parameters:
5253
- `LOG(x,y)`: computes the logarithm of x to base y
5354
- `POW(x,y)`: computes the power of x to the y.
5455
- `REM(x,y)`: computes the remainder of dividing x by y.
@@ -63,14 +64,18 @@ And finally, the following functions can be called with arbitrary many input par
6364
- `BITOR(x_1, ..., x_n)`: computes the bitwise "or" of the given arguments
6465
- `BITXOR(x_1, ..., x_n)`: computes the bitwise "xor" of the given arguments
6566

67+
It is also possible to mix numeric types, which implicitly converts them to 64-bit floating point numbers. For example, `SUM(3 * 4.0, 5, 1.0)` returns the 64-bit floating point number `18.0`.
68+
69+
### Conversion functions
70+
6671
Nemo supports the following conversion functions:
6772
- `INT`: Convert the given value to an integer. This works for various datatypes (not just numbers), but only for data that already corresponds to an integer. The following all evaluate to `42`: `INT(42)`, `INT(42.0)`, `INT("42")`, `INT("42"^^<http://www.w3.org/2001/XMLSchema#gYear>)`, `INT(ROUND(42.1))`. However, `INT(42.1)` does not return a result.
6873
- `DOUBLE`: Convert a given value to a double. This function works for various datatypes (not just numbers). For example, the following evaluate to `42.0`: `DOUBLE(42)`, `DOUBLE("42.0")`, `DOUBLE("42").`
6974
- `FLOAT`: Convert a given value to a float. This is analogous to `DOUBLE` but for 32bit floating point numbers.
75+
- `IRI`: Convert a string value into an IRI
7076

71-
It is also possible to mix numeric types, which implicitly converts them to 64-bit floating point numbers. For example, `SUM(3 * 4.0, 5, 1.0)` returns the 64-bit floating point number `18.0`.
7277

73-
### Boolean Functions
78+
### Boolean functions
7479

7580
Nemo supports the usual Boolean functions (`AND`, `OR`, and `NOT`), but requires them to be written in prefix-notation like other functions, e.g., `OR(?X,?Y)` rather than `?X OR ?Y`.
7681

@@ -101,7 +106,7 @@ Built-in functions can be nested arbitrarily. For example, the following is a va
101106
result(?s) :- temp(?t), ?s = CONCAT(UCASE("temp: "), STR(?t)) .
102107
```
103108

104-
***Known restriction in version 0.6.0:***
109+
***Known restriction in version 0.7:***
105110
Currently, infix operators are not allowed within nested terms. As a workaround, it is possible to use the prefix-notation for such functions.
106111

107112
| Infix | Name |

0 commit comments

Comments
 (0)