I have an expensive-to-execute predicate that retrieves values from the rdf store that I want to memoize. Is there a way to do this?
I tried with this simple example:
% I was unclear how to mark rdf_assert/4 as dynamic % since it didn't appear to be, so I tried this: :- dynamic([s/1], [incremental(true)]). s(X) :- rdf_assert(default, X, is, b). % This is my simplified 'predicate that I want to memoize': :- table g/1 as incremental. g(X) :- rdf(default, X, is, b).
Then when I run it:
?- g(a). false. ?- s(a). true. ?- g(a). false.
I am looking for a way to make the final
g(a) return true due to incremental tabling…