amalgame/commit

make matching on unqualified label term optional

authorJacco van Ossenbruggen
Wed Mar 19 10:01:46 2014 +0100
committerJacco van Ossenbruggen
Wed Mar 19 10:01:46 2014 +0100
commitaae56e53369abe5ddc4dc942175626c1c9a2f898
tree02668ac31054e87746e6fbaa40d38ea956a378c9
parent8dc6eb6a2dfb5aebf7bffcc6e956f46c4c6770cd
Diff style: patch stat
diff --git a/lib/ag_modules/exact_label_match.pl b/lib/ag_modules/exact_label_match.pl
index 76b756d..992ba93 100644
--- a/lib/ag_modules/exact_label_match.pl
+++ b/lib/ag_modules/exact_label_match.pl
@@ -30,6 +30,8 @@ parameter(matchacross_type, boolean, true,
 	  'Allow labels from different types to be matched').
 parameter(case_sensitive, boolean, false,
 	  'When true the case of labels must be equal').
+parameter(match_qualified_only, boolean, false,
+	  'Match only on the fully qualified label').
 
 %%	filter(+MappingsIn, -MappingsOut, +Options)
 %
@@ -87,8 +89,10 @@ match(align(Source, Target, Prov0), align(Source, Target, [Prov|Prov0]), Options
 	;   true
 	),
 
-	skos_match(FormatS, Source, MatchPropS, literal(lang(SourceLang, SourceLabel)), SourceProp),
-	skos_match(FormatT, Target, MatchPropT, SearchTarget, TargetProp),
+	skos_match(FormatS, Source, MatchPropS, literal(lang(SourceLang, SourceLabel)), 
+		SourceProp, Options),
+	skos_match(FormatT, Target, MatchPropT, SearchTarget,                           
+		TargetProp, Options),
 
 	(   option(target_scheme(TargetScheme), Options)
 	->  vocab_member(Target, TargetScheme)
diff --git a/lib/ag_modules/string_match_util.pl b/lib/ag_modules/string_match_util.pl
index 7565cae..12829f3 100644
--- a/lib/ag_modules/string_match_util.pl
+++ b/lib/ag_modules/string_match_util.pl
@@ -1,6 +1,6 @@
 :- module(ag_string_match_util,
 	  [label_list/1,
-	   skos_match/5,
+	   skos_match/6,
 	   matching_types/2,
 	   strategy_languages/2
 	  ]).
@@ -35,11 +35,13 @@ label_list(LabelProps) :-
 %	** via amalgame:term if literal objects as amalgame:qualifier
 %	** via skosxl:literalForm if no amalgame:qualifier
 
-skos_match(skos, Concept, MatchProp, Literal, RealProp) :-
+skos_match(skos, Concept, MatchProp, Literal, RealProp, _Options) :-
 	rdf_has(Concept, MatchProp, Literal, RealProp).
-skos_match(skosxl, Concept, MatchProp, Literal, RealProp) :-
+skos_match(skosxl, Concept, MatchProp, Literal, RealProp, Options) :-
 	rdf_has(Concept, MatchProp, LiteralObject, RealProp),
-	(   rdf_has(LiteralObject, amalgame:qualifier, _)
+	(   ( rdf_has(LiteralObject, amalgame:qualifier, _),
+	      option(match_qualified_only(false), Options, false)
+            )
 	->  rdf_has(LiteralObject, amalgame:term, Literal)
 	;   rdf(LiteralObject, skosxl:literalForm, Literal)
 	).