amalgame/commit

IMPROVED: structure matchers should not only match if related concepts match, but also if they are equal

authorJacco van Ossenbruggen
Fri Mar 6 10:28:13 2020 +0100
committerJacco van Ossenbruggen
Fri Mar 6 10:28:13 2020 +0100
commit68a5a69ae46236008c81627372cf0dd38b2e9bdc
treec3505643ea167218c1fb8727d6fc4c96deb95e85
parent08279e495c1b4314ab582aeeb60753382bea09a0
Diff style: patch stat
diff --git a/lib/ag_modules/ancestor_match.pl b/lib/ag_modules/ancestor_match.pl
index 887ba16..f0f1388 100644
--- a/lib/ag_modules/ancestor_match.pl
+++ b/lib/ag_modules/ancestor_match.pl
@@ -11,7 +11,9 @@ ancestor_match(align(S, T, Prov0), BackgroundMatches,
 	option(steps(MaxSteps), Options),
 	ancestor(S, MaxSteps, AncS, RS, StepsS),
 	ancestor(T, MaxSteps, AncT, RT, StepsT),
-	get_assoc(AncS-AncT, BackgroundMatches, _),
+	(   AncS == AncT
+	;   get_assoc(AncS-AncT, BackgroundMatches, _)
+	),
 	Prov = [method(ancestor_match),
 		source(AncS),
 		target(AncT),
diff --git a/lib/ag_modules/descendent_match.pl b/lib/ag_modules/descendent_match.pl
index 7d2effb..7da3d03 100644
--- a/lib/ag_modules/descendent_match.pl
+++ b/lib/ag_modules/descendent_match.pl
@@ -10,7 +10,9 @@ descendent_match(align(S, T, Prov0), BackgroundMatches, align(S, T, [Prov|Prov0]
 	option(steps(MaxSteps), Options),
 	descendent(S, MaxSteps, DesS, RS, StepsS),
 	descendent(T, MaxSteps, DesT, RT, StepsT),
-	get_assoc(DesS-DesT, BackgroundMatches, _),
+	(   DesS == DesT
+	;   get_assoc(DesS-DesT, BackgroundMatches, _)
+	),
 	Prov = [method(descendent_match),
 		source(DesS),
 		target(DesT),
diff --git a/lib/ag_modules/related_match.pl b/lib/ag_modules/related_match.pl
index d1e254f..08cf7af 100644
--- a/lib/ag_modules/related_match.pl
+++ b/lib/ag_modules/related_match.pl
@@ -8,12 +8,14 @@
 
 related_match(align(S, T, Prov0), BackgroundMatches, align(S, T, [Prov|Prov0]), Options) :-
 	option(steps(MaxSteps), Options),
-	related(S, MaxSteps, AncS, RS, StepsS),
-	related(T, MaxSteps, AncT, RT, StepsT),
-	get_assoc(AncS-AncT, BackgroundMatches, _),
+	related(S, MaxSteps, RelS, RS, StepsS),
+	related(T, MaxSteps, RelT, RT, StepsT),
+	(   RelS == RelT
+	;   get_assoc(RelS-RelT, BackgroundMatches, _)
+	),
 	Prov = [method(related_match),
-		source(AncS),
-		target(AncT),
+		source(RelS),
+		target(RelT),
 		steps((StepsS,StepsT)),
 		graph([RS,RT])
 	       ].