Insert a HiLog term (not a fact or a rule)

17 views
Skip to first unread message

Robin Bloomfield

unread,
Apr 2, 2024, 12:36:18 PM4/2/24
to ErgoAI and XSB Users Forum
Dear User Forum
I'm constructing Ergo facts (via an LLM) and trying to insert them.  If I run

query{MyQuery(?_P), 'test_json_v01b.ergo', \@}, ?X \in ?_P,  insert{?X} in the ErgoQuery window then all is good.

If I construct a query to do it in one go

@!{test2}!-query{MyQuery(?_P), 'test_json_v01b.ergo', \@}, ?X \in ?_P,  insert{?X}.

The running test2, I get an error message

abort(unhandled exception: error(abort(attempt to insert a HiLog term (not a fact or a rule),

I am trying to insert something like claimTitle(cId,'the system is dependable')

Is there a way of converting from Hilog term to a fact or other ways of making this work?

With the usual apologies for my ignorance and thanks in advance

Robin

Michael Kifer

unread,
Apr 2, 2024, 3:19:28 PM4/2/24
to ErgoAI-X...@coherentknowledge.com

Hi Robin,

Here is a simple example showing a way to convert a HiLog term into a HiLog fact in some module (foo):


ergo> ?x = f(o), ?y= ?x@foo.

?x = f(o)
?y = ${f(o)@foo}


Also, when you insert a hilog term into a database, the insert op does the conversion implicitly:


ergo> ?x= f(1), ?y=g(2), insert{?x,?y}.

?x = f(1)
?y = g(2)

1 solution(s) in 0.000 seconds; elapsed time = 0.000

Yes


*** In the above, ?x and ?y are bound to HiLog terms. Let's see what was actually inserted into the db:


ergo> f(?A), g(?B).

?A = 1
?B = 2


**** Here you see that each hilog term, f(1), g(2), got inserted into the db so a term-to-fact conversion has taken place.

**** Into which modules have these facts been inserted?


ergo> f(?A)@?Mf, g(?B)@?Mg.

?A = 1
?Mf = main
?B = 2
?Mg = main


as expected.



Regarding your specific latent query, please send me a complete, but small example and I'll take a look.

It is impossible to tell from the info that you provided so far.



--

       --- michael


 

--
You received this message because you are subscribed to the Google Groups "ErgoAI and XSB Users Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ErgoAI-XSB-for...@coherentknowledge.com.
To view this discussion on the web visit https://groups.google.com/a/coherentknowledge.com/d/msgid/ErgoAI-XSB-forum/db21dfc8-c102-4aae-b6f0-71e85b7ede16n%40coherentknowledge.com.
Reply all
Reply to author
Forward
0 new messages