Question about all-facts-of..

View: New views
3 Messages — Rating Filter:   Alert me  

Question about all-facts-of..

by srini_ottawa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

If I have

(defconcept person (?x))
(defrelation alive (?x))

(defconcept live-person (?x person)
  :<=> (alive ?x)
  )
(defrelation spouse ((?x person) (?y person))
  :axioms (symmetric spouse))

(defrelation married ((?x person) (?y person))
    :<=> (and (spouse ?x ?y) (live-person ?x) (live-person ?y) ))

(assert (spouse jack jill))
(assert (and (alive jack) (alive jill)))

Now I do the following queries:

STELLA>  (all-facts-of jack)
(|P|(SPOUSE JACK JILL) |P|(ALIVE JACK) |P|(PERSON JACK) |P?|(LIVE-PERSON JACK))

STELLA>  (retrieve all (married ?x ?y))
There are 2 solutions:
  #1: ?X=JACK, ?Y=JILL
  #2: ?X=JILL, ?Y=JACK

STELLA>  (all-facts-of jack)
(|P|(SPOUSE JACK JILL) |P|(ALIVE JACK) |P|(PERSON JACK) |P?|(LIVE-PERSON JACK)) ;; no (married jack jill)

Should I not see married jack jill on the last query? I expect it to be cached as a fact after the query. How can I have access to such dynamic attributes of jack in all-facts-of. I tried  :elaborate? TRUE as an argument of all-facts-of, to no avail.

Also are
Function: all-facts-of-instance ((self OBJECT) (includeunknownfacts? BOOLEAN) (elaborate? BOOLEAN)) : (LIST OF PROPOSITION)
Return a list of all definite (TRUE or FALSE) propositions attached to self.

N-Command: all-facts-of-n ((n INTEGER) &rest (instanceRefs NAME)) : (CONS OF PROPOSITION)
available (as documented in the misc section). I get an error when trying to use them.

Thanks
Srini


_______________________________________________
powerloom-forum mailing list
powerloom-forum@...
http://mailman.isi.edu/mailman/listinfo/powerloom-forum

Re: Question about all-facts-of..

by Thomas Russ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ALL-FACTS-OF only reports asserted (and forward-chained) information,  
not cached information from running the query engine.



N-Command: all-facts-of ((instanceRef NAME)) : (CONS OF PROPOSITION)

Return a cons list of all definite (TRUE or FALSE) propositions that  
reference the instance instanceRef. This includes propositions  
asserted to be true by default, but it does not include propositions  
that are found to be TRUE only by running the query engine. Facts  
inferred to be TRUE by the forward chainer will be included. Hence,  
the returned list of facts may be longer in a context where the  
forward chainer has been run then in one where it has not (see run-
forward-rules).


On Aug 27, 2008, at 8:57 AM, Srini Ram wrote:

> Hi,
>
> If I have
>
> (defconcept person (?x))
> (defrelation alive (?x))
>
> (defconcept live-person (?x person)
>   :<=> (alive ?x)
>   )
> (defrelation spouse ((?x person) (?y person))
>   :axioms (symmetric spouse))
>
> (defrelation married ((?x person) (?y person))
>     :<=> (and (spouse ?x ?y) (live-person ?x) (live-person ?y) ))
>
> (assert (spouse jack jill))
> (assert (and (alive jack) (alive jill)))
>
> Now I do the following queries:
>
> STELLA>  (all-facts-of jack)
> (|P|(SPOUSE JACK JILL) |P|(ALIVE JACK) |P|(PERSON JACK) |P?|(LIVE-
> PERSON JACK))
>
> STELLA>  (retrieve all (married ?x ?y))
> There are 2 solutions:
>   #1: ?X=JACK, ?Y=JILL
>   #2: ?X=JILL, ?Y=JACK
>
> STELLA>  (all-facts-of jack)
> (|P|(SPOUSE JACK JILL) |P|(ALIVE JACK) |P|(PERSON JACK) |P?|(LIVE-
> PERSON JACK)) ;; no (married jack jill)
>
> Should I not see married jack jill on the last query? I expect it to  
> be cached as a fact after the query. How can I have access to such  
> dynamic attributes of jack in all-facts-of. I tried  :elaborate?  
> TRUE as an argument of all-facts-of, to no avail.
>
> Also are
> Function: all-facts-of-instance ((self OBJECT) (includeunknownfacts?  
> BOOLEAN) (elaborate? BOOLEAN)) : (LIST OF PROPOSITION) Return a list  
> of all definite (TRUE or FALSE) propositions attached to self.
> N-Command: all-facts-of-n ((n INTEGER) &rest (instanceRefs NAME)) :  
> (CONS OF PROPOSITION) available (as documented in the misc section).  
> I get an error when trying to use them.
>
> Thanks
> Srini
>
> _______________________________________________
> powerloom-forum mailing list
> powerloom-forum@...
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum

_______________________________________________
powerloom-forum mailing list
powerloom-forum@...
http://mailman.isi.edu/mailman/listinfo/powerloom-forum

Re: Question about all-facts-of..

by Thomas Russ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oops.  Initially missed the second part of the question.

On Aug 27, 2008, at 8:57 AM, Srini Ram wrote:

>
>
> Also are
> Function: all-facts-of-instance ((self OBJECT) (includeunknownfacts?  
> BOOLEAN) (elaborate? BOOLEAN)) : (LIST OF PROPOSITION) Return a list  
> of all definite (TRUE or FALSE) propositions attached to self.
> N-Command: all-facts-of-n ((n INTEGER) &rest (instanceRefs NAME)) :  
> (CONS OF PROPOSITION) available (as documented in the misc section).  
> I get an error when trying to use them.

They work for me.

ALL-FACTS-OF-INSTANCE:

Note that this is a function, and so requires the actual objects to be  
passed.  You will not be able to invoke it from the standard PowerLoom  
prompt.  It needs to be called from code.  (Of course, in Lisp, you  
can call it directly, but you have to pass arguments of the proper  
types:

   * (all-facts-of-instance (pli:get-object "BILL" null null) cl:nil  
cl:nil)
   |l|(|P|(PERSON BILL) |P|(FRIEND BILL BOB))

Note that the return type is a Stella LIST object.


ALL-FACTS-OF-N:

This is a command and so is useable from the standard PowerLoom prompt  
as well as being available as a Lisp form in the top-level REPL.

   * (all-facts-of-n 0 bill)
   (|P|(PERSON BILL) |P|(FRIEND BILL BOB))

   * (all-facts-of-n 1 bill)
   (|P|(PERSON BILL) |P|(FRIEND BILL BOB) |P|(PERSON BOB) |P|(FRIEND  
BOB JOE))

   * (all-facts-of-n 2 bill)
   (|P|(PERSON BILL) |P|(FRIEND BILL BOB) |P|(PERSON BOB) |P|(FRIEND  
BOB JOE)
    |P|(PERSON JOE))





_______________________________________________
powerloom-forum mailing list
powerloom-forum@...
http://mailman.isi.edu/mailman/listinfo/powerloom-forum