
query.function.rq Maven / Gradle / Ivy
#
# Extension functions defined in the query
#
select
(st:fib(10) as ?fib)
(st:fac(10) as ?fac)
(st:date() as ?date)
where {}
function st:fib(?n) {
if (?n <= 2, 1, st:fib(?n - 1) + st:fib(?n - 2))
}
function st:fac(?n) {
if (?n = 0, 1, ?n * st:fac(?n - 1))
}
function st:date() {
let (?d = now()){
concat(day(?d), "/", month(?d), "/", year(?d))
}
}