amalgame/commit
FIXED: broken compound label matcher, rdf11
author | Jacco van Ossenbruggen |
---|---|
Wed Mar 4 16:22:22 2020 +0100 | |
committer | Jacco van Ossenbruggen |
Wed Mar 4 16:22:22 2020 +0100 | |
commit | 8e4367d79f5dcfe18044c18f1c861a00ccf4c245 |
tree | ca7e137a22280f02e4b1c758211639181ac99888 |
parent | 13de7559ac70d2cf833086570830f162ace8b253 |
Diff style: patch stat
diff --git a/lib/ag_modules/compound_label_match.pl b/lib/ag_modules/compound_label_match.pl index 692a2e4..0ac6b1c 100644 --- a/lib/ag_modules/compound_label_match.pl +++ b/lib/ag_modules/compound_label_match.pl @@ -3,7 +3,7 @@ :- use_module(library(lists)). :- use_module(library(option)). -:- use_module(library(semweb/rdf_db)). +:- use_module(library(semweb/rdf11)). :- use_module(library(semweb/rdf_litindex)). :- use_module(library(amalgame/vocabulary)). :- use_module(string_match_util). @@ -24,32 +24,26 @@ compound_label_match(align(Source, Target, Prov0), option(targetlabel(MatchPropT), Options, RdfsLabel), option(matchacross_lang(MatchAcross), Options, true), option(matchacross_type(IgnoreType), Options, true), - option(case_sensitive(CaseSensitive), Options, false), + % option(case_sensitive(CaseSensitive), Options, false), option(source_language(Lang), Options, 'any'), ( Lang == 'any' -> SourceLang = _UnBound ; SourceLang = Lang ), - % If we cannot match across languages, set target language to source language ( MatchAcross == false -> TargetLang = SourceLang ; true ), - ( CaseSensitive - -> SearchTarget=literal(lang(TargetLang, Token)) - ; SearchTarget=literal(exact(Token), lang(TargetLang, TargetLabel)) - ), - - skos_has(Source, MatchPropS, - literal(lang(SourceLang, SourceLabel)), - SourceProp, Options), + skos_has(Source, MatchPropS, SourceLabel@SourceLang, SourceProp, Options), SourceLabel \= '', - rdf_tokenize_literal(SourceLabel, Tokens), + atom_string(SourceLabelAtom, SourceLabel), + rdf_tokenize_literal(lang(SourceLang,SourceLabelAtom), Tokens), length(Tokens, TokenLength), TokenLength > 0, member(Token, Tokens), atom(Token), - skos_has(Target, MatchPropT, SearchTarget, TargetProp, Options), + rdf11:{ substring(TargetLabel, Token) }, + skos_has(Target, MatchPropT, TargetLabel@TargetLang, TargetProp, Options), ( option(target_scheme(TargetScheme), Options) -> vocab_member(Target, TargetScheme) @@ -63,13 +57,13 @@ compound_label_match(align(Source, Target, Prov0), % if matching label has no lang tag, these are still not grounded: ( var(SourceLang) - -> SourceTerm = literal(SourceLabel) - ; SourceTerm = literal(lang(SourceLang, SourceLabel)) + -> SourceTerm = SourceLabel^^xsd:string + ; SourceTerm = SourceLabel@SourceLang ), ( var(TargetLang) - -> TargetTerm = literal(TargetLabel) - ; TargetTerm = literal(lang(TargetLang, TargetLabel)) + -> TargetTerm = TargetLabel^^xsd:string + ; TargetTerm = TargetLabel@TargetLang ), Prov = [method(compound_label),