AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

How to change a Fact of a Fact?
 
 

Hi Bruce,
I am creating facts like so:

^createfact(^owner ^location (^base_type ^other_type ^amount)) 

and I want to change the ^amount value afterwards.

Ordinarily I would delete the fact of a fact and create a new one. But I can’t figure out how to query the (^base_type ^other_type ^amount) fact and have it return itself so I can delete it.


This is what I have so far:

outputmacro: ^change_inv_item(^owner ^location ^base_type ^other_type ^amount)
[
 
@= ^query(direct_sv ^owner ^location)
 if (@
1)
 
{
  loop
()
  
{
   
@= @1
   _1 
= ^last(@1all)
   
   if (^
fact_3 subject) == ^base_type and ^fact_3 verb) == ^other_type)
   
{   
    
^delete(@2# Deletes the entire fact set under ^owner ^location, which is not what I want  
   
}
  }
 }
 

 
  [ # 1 ]

I found the query.txt file and I am thinking one of the riccochet commands might do it.

 

 
  [ # 2 ]

I don’t think the riccochet command is right. What I need to be able to do is delete the fact in _3, But I need to convert it to a fact set some how. Is there a way to do that?

if (^fact_3 subject) == ^base_type and ^fact_3 verb) == ^other_type)
   
{   
    
^delete(_3# <------
   
 

 
  [ # 3 ]

Okay this is my next attempt. I tried to run a query on the list of facts contained in @0, using this funtion call:

#query(direct_svo subject verb object count fromset toset propogate match)

@= ^query(direct_sv eye component, ?, 1, @0

but it does not find anything.

@= ^query(direct_sv person component
 if (@
0)
 
{
  loop
()
  
{
   _1 
= ^next(@0all)
   
   ^
fact_3 subject) ^fact_3 verb) ^fact_3 object), 
   
   if (^
fact_3 subject) == eye)
   
{
    
@= ^query(direct_sv eye component, ?, 1, @0
    if (@
7)
    
{
     {Found eye fact}
    }
    
else
    
{
     {Failed to find eye fact}
    }
   }
   
  }
 }
 
else
 
{
  call failed
 } 
 

 
  [ # 4 ]

I see I am over complicating things again, so forget this question.

 

 
  login or register to react