On 07/11/12 13:44, Scott Streit wrote:
  (?u ie:memberOf ?g)
         <- (?g ie:mandatoryInterestsForGroupInclusion ?i)
            allValue(?i ie:#hasIndivudalInterestOf ?u)

If I wrote an allValue builtIn, this would solve the problem correct.

You can't have an allValue predicate with that signature, what would it mean?

What I mean by this is all forward chaining would take place first, and now
I could backward chain allValue.  All I need to do is write allValue.

This is correct, right?

You could certainly do that bit of the work in code instead of in rules, sure. Though if you end up with just a few simple rules and a lot of special case builtins then the rule engine may not be offering you much value. You might just use code for everything or a sequenced set of SPARQL CONSTRUCT queries (SPARQL sub-queries, coupled with the unbound predicate, can do some closed world tests for you).

If you do choose to go for a builtin then you'll need one that looks more like:

  (?u ie:memberOf ?g)
          <- allValue(?g ie:mandatoryInterestsForGroupInclusion
                         ie:hasIndivudalInterestOf ?u)

Then the predicate allValue(root P Q u) would find all values ?x such that (root P ?x) and then pass if (u Q ?x) is true for all of those ?x.

You would need to decide whether either or both of u and g can be unbound.

Now I looked at noValue and

        return !context.contains(subj, pred, obj);

and this is where I would make the change correct?

You'll need bigger changes than that, see above.

Also, how do I tell Jena of a new built in?

   BuiltinRegistry.theRegistry.register(new MyBuiltin());

Dave

Reply via email to