On 14/03/14 13:53, Richard Morgan wrote:
Hi,
I would like to extend the base regex function in Jena to provide more than
one match result.
I don't think that's possible.
For instance I would like the following rule
[ myregex("the cat sat on the mat", \"(.at)\", ?token)
" -> (<http://a> <http://b> ?token)]";
to return
- [http://a, http://b, "cat"]
- [http://a, http://b, "sat"]
- [http://a, http://b, "mat"]
From looking at how BindingEnvironment works I can only return with a
single binding per variable.
Correct.
In Jena rules then builtins are only used as essentially filters on rule
firings, they aren't generators.
In the forward rule case (which is suggested by your notation above)
that wouldn't make sense anyway - forward rules either fire or they
don't, there's no backtracking.
In the backward rule case then there is backtracking but the interface
for builtins doesn't support their use as generators.
Dave