Closed GordianDziwis closed 5 years ago
Update on the issue: This is about a function extension such as
SELECT * {
...
BIND(...complex expression(?a, ?b, ?c) ... AS ?x)
FILTER(fn:stderr(CONCAT("Obtained ", ?x, " from input ", ?a, ?b, ?c))
}
So we should create a filter function that always yields true but as a side effect prints out its argument.
Note: Select queries can already be used for debug output: Their output goes to STDERR - whereas CONSTRUCT queries go to STDOUT - so only the latter produces data output.
It turns out that Jena already has an (undocumented according to [1]) afn:print
function.
It may be useful to create a new issue in order to have a similar function that logs via slf4j; but as this issue was about having the feature at all it can be closed.
[1] https://jena.apache.org/documentation/query/library-function.html
Code from Jena 3.11:
package org.apache.jena.sparql.function.library;
/** Function that prints it's argument to stdout (debugging aid) */
public class print extends FunctionBase1 {
Something like
echo
for debugging queries would be nice.