amalgame/commit
FIXED: subtle sort bug, need to do the same in other modules that used predsort with ag_map:compare_align
author | Jacco van Ossenbruggen |
---|---|
Sun Mar 1 13:30:38 2020 +0100 | |
committer | Jacco van Ossenbruggen |
Sun Mar 1 13:30:38 2020 +0100 | |
commit | c05ab10937359d4c9f6e25f7db701f09bb486fdc |
tree | 104fe79eb552691dd0ab5fb2d5751073d06ad0ca |
parent | b8ec820b63dc0b522d3f28d93d9d814030072511 |
Diff style: patch stat
diff --git a/lib/ag_modules/arity_select.pl b/lib/ag_modules/arity_select.pl index 51bb0bf..6ff3eb2 100644 --- a/lib/ag_modules/arity_select.pl +++ b/lib/ag_modules/arity_select.pl @@ -62,10 +62,10 @@ select_1_n(Mapping, Sel, Dis) :- maplist(ap(discarded,target), Dis1, Dis). select_1_n_raw(Mapping, Sel, Dis) :- - predsort(ag_map:compare_align(target), Mapping, TargetSorted), + sort_align(target, Mapping, TargetSorted), select_1_n_no_sort(TargetSorted, Sel0, Dis0), - predsort(ag_map:compare_align(source),Sel0, Sel), - predsort(ag_map:compare_align(source),Dis0, Dis). + sort_align(source, Sel0, Sel), + sort_align(source, Dis0, Dis). select_n_1_raw([], [], []). select_n_1_raw([align(S,T,P)|As], A1, A2) :- diff --git a/lib/amalgame/map.pl b/lib/amalgame/map.pl index 6eccba7..d6f3029 100644 --- a/lib/amalgame/map.pl +++ b/lib/amalgame/map.pl @@ -16,6 +16,8 @@ mapping_relation/2, materialize_mapping_graph/2, % +List, +Options merge_provenance/2, % +List, -Merged + + sort_align/3, % +Type, +In, -Sorted compare_align/4, % +Type, ?Order, A1, A2 same_source/4, % +List, +Source, -Same, -Rest same_target/4, % +List, +Target, -Same, -Rest @@ -291,6 +293,16 @@ prolog:message(map(occurs_min(Min, MappingList))) --> [ 'Occurs in min ~w mapping graphs: ~w'-[Min, MLL] ]. +%! sort_align(Type, In, Out) is det. +% + +sort_align(source, In, Out) :- + sort(In, Out). + +sort_align(target, In, Out) :- + sort(In, In0), + sort(2, @=<, In0, Out). +% %% compare_align(Type, Order, A1, A2) is det. % % compare alignment A1 and A2 on the standard order of the url of