If I understand that right,  you're saying that the signature for
builtins would have to change because there would have to be some way to
either pass back a list of possible bindings or maybe pass back one
binding and an indication that there might be more,  right?

A specific multi-binding case I have thought of is a function like
"lcfirst" in PHP which lowercases the first character in a string.  If
you write

lcfirst(A,"night")

there are two solutions for A,  "night" and "Night" and it would be
reasonable to search backwards.  On the other hand,  if you are
lowercasing everything

lc(A,"night")

then you have 32 solutions when the right parameter has no uppercase
letters,  generally 2^N solutions where N is the number of  lowercase
letters.  It is more reasonable to do the search in the other direction
(look up all A and see if they match) although the perfect system would
probably search A over a small set of prefixes and then filter.

Even add() might have problems because of numeric coercion (there might
be more than one type which fits.)

Would the ability to return binding sets affect both the forward and
backwards modes?

-- 
  Paul Houle
  paul.ho...@ontology2.com

On Thu, Jul 14, 2016, at 03:57 AM, Dave Reynolds wrote:
>   13/07/16 18:24, Paul Houle wrote:
> > In the following docs:
> >
> > https://jena.apache.org/documentation/inference/
> >
> > The arithmetic builtins are described as such:
> >
> > "Note that these do not run backwards, if in sum a and c are bound and b
> > is unbound then the test will fail rather than bind b to (c-a). This
> > could be fixed."
> >
> > This is repeated in the source code for said functions.
> >
> > https://github.com/apache/jena/blob/master/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/builtins/Sum.java
> >
> > in that case at line 78.
> >
> > My question is:  is the only reason this does not work because the
> > Builtin doesn't handle it,  or because the engine wouldn't be able to
> > work correctly if the Builtin was fixed?
> 
> If I remember correctly the engine requires a deterministic answer from 
> the builtin - it doesn't support builtins that expand the search space 
> (doesn't support return of a set of legal answers). So specific cases 
> where there's only one unbound to an arithmetic builtin and only one 
> result to bind could be supported. However, in general once you allow 
> arithmetic expressions to run backwards you are getting into equational 
> constraint solve territory.
> 
> Dave

Reply via email to