amalgame/commit
FIXED: rewrite skos match so it does no longer assume exclusive use of either SKOS or SKOS-XL, thanks to Joachim Neubert
author | Jacco van Ossenbruggen |
---|---|
Fri May 23 12:16:28 2014 +0200 | |
committer | Jacco van Ossenbruggen |
Fri May 23 12:16:28 2014 +0200 | |
commit | 8606534118cc4595e6600e28f49dfa0b541f507a |
tree | 4a55a788fbfb8a6663b908c823bf9bc8cbf56837 |
parent | eb2decebddfb51cc33de43a9abfecbb95c731807 |
Diff style: patch stat
diff --git a/lib/ag_modules/string_match_util.pl b/lib/ag_modules/string_match_util.pl index 12829f3..68720a0 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/6, + skos_match/5, matching_types/2, strategy_languages/2 ]). @@ -25,27 +25,44 @@ label_list(LabelProps) :- LabelProps0), sort(LabelProps0, LabelProps). -%% skos_match(Format, Concept, Prop, Lit, RealProp) is nondet. +%% skos_match(Concept, Prop, Lit, RealProp) is nondet. % % Like rdf_has(Concept, Prop, Lit, RealProp), but skosxl-aware. % % Match literal Lit to Concept a la: -% * plain rdf_has if Format is skos, -% * via literal object if Format is skosxl: +% * plain rdf_has (skos), +% * via literal object (skosxl) % ** via amalgame:term if literal objects as amalgame:qualifier % ** via skosxl:literalForm if no amalgame:qualifier -skos_match(skos, Concept, MatchProp, Literal, RealProp, _Options) :- +skos_match(Concept, MatchProp, Literal, RealProp, _Options) :- rdf_has(Concept, MatchProp, Literal, RealProp). -skos_match(skosxl, Concept, MatchProp, Literal, RealProp, Options) :- + +skos_match(Concept, MatchProp, Literal, RealProp, Options) :- + nonvar(Concept), + \+ ground(Literal), rdf_has(Concept, MatchProp, LiteralObject, RealProp), + rdf_subject(LiteralObject), ( ( rdf_has(LiteralObject, amalgame:qualifier, _), - option(match_qualified_only(false), Options, false) + option(match_qualified_only(true), Options, false) ) -> rdf_has(LiteralObject, amalgame:term, Literal) - ; rdf(LiteralObject, skosxl:literalForm, Literal) + ; rdf_has(LiteralObject, skosxl:literalForm, Literal) ). +skos_match(Concept, MatchProp, Literal, RealProp, Options) :- + var(Concept), + ground(Literal), + + ( ( option(match_qualified_only(true), Options, false), + rdf_has(_, amalgame:term, Literal) + ) + -> rdf_has(LiteralObject, amalgame:term, Literal) + ; rdf_has(LiteralObject, skosxl:literalForm, Literal) + ), + rdf_has(Concept, MatchProp, LiteralObject, RealProp), + true. + %% matching_types(+S, +T) is semidet. % % Fails if S and T have conflicting types.