amalgame/commit
do not try to compute the languages of derived virtual schemes for the string matching language parameter values
author | Jacco van Ossenbruggen |
---|---|
Tue Sep 10 18:25:31 2013 +0200 | |
committer | Jacco van Ossenbruggen |
Tue Sep 10 18:25:31 2013 +0200 | |
commit | 46b4405d481259bcc3a6aee94d1ff48568a1fa16 |
tree | ec73633f13b9c23be0270596cff48af2e5cc34d6 |
parent | 2592dc386c9b60561501002219e89bdc9c2e71f4 |
Diff style: patch stat
diff --git a/lib/ag_modules/compound_match.pl b/lib/ag_modules/compound_match.pl index d76bb0f..ffe5227 100644 --- a/lib/ag_modules/compound_match.pl +++ b/lib/ag_modules/compound_match.pl @@ -4,8 +4,6 @@ :- use_module(library(semweb/rdf_db)). :- use_module(library(semweb/rdf_litindex)). :- use_module(library(amalgame/vocabulary)). -:- use_module(library(amalgame/voc_stats)). - :- use_module(string_match_util). :- public amalgame_module/1. @@ -24,7 +22,7 @@ parameter(targetlabel, oneof(LabelProps), Default, rdf_equal(Default, rdfs:label), label_list(LabelProps). parameter(language, oneof(['any'|L]), 'any', 'Language of source label') :- - voc_property(all, languages(L)). + strategy_languages(_,L). parameter(matchacross_lang, boolean, true, 'Allow labels from different language to be matched'). parameter(matchacross_type, boolean, true, diff --git a/lib/ag_modules/exact_label_match.pl b/lib/ag_modules/exact_label_match.pl index d56b481..60575fa 100644 --- a/lib/ag_modules/exact_label_match.pl +++ b/lib/ag_modules/exact_label_match.pl @@ -3,8 +3,6 @@ :- use_module(library(semweb/rdf_db)). :- use_module(library(amalgame/vocabulary)). -:- use_module(library(amalgame/voc_stats)). - :- use_module(string_match_util). :- public amalgame_module/1. @@ -24,7 +22,7 @@ parameter(targetlabel, oneof(LabelProps), Default, rdf_equal(Default, rdfs:label), label_list(LabelProps). parameter(language, oneof(['any'|L]), 'any', 'Language of source label') :- - voc_property(all, languages(L)). + strategy_languages(_S,L). parameter(matchacross_lang, boolean, true, 'Allow labels from different language to be matched'). parameter(matchacross_type, boolean, true, diff --git a/lib/ag_modules/isub_match.pl b/lib/ag_modules/isub_match.pl index 9dd480d..a55e423 100644 --- a/lib/ag_modules/isub_match.pl +++ b/lib/ag_modules/isub_match.pl @@ -5,7 +5,6 @@ :- use_module(library(semweb/rdf_label)). :- use_module(library(isub)). :- use_module(library(amalgame/vocabulary)). -:- use_module(library(amalgame/voc_stats)). :- use_module(string_match_util). :- public filter/3. @@ -27,7 +26,7 @@ parameter(targetlabel, oneof(LabelProps), Default, parameter(threshold, float, 0.0, 'threshold edit distance'). parameter(language, oneof(['any'|L]), 'any', 'Language of source label') :- - voc_property(all, languages(L)). + strategy_languages(_,L). parameter(matchacross_lang, boolean, true, 'Allow labels from different language to be matched'). diff --git a/lib/ag_modules/snowball_match.pl b/lib/ag_modules/snowball_match.pl index 3f93d00..39f97f3 100644 --- a/lib/ag_modules/snowball_match.pl +++ b/lib/ag_modules/snowball_match.pl @@ -5,7 +5,6 @@ :- use_module(library(snowball)). :- use_module(library(amalgame/lit_distance)). :- use_module(library(amalgame/vocabulary)). -:- use_module(library(amalgame/voc_stats)). :- use_module(string_match_util). :- public amalgame_module/1. @@ -25,7 +24,7 @@ parameter(targetlabel, oneof(LabelProps), Default, rdf_equal(Default, rdfs:label), label_list(LabelProps). parameter(language, oneof(['any'|L]), 'any', 'Language of source label') :- - voc_property(all, languages(L)). + strategy_languages(_,L). parameter(matchacross_lang, boolean, true, 'Allow labels from different language to be matched'). parameter(snowball_language, oneof(Languages), english, diff --git a/lib/ag_modules/string_match_util.pl b/lib/ag_modules/string_match_util.pl index 4477090..00bed9a 100644 --- a/lib/ag_modules/string_match_util.pl +++ b/lib/ag_modules/string_match_util.pl @@ -1,12 +1,15 @@ :- module(ag_string_match_util, [label_list/1, - matching_types/2 + matching_types/2, + strategy_languages/2 ]). :- use_module(library(semweb/rdf_db)). :- use_module(library(semweb/rdfs)). :- use_module(library(semweb/rdf_label)). +:- use_module(library(amalgame/voc_stats)). + %% labels_list(-L) is det. % % L is a sorted list of portrayed label options @@ -44,3 +47,12 @@ matching_types(S1, S2) :- ; true) ,!. + +strategy_languages(Strategy, Languages) :- + findall(Voc, rdf_has(Strategy, amalgame:includes, Voc), Vocs), + maplist(lang_used, Vocs, Langs), + append(Langs, Languages0), + sort(Languages0, Languages). + +lang_used(Voc, Langs) :- + voc_property(Voc, languages(Langs)).