amalgame/commit

do not require source and target should be different in exact label matching

authorJacco van Ossenbruggen
Thu Sep 19 18:34:00 2013 +0200
committerJacco van Ossenbruggen
Thu Sep 19 18:34:00 2013 +0200
commit1b3135bc6ed35ef53c3a13d22e8bf012d3e8d1ca
tree6680a957721a8f7b8be9d64900a371a49ede384f
parentdb1a46c74b7a9322aba6a233b15e2e1f1c18cb55
Diff style: patch stat
diff --git a/lib/ag_modules/compound_match.pl b/lib/ag_modules/compound_match.pl
index ffe5227..cf6f1b3 100644
--- a/lib/ag_modules/compound_match.pl
+++ b/lib/ag_modules/compound_match.pl
@@ -134,7 +134,7 @@ match_label(Source, Label, Targets, Options) :-
 
 	findall(Target-ProvGraph,
 		(   rdf_has(Target, MatchProp, SearchTarget, TargetProp),
-		    Source \== Target,
+		    Source \== Target,  % fix me, replace by target vocab check as in exact_label example
 		    vocab_member(Target, TargetScheme),
 		    (   IgnoreType
 		    ->  true
diff --git a/lib/ag_modules/exact_label_match.pl b/lib/ag_modules/exact_label_match.pl
index 60575fa..554316d 100644
--- a/lib/ag_modules/exact_label_match.pl
+++ b/lib/ag_modules/exact_label_match.pl
@@ -36,10 +36,8 @@ parameter(case_sensitive, boolean, false,
 
 filter([], [], _).
 filter([align(S,T,P)|Cs], [C|Mappings], Options) :-
-	(   T = scheme(_)
-	->  match(align(S,_,P), C, Options),
-	    C=align(_,T2,_),
-	    vocab_member(T2, T)
+	(   T = scheme(TargetScheme)
+	->  match(align(S,_,P), C, [target_scheme(TargetScheme)|Options])
 	;   match(align(S,T,P), C, Options)
 	),
 	!,
@@ -59,8 +57,7 @@ matcher(Source, Target, Mappings, Options) :-
 
 align(Source, Target, Match, Options) :-
 	vocab_member(S, Source),
-	match(align(S,T,[]), Match, Options),
-	vocab_member(T, Target).
+	match(align(S,_,[]), Match, [target_scheme(Target)|Options]).
 
 match(align(Source, Target, Prov0), align(Source, Target, [Prov|Prov0]), Options) :-
 	rdf_equal(rdfs:label, RdfsLabel),
@@ -90,7 +87,11 @@ match(align(Source, Target, Prov0), align(Source, Target, [Prov|Prov0]), Options
 
 	rdf_has(Source, MatchProp1, literal(lang(SourceLang, SourceLabel)), SourceProp),
 	rdf_has(Target, MatchProp2, SearchTarget, TargetProp),
-	Source \== Target,
+
+	(   option(target_scheme(TargetScheme), Options)
+	->  vocab_member(Target, TargetScheme)
+	;   true
+	),
 
 	(   IgnoreType
 	->  true
diff --git a/lib/ag_modules/isub_match.pl b/lib/ag_modules/isub_match.pl
index a55e423..4e473d8 100644
--- a/lib/ag_modules/isub_match.pl
+++ b/lib/ag_modules/isub_match.pl
@@ -41,9 +41,8 @@ parameter(normalize,
 filter([], [], _).
 filter([align(S,T,P)|Cs], [C|Mappings], Options) :-
         (   T = scheme(_)
-        ->  match(align(S,_,P), C, Options),
-            C=align(_,T2,_),
-            vocab_member(T2, T)
+	->  vocab_member(T2, T),
+	    match(align(S,T2,P), C, Options)
         ;   match(align(S,T,P), C, Options)
         ),
         !,
diff --git a/lib/ag_modules/snowball_match.pl b/lib/ag_modules/snowball_match.pl
index 39f97f3..57215c9 100644
--- a/lib/ag_modules/snowball_match.pl
+++ b/lib/ag_modules/snowball_match.pl
@@ -59,8 +59,7 @@ matcher(Source, Target, Mappings, Options) :-
 
 align(Source, Target, Match, Options) :-
 	vocab_member(S, Source),
-	match(align(S,T,[]), Match, Options),
-	vocab_member(T, Target).
+	match(align(S,_,[]), Match, [target_scheme(Target)|Options]).
 
 match(align(Source, Target, Prov0), align(Source, Target, [Prov|Prov0]), Options) :-
 	rdf_equal(rdfs:label,DefaultP),
@@ -92,7 +91,10 @@ match(align(Source, Target, Prov0), align(Source, Target, [Prov|Prov0]), Options
 	snowball(Snowball_Language, SourceLabel0, SourceStem),
 
 	rdf_has(Target, MatchProp2, literal(prefix(Prefix), lang(TargetLang, TargetLabel)), TargetProp),
-	\+ Source == Target,
+	(   option(target_scheme(TargetScheme), Options)
+	->  vocab_member(Target, TargetScheme)
+	;   true
+	),
 
 	downcase_atom(TargetLabel, TargetLabel0),
 	snowball(Snowball_Language, TargetLabel0, TargetStem),