amalgame/commit
FIXED: improved rdf11 literals
author | Jacco van Ossenbruggen |
---|---|
Fri Feb 28 14:59:44 2020 +0100 | |
committer | Jacco van Ossenbruggen |
Fri Feb 28 14:59:44 2020 +0100 | |
commit | 07cb2deda95dc0a15be27dd97cd41e0c9345f284 |
tree | b3b85c7f7aebb527d835ae8ccc0c8ca1fdbfb535 |
parent | c4d6f57c533e93bc6f458e4e05172feeca7da1d8 |
Diff style: patch stat
diff --git a/lib/ag_modules/exact_label_match.pl b/lib/ag_modules/exact_label_match.pl index f554939..b4349c1 100644 --- a/lib/ag_modules/exact_label_match.pl +++ b/lib/ag_modules/exact_label_match.pl @@ -2,7 +2,7 @@ exact_label_match/3 ]). -:- use_module(library(semweb/rdf_db)). +:- use_module(library(semweb/rdf11)). :- use_module(library(amalgame/vocabulary)). :- use_module(string_match_util). @@ -29,24 +29,21 @@ exact_label_match(align(Source, Target, Prov0), ; SourceLang = Lang ), - ( CaseSensitive - -> SearchTarget=literal(lang(TargetLang, SourceLabel)), - TargetLabel = SourceLabel - ; SearchTarget=literal(exact(SourceLabel), lang(TargetLang, TargetLabel)) - ), + skos_has(Source, MatchPropS, SourceLabel@SourceLang, SourceProp, Options), + SourceLabel \= '', - % If we cannot match across languages, set target language to source language ( MatchAcross == false -> TargetLang = SourceLang ; true ), - skos_has(Source, MatchPropS, - literal(lang(SourceLang, SourceLabel)), - SourceProp, Options), - SourceLabel \= '', - skos_has(Target, MatchPropT, SearchTarget, - TargetProp, Options), + SearchTarget = TargetLabel@TargetLang, + ( CaseSensitive + -> TargetLabel = SourceLabel + ; rdf11:rdf_where(icase(TargetLabel, SourceLabel)) + ), + + skos_has(Target, MatchPropT, SearchTarget, TargetProp, Options), Source \= Target, ( option(target_scheme(TargetScheme), Options) @@ -61,13 +58,13 @@ exact_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(exact_label), diff --git a/lib/ag_modules/string_match_util.pl b/lib/ag_modules/string_match_util.pl index 5993c22..f1f89e1 100644 --- a/lib/ag_modules/string_match_util.pl +++ b/lib/ag_modules/string_match_util.pl @@ -4,7 +4,7 @@ matching_types/2 ]). -:- use_module(library(semweb/rdf_db)). +:- use_module(library(semweb/rdf11)). :- use_module(library(semweb/rdfs)). :- use_module(library(semweb/rdf_label)). @@ -34,13 +34,19 @@ label_list(LabelProps) :- % ** via skosxl:literalForm if no amalgame:qualifier skos_has(Concept, MatchProp, Literal, RealProp, _Options) :- + var(Literal), rdf_has(Concept, MatchProp, Literal, RealProp), rdf_is_literal(Literal). +skos_has(Concept, MatchProp, Literal, RealProp, _Options) :- + nonvar(Literal), + % Literal = literal(_Query, lang(_Lang, _Result)), + rdf_has(Concept, MatchProp, Literal, RealProp). + skos_has(Concept, MatchProp, Literal, RealProp, Options) :- nonvar(Concept), rdf_has(Concept, MatchProp, LiteralObject, RealProp), - rdf_subject(LiteralObject), + rdf_is_subject(LiteralObject), ( ( rdf_has(LiteralObject, amalgame:qualifier, _), option(match_qualified_only(true), Options, false) )