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..

Fact flags compiler/execution questions
 
 

The following code doesn’t work as I expected:

outputmacro: ^addUpdateFact (^subject ^object ^flag)
 @
= ^query(direct_svo ^subject verb ^object 1)
 ^if (^
length(@0) == 0)
 
{
  
@20 += ^createfact(^subject verb ^object (FACTTRANSIENT ^flag))
 
}
 
else
 
{
  
^addproperty(@^flag)
 

If the fact triple is not found then a fact is created with a flag. That works perfectly.

But if the fact already exists, I just want to update the flag for it. But ^addproperty cannot decode the flag when is passed as a parameter. It logs a “Unknown addproperty value ^2”.

It is the same result if I use a $$variable instead.


Should this syntax work, or am I left with the workaround of

^if (^flag == USER_FLAG1)
  
{
   
^addproperty(@0 USER_FLAG1)
  
}
  
else if (^flag == USER_FLAG2)
  
{
   
^addproperty(@0 USER_FLAG2)
  
}
  
else if (^flag == USER_FLAG3)
  
{
   
^addproperty(@0 USER_FLAG3)
  

 

In a slightly similar vein, on a directflag_* query, then the flag value to be match against cannot be expressed as the string constant, i.e. USER_FLAG1 and I have to use the underlying numeric value instead, i.e. 4096.

 

 

 
  [ # 1 ]

^addproperty sets bits on “words” in the dictionary. Or on fact flags in a set.

When you want to use the string constant like USER_FLAG1, you need to put a # in front of it…. #USER_FLAG1
Then you dont and SHOULDNT user the underlying numeric value. 

 

 
  [ # 2 ]

The issue is a bug in the AddProperty code for argument processing. I will fix.

 

 
  [ # 3 ]

OK, thank you

 

 
  [ # 4 ]

Fixed for next release this weekend.

 

 
  login or register to react