[Jdrew-all] Question on ooJdrew
Marcel Ball
maball at gmail.com
Wed Nov 16 15:17:24 AST 2005
Hello,
One important consideration when attempting to do negation as failure
is that it only currently works in the top-down engine, so if you are
using the bottom-up engine Naf is not available to you.
If you have an Atom in the body of a query/rule that you want negation
as failure you should simply have to place <Naf></Naf> tags around
that Atom element.
As for the second question there are a set of built-in relations
(information about what ones are implement are on
http://www.jdrew.org/oojdrew/builtins.html) that can also be used - so
if you wanted to have the condition that ?X is greater than ?Y you
would have a condition in the body of your clause that is
greaterThan(?X, ?Y)
One thing to be careful about though is that the values that ?X and ?Y
are bound to must be typed as either "Integer" (for integer
comparison), "Real", or "String" (for lexicographical comparison).
For example in the following rule base:
a(1: Integer).
b(2: Integer).
c(?X, ?Y) :- a(?X), b(?Y), greaterThan(?Y, ?X).
the query c(?X, ?Y) will succeed with ?X being bound to 1: Integer and
?Y being bound to 2:Integer.
If instead you had:
a(1).
b(2).
c(?X, ?Y) :- a(?X), b(?Y), greaterThan(?Y, ?X).
the query c(?X, ?Y) will fail as it doesn't have types for what ?X and
?Y get bound to and thus can't do a comparison.
Marcel
On 11/16/05, Sian Lun Lau <wahlau at gmail.com> wrote:
> Hi all,
>
> i have asked months ago how can i used <Naf> with ooJDrew, and we have
> yet to get things work as it should. David had helped but i think we
> just got stucked and did not moved on.
>
> i tried the examples and looked through some codes, and wonder if i
> have missed out something or perhaps misunderstood things. I would
> appreciate it. if anyone can point out how negation be used with this
> rule engine.
>
> secondly, i was wondering if i can make rules not based on a direct
> fact, but something relational such as more than or less than. Hope it
> would, else perhaps i must try out some other engine/rule language
> then.
>
> thanks a lot.
>
> regards,
> SianLun
> --
> ===================== : : : ---
> normal reply to wahlau at gmail.com
> urgent reply to slau at wahlau.org
> --- : : : ======================
> _______________________________________________
> Jdrew-all mailing list
> Jdrew-all at jdrew.org
> http://mail.jdrew.org/mailman/listinfo/jdrew-all
>
--
Marcel Ball <maball at gmail.com>
-----------------------------------------------
The purpose of writing is to inflate weak ideas,
obscure pure reasoning, and inhibit clarity.
With a little pratice, writing can be an intimidating
and impenetrable fog!
- Calvin
More information about the Jdrew-all
mailing list