amalgame/commit

IMPROVED: only clean up viz by deleting empty results if they have non-empty siblings

authorJacco van Ossenbruggen
Fri Feb 21 16:30:48 2020 +0100
committerJacco van Ossenbruggen
Fri Feb 21 16:30:48 2020 +0100
commitdcc44c50ec91b1041980ca2494551d2e89ace163
treeddce6a328b8216bc6070a8963a17054763046b70
parent2e61284fc109a1960447d0b5482458b24ccbcfb0
Diff style: patch stat
diff --git a/api/strategy_viz.pl b/api/strategy_viz.pl
index bf78438..11530f6 100644
--- a/api/strategy_viz.pl
+++ b/api/strategy_viz.pl
@@ -135,7 +135,9 @@ is_amalgame_property(P) :-
 empty_result(Strategy, E) :-
 	rdfs_individual_of(E, amalgame:'Entity'),
 	node_stats(Strategy, E, Stats, [compute(false)]),
-	option(totalCount(0), Stats),!.
+	option(totalCount(0), Stats),
+	non_empty_sibling(Strategy, E),
+	!.
 
 empty_result(_Strategy,M) :-
 	is_empty_eval_graph(M).
@@ -146,6 +148,15 @@ empty_result(Strategy,Process) :-
 	rdf(Empty, amalgame:wasGeneratedBy, Process, Strategy),
 	empty_result(Strategy, Empty).
 
+non_empty_sibling(Strategy, E) :-
+	rdf_has(E, amalgame:wasGeneratedBy, Process, RP),
+	rdf(E, RP, Process, Strategy),
+	rdf_has(Sibling, amalgame:wasGeneratedBy, Process, _RP),
+	Sibling \= E,
+	node_stats(Strategy, Sibling, Stats, [compute(false)]),
+	option(totalCount(Count), Stats),
+	Count > 0.
+
 %%	amalgame_shape(+Resource, -Shape, +Options)
 %
 %	Defines graph node shape for different types of resources.