My thoughts can be dangerous and lately have been more guess than actually knowing, but they were good enough for some.
Your need for threading has wondering why? I am not saying that is wrong, but I am wondering if Prolog’s ability to backtrack will not do what you need. On the other hand concurrent_forall/2 (example) might fill the bill.
You also note the need to assert/1 and retract/1 which has me thinking and will also have many hear asking why? It is not that it can not be used, but it is one of those flags that suggest there is a concept you might not know. The concepts that pop to mind in this regards are the library(persistency) as noted in the other question, tabling, or ideas similar to using SQL database. ( Wiki Discussion: Prolog in the mind set of SQL).
Also the need to pass the data along to consecutive processes has me again wondering if Prolog’s backtracking ability and tabling might work.
As I have never used tabling, I can only make reference to it. Also note that Jan W. added tabling in the last year or so, so if you do use it, don’t take for granted all of the bugs are even known.
As far the library(persistence), that I have practical knowlege on but only in the cases I needed it for. There is an option db_sync/1 with option update
As
reload
, but use incremental loading if possible. This allows for two processes to examine the same database file, where one writes the database and the other periodically callsdb_sync(update)
to follow the modified data.
but I never was able to get it to work.
Also for library(persistency) the automatic setting of locks were changed a few months ago for the better, but locks are still needed for anything more than simple updates.
So these are my thoughts, but as often happens, Jan W. will answer with much more detail or answer with something I had no to little knowledge of that adds more to my experience.
HTH
EDIT
Check the packages for added code. These are one of the most often overlooked parts of Prolog and loaded with hidden gems.
EDIT
Oops, almost forgot this.
See: TerminusDB - The splash page only hints at what is possible, however one of the primary creators, Gavin, is on this site or on their forum