I think Matthew Hutchinson wrote:
>
> This code works:
> engine.executeCommand("(assert (conventionalAddress (number_prefix
> NIL) (street_number 48) (street_name Marlow) (street_type Street)
> (suburb_name Wembley) (city_name Perth) (state_name WA) (post_code
> 6014) ))");
>
> but the API equivalent does not:
> Fact f = new Fact("conventionalAddress", engine);
> f.setSlotValue("number_prefix", new Value("", RU.STRING) );
> f.setSlotValue("street_number", new Value("48", RU.STRING) );
> f.setSlotValue("street_name", new Value("Marlow", RU.STRING) );
> f.setSlotValue("street_type", new Value("Street", RU.STRING) );
> f.setSlotValue("suburb_name", new Value("Wembley", RU.STRING) );
> f.setSlotValue("city_name", new Value("Perth", RU.STRING) );
> f.setSlotValue("state_name", new Value("WA", RU.STRING) );
> f.setSlotValue("post_code", new Value("6014", RU.STRING) );
> engine.assertFact(f);
These are totally different facts. The contents of every single slot
differ between the two! The symbol NIL is not the same as the String
"", the integer 48 is not the same as the String "48", the symbol
Marlow is not the same as the String "Marlow", etc. For the first
slot, note that Jess's equivalent of Java's "null" is the lower-case
symbol nil.
This code should produce the same fact as your "assert" call:
Fact f = new Fact("conventionalAddress", engine);
f.setSlotValue("number_prefix", new Value("NIL", RU.ATOM );
f.setSlotValue("street_number", new Value(48, RU.INTEGER) );
f.setSlotValue("street_name", new Value("Marlow", RU.ATOM) );
f.setSlotValue("street_type", new Value("Street", RU.ATOM) );
f.setSlotValue("suburb_name", new Value("Wembley", RU.ATOM) );
f.setSlotValue("city_name", new Value("Perth", RU.ATOM) );
f.setSlotValue("state_name", new Value("WA", RU.ATOM) );
f.setSlotValue("post_code", new Value(6014, RU.INTEGER) );
engine.assertFact(f);
---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------