amalgame/commit

REFACTORING: Descendent file and module naming

authorJacco van Ossenbruggen
Sat Sep 6 15:46:07 2014 +0200
committerJacco van Ossenbruggen
Sat Sep 6 15:46:07 2014 +0200
commitc175c7bc8a3d60e88ae2ac4e4730188cdf4646f6
treea45604523b325c2f5c0942c9bbc2b850c151385f
parentdc61cc07e110ede2ae24223b0d497dabd59b4d17
Diff style: patch stat
diff --git a/config-available/ag_modules.pl b/config-available/ag_modules.pl
index 9f602c5..06a01e7 100644
--- a/config-available/ag_modules.pl
+++ b/config-available/ag_modules.pl
@@ -2,17 +2,24 @@
 
 % Candidate correspondence generator components:
 :- use_module(library(ag_modules/ancestor_generator)).
+:- use_module(library(ag_modules/descendent_generator)).
 :- use_module(library(ag_modules/exact_label_generator)).
 
 % Mapping producing partitioners:
 :- use_module(library(ag_modules/ancestor_selecter)).
+:- use_module(library(ag_modules/descendent_selecter)).
 :- use_module(library(ag_modules/exact_label_selecter)).
 
+% Vocabulary filters/selecters
+:- use_module(library(ag_modules/voc_exclude)).
+:- use_module(library(ag_modules/subtree_select)).
+:- use_module(library(ag_modules/type_select)).
+:- use_module(library(ag_modules/propvalue_select)).
+
 % Modules that can be used as matchers
 :- use_module(library(ag_modules/compound_match)).
 :- use_module(library(ag_modules/snowball_match)).
 :- use_module(library(ag_modules/isub_match)).
-:- use_module(library(ag_modules/descendent_match)).
 :- use_module(library(ag_modules/related_match)).
 :- use_module(library(ag_modules/preloaded_mapping)).
 
@@ -24,16 +31,11 @@
 :- use_module(library(ag_modules/most_methods)).
 :- use_module(library(ag_modules/most_labels)).
 :- use_module(library(ag_modules/most_generic)).
-:- use_module(library(ag_modules/descendent_selecter)).
 :- use_module(library(ag_modules/related_selecter)).
 :- use_module(library(ag_modules/sibling_selecter)).
 :- use_module(library(ag_modules/preloaded_selecter)).
 
-% Vocabulary filters/selecters
-:- use_module(library(ag_modules/voc_exclude)).
-:- use_module(library(ag_modules/subtree_select)).
-:- use_module(library(ag_modules/type_select)).
-:- use_module(library(ag_modules/propvalue_select)).
+
 
 % Mergers
 :- use_module(library(ag_modules/map_merger)).
diff --git a/lib/ag_modules/descendent_generator.pl b/lib/ag_modules/descendent_generator.pl
index 2a8da66..50cf3ea 100644
--- a/lib/ag_modules/descendent_generator.pl
+++ b/lib/ag_modules/descendent_generator.pl
@@ -1,34 +1,20 @@
-:- module(descendent_match,
-	  []).
+:- module(descendent_generator, []).
 
 :- use_module(library(assoc)).
 :- use_module(library(lists)).
 :- use_module(library(option)).
 :- use_module(library(amalgame/vocabulary)).
-:- use_module(descendent).
+:- use_module(descendent_match).
 
 :- public amalgame_module/1.
-:- public filter/3.
 :- public matcher/4.
 :- public parameter/4.
 
 amalgame_module(amalgame:'DescendentMatcher').
-amalgame_module(amalgame:'DescendentFilter').
 
 parameter(steps, integer, 1,
 	  'depth of search, defaults to 1, e.g. direct children only').
 
-%%	filter(+MappingsIn, -MappingsOut, +Options)
-%
-%	Filter mappings based on descendent matches in snd_input.
-
-filter(In, Out, Options) :-
-	option(snd_input(SecList), Options),
-	findall(S-T-P, member(align(S,T,P), SecList), KeyValueList),
-	keysort(KeyValueList, Deduped),
-	ord_list_to_assoc(Deduped, BackgroundMatches),
-	filter_(In, BackgroundMatches, Out, Options).
-
 %%	matcher(+Source, +Target, -Mappings, +Options)
 %
 %	Mappings is a list of matches between instances of Source and
@@ -42,20 +28,6 @@ matcher(Source, Target, Mappings, Options) :-
 	findall(M, align(Source, Target, BackgroundMatches, M, Options), Mappings0),
 	sort(Mappings0, Mappings).
 
-filter_([], _, [], _).
-filter_([align(S,T,P)|Cs], BackgroundMatches, [C|Mappings], Options) :-
-	(   T = scheme(_)
-	->  descendent_match(align(S,_,P), BackgroundMatches, C, Options),
-	    C=align(_,T2,_),
-	    vocab_member(T2, T)
-	;   descendent_match(align(S,T,P), BackgroundMatches, C, Options)
-	),
-	!,
-	filter_(Cs, BackgroundMatches, Mappings, Options).
-filter_([_|Cs], BackgroundMatches, Mappings, Options) :-
-	filter_(Cs, BackgroundMatches, Mappings, Options).
-
-
 align(Source, Target, BackgroundMatches, Match, Options) :-
 	vocab_member(S, Source),
 	vocab_member(T, Target),
diff --git a/lib/ag_modules/descendent.pl b/lib/ag_modules/descendent_match.pl
similarity index 100%
rename from lib/ag_modules/descendent.pl
rename to lib/ag_modules/descendent_match.pl
diff --git a/lib/ag_modules/descendent_selecter.pl b/lib/ag_modules/descendent_selecter.pl
index dca5988..e919040 100644
--- a/lib/ag_modules/descendent_selecter.pl
+++ b/lib/ag_modules/descendent_selecter.pl
@@ -2,7 +2,7 @@
 	  []).
 
 :- use_module(structure_selecter).
-:- use_module(descendent).
+:- use_module(descendent_match).
 
 :- public amalgame_module/1.
 :- public selecter/5.