amalgame/commit

IMPROVED: do not export expand cache outside module

authorJacco van Ossenbruggen
Mon Sep 29 16:15:47 2014 +0200
committerJacco van Ossenbruggen
Mon Sep 29 16:15:47 2014 +0200
commitcb4361a2a15de8bbb61c900d4632c990141e889a
tree1c85dd6833b769826c6b914dd8b74a6628191885
parent395a586f6ed7edaa779de99fd9da4bb2799b98bc
Diff style: patch stat
diff --git a/lib/amalgame/caching.pl b/lib/amalgame/caching.pl
index 92bb71f..2741146 100644
--- a/lib/amalgame/caching.pl
+++ b/lib/amalgame/caching.pl
@@ -2,7 +2,7 @@
 	  [
 	      get_stats_cache/3,
 	      set_stats_cache/3,
-	      expand_cache/2,
+	      get_expand_cache/3,
 	      cache_result/4,
 	      cache_mapped_concepts/4,
 	      clean_repository/0,
@@ -64,6 +64,8 @@ get_stats_cache(Strategy, Node, Value) :-
 set_stats_cache(Strategy, Node, Value) :-
 	retractall(stats_cache(Node-Strategy,_)),
 	assert(stats_cache(Node-Strategy, Value)).
+get_expand_cache(Strategy, Node, Value) :-
+	expand_cache(Node-Strategy, Value).
 
 flush_stats_cache(Mapping, Strategy) :-
 	retractall(mapped_concepts_cache(Strategy, _, Mapping, _)),
diff --git a/lib/amalgame/expand_graph.pl b/lib/amalgame/expand_graph.pl
index 4afeb1a..9d0436c 100644
--- a/lib/amalgame/expand_graph.pl
+++ b/lib/amalgame/expand_graph.pl
@@ -98,14 +98,14 @@ my_correspondence_element(Type, Align3, E-t) :-
 	correspondence_element(Type, Align3, E).
 
 expand_node_(Strategy, Id, Result) :-
-	% Try if we get this result from the expand_cache first:
-	expand_cache(Id-Strategy, Result),!.
+	% Try if we get this result from the expand_cache (on node id) first:
+	get_expand_cache(Strategy, Id, Result),!.
 
 expand_node_(Strategy, Id, Result) :-
-	% Try if we get this result from the expand_cache first:
+	% Try if we get this result from the expand_cache (on process id):
 	rdf_has(Id, amalgame:wasGeneratedBy, Process, OutputType),
 	rdf(Id, OutputType, Process, Strategy),
-	expand_cache(Process-Strategy, ProcessResult),
+	get_expand_cache(Strategy, Process, ProcessResult),
 	!,
 	debug(ag_expand, 'Output ~p of process ~p taken from cache',
 	      [Id, Process]),