amalgame/commit

rdf11

authorJacco van Ossenbruggen
Sun Mar 29 13:45:21 2020 +0200
committerJacco van Ossenbruggen
Sun Mar 29 14:26:02 2020 +0200
commit287034ed9de28f7e83f0e4568029941e4c6dbb00
treee72e6b597624cb50b7a18763c62f3d5a4706a4c7
parentf55b4a90ba2711112b19fa393790be8240e6f5b4
Diff style: patch stat
diff --git a/lib/amalgame/ag_evaluation.pl b/lib/amalgame/ag_evaluation.pl
index e021191..349cfac 100644
--- a/lib/amalgame/ag_evaluation.pl
+++ b/lib/amalgame/ag_evaluation.pl
@@ -5,7 +5,7 @@
 			  delete_empty_eval_graphs/1
 			 ]).
 
-:- use_module(library(semweb/rdf_db)).
+:- use_module(library(semweb/rdf11)).
 :- use_module(library(semweb/rdfs)).
 :- use_module(library(amalgame/ag_provenance)).
 :- use_module(library(amalgame/util)).
@@ -30,26 +30,26 @@ create_evaluation_graph(Strategy, Mapping, EvalGraph) :-
 	mint_node_uri(Strategy, manual_evaluation_process, EvalProcess),
 	mint_node_uri(Strategy, manual_reference_alignment, EvalGraph),
 
-	rdf_assert(EvalProcess, rdf:type,       amalgame:'EvaluationProcess',         Strategy),
-	rdf_assert(EvalProcess, rdfs:label,     literal('Manual evaluation process'), Strategy),
+	rdf_assert(EvalProcess, rdf:type,       amalgame:'EvaluationProcess',	Strategy),
+	rdf_assert(EvalProcess, rdfs:label,     'Manual evaluation process'@en,	Strategy),
 
 	rdf_assert(EvalGraph, rdf:type,     amalgame:'EvaluatedMapping',      Strategy),
-	rdf_assert(EvalGraph, rdfs:label,   literal('Evaluation results'),    Strategy),
+	rdf_assert(EvalGraph, rdfs:label,   'Evaluation results'@en,          Strategy),
 	rdf_assert(EvalGraph, amalgame:wasGeneratedBy, EvalProcess,           Strategy),
 
 	rdf_assert(EvalGraph, amalgame:status, amalgame:reference, Strategy),
 
 	(   setting(amalgame:reference_alignment, mapping)
 	->  format(atom(Comment), 'Manual evaluation of ~p', [Mapping]),
-	    rdf_assert(EvalProcess, amalgame:input,	Mapping,         Strategy),
-	    rdf_assert(EvalGraph, amalgame:evaluationOf,   Mapping,	 Strategy),
+	    rdf_assert(EvalProcess, amalgame:input,	 Mapping,	 Strategy),
+	    rdf_assert(EvalGraph, amalgame:evaluationOf, Mapping,	 Strategy),
 	    Options = [was_derived_from([Mapping, Strategy])]
 	;   format(atom(Comment), 'Manual evaluation of mappings from ~p', [Strategy]),
-	    rdf_assert(EvalProcess, amalgame:input,	Strategy,	 Strategy),
-	    rdf_assert(EvalGraph, amalgame:evaluationOf,   Strategy,	 Strategy),
+	    rdf_assert(EvalProcess, amalgame:input,	 Strategy,	 Strategy),
+	    rdf_assert(EvalGraph, amalgame:evaluationOf, Strategy,	 Strategy),
 	    Options = [was_derived_from([Strategy])]
 	),
-	rdf_assert(EvalGraph, rdfs:comment, literal(Comment),	 Strategy),
+	rdf_assert(EvalGraph, rdfs:comment, Comment@en, Strategy),
 	provenance_graph(Strategy, ProvGraph),
 	prov_was_generated_by(EvalProcess, [EvalGraph], ProvGraph, [strategy(Strategy)|Options]).
 
diff --git a/lib/amalgame/ag_provenance.pl b/lib/amalgame/ag_provenance.pl
index d95405e..85a908a 100644
--- a/lib/amalgame/ag_provenance.pl
+++ b/lib/amalgame/ag_provenance.pl
@@ -15,7 +15,7 @@
 :- use_module(library(option)).
 :- use_module(library(http/http_host)).
 :- use_module(library(http/http_session)).
-:- use_module(library(semweb/rdf_db)).
+:- use_module(library(semweb/rdf11)).
 :- use_module(library(semweb/rdfs)).
 
 :- use_module(user(user_db)).
@@ -59,7 +59,7 @@ create_prov_graph(Strategy, Graph) :-
 	format(atom(Label), 'Provenance graph for strategy ~p', [Strategy]),
 	rdf_assert(Graph, rdf:type, prov:'Bundle', Graph),
 	rdf_assert(Graph, amalgame:hasPlan, Strategy, Graph),
-	rdf_assert(Graph, rdfs:label, literal(lang(en,Label)), Graph),
+	rdf_assert(Graph, rdfs:label, Label@en, Graph),
 	% Copy Strategy triples to empty prov graph:
 	findall(rdf(Strategy,P,O), rdf(Strategy,P,O,Strategy), STriples),
 	forall(member(rdf(S,P,O), STriples), rdf_assert(S,P,O,Graph)).
@@ -83,8 +83,7 @@ prov_ensure_entity(Strategy, Entity, Graph) :-
 	option(revision(Revision), Stats),
 	prov_named_graphs(Repo, Graph),
 	rdf_assert(Entity, amalgame:loadedInto, Repo, Graph),
-	rdf_assert(Entity, 'http://usefulinc.com/ns/doap#revision',
-		   literal(Revision), Graph),
+	rdf_assert(Entity, 'http://usefulinc.com/ns/doap#revision', Revision^^xsd:string, Graph),
 	findall(rdf(Entity, P, O), rdf(Entity, P, O), Triples),
 	forall(member(rdf(S,P,O), Triples), rdf_assert(S,P,O,Graph)),
 	!.
@@ -199,7 +198,7 @@ prov_was_generated_by(Process, Artifacts, Graph, Options) :-
 	rdf_assert(Process, prov:qualifiedAssociation,  PersonAssociation,  Graph),
 
 	now_xsd(NowXML),
-	rdf_assert(Process, prov:endedAtTime,   literal(type(xsd:dateTime, NowXML)) , Graph),
+	rdf_assert(Process, prov:endedAtTime,  NowXML^^xsd:dateTime, Graph),
 
 	(   memberchk(was_derived_from(Sources), Options)
 	->  forall(member(Source, Sources),
@@ -257,21 +256,21 @@ prov_program(Graph, Program)  :-
 	variant_sha1(All, Hash),
 	atomic_list_concat(['http://localhost/ns/amalgame/version/x', Hash], Program),
 	assert(current_prov_uri(Graph, program(Program))),
-	rdf_assert(Program, rdfs:label, literal('Amalgame alignment platform'), Graph),
+	rdf_assert(Program, rdfs:label, 'Amalgame alignment platform'@en, Graph),
 	rdf_assert(Program, rdf:type,   prov:'SoftwareAgent', Graph),
 	rdf_assert(Program, amalgame:cwd, CWDF, Graph),
-	rdf_assert(Program, amalgame:host, literal(LocalHost), Graph),
+	rdf_assert(Program, amalgame:host, LocalHost^^xsd:string, Graph),
 	forall(member(M-U-V-D, All),
 	       (   rdf_bnode(B),
 	           rdf_assert(Program, amalgame:component, B, Graph),
 		   rdf_assert(B, 'http://usefulinc.com/ns/doap#revision',
-			      literal(V), Graph),
+			      V^^xsd:string, Graph),
 		   rdf_assert(B, 'http://usefulinc.com/ns/doap#name',
-			      literal(M), Graph),
+			      M^^xsd:string, Graph),
 		   rdf_assert(B, rdfs:seeAlso,
-			      literal(D), Graph),
+			      D^^xsd:string, Graph),
 		   rdf_assert(B, rdfs:seeAlso,
-			      literal(U), Graph)
+			      U^^xsd:string, Graph)
 	       )
 	      ),
 	!.
@@ -296,7 +295,7 @@ prov_person(Graph, Person) :-
 	 UserName = 'anonymous user (not logged in)'
 	),
 	assert(current_prov_uri(Graph, person(Person))),
-	rdf_assert(Person, rdfs:label, literal(UserName),  Graph),
+	rdf_assert(Person, rdfs:label, UserName^^xsd:string,  Graph),
 	rdf_assert(Person, rdf:type,   prov:'Person',	  Graph).
 
 prov_association(Agent, _Strategy, _Graph, Association):-
@@ -346,16 +345,15 @@ prov_named_graph(NG, Repo, Graph) :-
 	),
 	(   rdf_graph_property(NG, source_last_modified(NGsource_lm0))
 	->  xsd_timestamp(NGsource_lm0, NGsource_lm),
-	    rdf_assert(NG, amalgame:source_last_modified,
-		       literal(type(xsd:dateTime, NGsource_lm)), Graph)
+	    rdf_assert(NG, amalgame:source_last_modified, NGsource_lm^^xsd:dateTime, Graph)
 	;   true
 	),
 	rdf_assert(Repo, amalgame:loaded, NG, Graph),
 
-	rdf_assert(NG, amalgame:hash, literal(NGHash), Graph),
-	rdf_assert(NG, amalgame:modified_after_loading, literal(NGModified), Graph),
-	rdf_assert(NG, amalgame:triples, literal(type(xsd:int, NGCount)), Graph),
-	rdf_assert(NG, rdfs:comment, literal(lang(en, 'This named graph was loaded into the triple store during the alignment process. It may or may not have influenced the results.')), Graph).
+	rdf_assert(NG, amalgame:hash, NGHash^^xsd:string, Graph),
+	rdf_assert(NG, amalgame:modified_after_loading, NGModified^^xsd:string, Graph),
+	rdf_assert(NG, amalgame:triples, NGCount^^xsd:int, Graph),
+	rdf_assert(NG, rdfs:comment, "This named graph was loaded into the triple store during the alignment process. It may or may not have influenced the results."@en, Graph).
 
 
 %%	prov_get_entity_version(+Entity,+SourceGraph,Version)
@@ -391,7 +389,7 @@ assert_count(VocUri, Strategy, ProvGraph) :-
 	node_stats(Strategy, VocUri, Stats, []),
 	option(totalCount(Count), Stats),
 	rdf_retractall(VocUri, amalgame:totalCount, _, ProvGraph),
-	rdf_assert(VocUri, amalgame:totalCount, literal(type(xsd:int, Count)), ProvGraph).
+	rdf_assert(VocUri, amalgame:totalCount, Count^^xsd:int, ProvGraph).
 
 assert_count(MapUri, Strategy, ProvGraph) :-
 	rdfs_individual_of(MapUri, amalgame:'Mapping'),!,
@@ -403,12 +401,10 @@ assert_count(MapUri, Strategy, ProvGraph) :-
 	rdf_retractall(MapUri, amalgame:mappedSourceConcepts, _, ProvGraph),
 	rdf_retractall(MapUri, amalgame:mappedTargetConcepts, _, ProvGraph),
 
-	rdf_assert(MapUri, amalgame:totalCount,
-		   literal(type('http://www.w3.org/2001/XMLSchema#int', Count)), ProvGraph),
-	rdf_assert(MapUri, amalgame:mappedSourceConcepts,
-		   literal(type('http://www.w3.org/2001/XMLSchema#int', SN)), ProvGraph),
-	rdf_assert(MapUri, amalgame:mappedTargetConcepts,
-		   literal(type('http://www.w3.org/2001/XMLSchema#int', TN)), ProvGraph).
+	rdf_assert(MapUri, amalgame:totalCount,       Count^^xsd:int, ProvGraph),
+	rdf_assert(MapUri, amalgame:mappedSourceConcepts, SN^^xsd:int, ProvGraph),
+	rdf_assert(MapUri, amalgame:mappedTargetConcepts, TN^^xsd:int, ProvGraph).
+
 
 %%	is_amalgame_graph(?G) is nondet
 %
diff --git a/lib/amalgame/ag_publish.pl b/lib/amalgame/ag_publish.pl
index fad6f06..0ee6e21 100644
--- a/lib/amalgame/ag_publish.pl
+++ b/lib/amalgame/ag_publish.pl
@@ -7,7 +7,7 @@
 :- use_module(library(lists)).
 :- use_module(library(option)).
 
-:- use_module(library(semweb/rdf_db)).
+:- use_module(library(semweb/rdf11)).
 :- use_module(library(semweb/rdfs)).
 :- use_module(library(semweb/rdf_label)).
 :- use_module(library(semweb/rdf_turtle_write)).
@@ -114,7 +114,7 @@ assert_master_void(Strategy, URI, Graph) :-
 	atom_concat(NS, VoidHash, URI),
 	rdf_assert(URI, rdf:type, void:'Linkset', Graph),
 	rdf_assert(URI, amalgame:hasPlan,  Strategy, Graph),
-	rdf_assert(URI, dcterms:title, literal(Title), Graph),
+	rdf_assert(URI, dcterms:title, Title@en, Graph),
 	(   rdf_has(Strategy, rdfs:comment, Comment)
 	->  rdf_assert(URI, dcterms:description, Comment, Graph)
 	;   true
@@ -127,7 +127,6 @@ assert_void(Id,Options) :-
 	option(all_mappings(All), Options, []),
 	option(type(Type), Options, amalgame:'Mapping'),
 
-	rdf_equal(xsd:int, Int),
 	void_graph(Strategy, Void),
 	(   rdf_statistics(triples_by_graph(Id, NrOfTriples)) -> true; NrOfTriples=0),
 	assert_metadata(Id, Strategy, Void),
@@ -142,7 +141,7 @@ assert_void(Id,Options) :-
 	;   true
 	),
 	rdf_assert(Id, rdf:type,          Type,  Void),
-	rdf_assert(Id, void:triples,      literal(type(Int,NrOfTriples)), Void),
+	rdf_assert(Id, void:triples,      NrOfTriples^^xsd:int, Void),
 
 	rdf_assert(Id, amalgame:hasPlan,  Strategy, Void),
 	rdf_assert(Id, amalgame:prov,	  ProvGraph, Void).
@@ -250,11 +249,11 @@ is_metadata_triple(S,P,O,Graph) :-
 	rdf(S,RP,Process,Graph),
 	rdf(Process, prov:wasAssociatedWith, O),
 	rdf_equal(dcterms:creator, P).
-is_metadata_triple(S,P,literal(type(T,N)), _Graph) :-
-	rdf_has(S, amalgame:mappedSourceConcepts, literal(type(T,N))),
+is_metadata_triple(S,P,N^^T, _Graph) :-
+	rdf_has(S, amalgame:mappedSourceConcepts, N^^T),
 	rdf_equal(P, void:distinctSubjects).
-is_metadata_triple(S,P,literal(type(T,N)), _Graph) :-
-	rdf_has(S, amalgame:mappedTargetConcepts, literal(type(T,N))),
+is_metadata_triple(S,P,N^^T, _Graph) :-
+	rdf_has(S, amalgame:mappedTargetConcepts, N^^T),
 	rdf_equal(P, void:distinctObjects).
 is_metadata_triple(S,P,O,Graph) :-
 	rdf_has(S, rdfs:label, O, RP),
diff --git a/lib/amalgame/ag_reference.pl b/lib/amalgame/ag_reference.pl
index 2f67972..e113e73 100644
--- a/lib/amalgame/ag_reference.pl
+++ b/lib/amalgame/ag_reference.pl
@@ -5,7 +5,7 @@
 
 :- use_module(library(apply)).
 :- use_module(library(lists)).
-:- use_module(library(semweb/rdf_db)).
+:- use_module(library(semweb/rdf11)).
 :- use_module(library(amalgame/expand_graph)).
 
 %%	reference_mappings(+Strategy, -References) is det.
diff --git a/lib/amalgame/ag_stats.pl b/lib/amalgame/ag_stats.pl
index 3cc51ca..ea8c199 100644
--- a/lib/amalgame/ag_stats.pl
+++ b/lib/amalgame/ag_stats.pl
@@ -9,7 +9,7 @@
 :- use_module(library(debug)).
 :- use_module(library(option)).
 :- use_module(library(lists)).
-:- use_module(library(semweb/rdf_db)).
+:- use_module(library(semweb/rdf11)).
 :- use_module(library(semweb/rdfs)).
 
 :- use_module(library(stat_lists)).
diff --git a/lib/amalgame/caching.pl b/lib/amalgame/caching.pl
index 34f509f..735e47b 100644
--- a/lib/amalgame/caching.pl
+++ b/lib/amalgame/caching.pl
@@ -19,7 +19,7 @@
 :- use_module(library(option)).
 :- use_module(library(settings)).
 
-:- use_module(library(semweb/rdf_db)).
+:- use_module(library(semweb/rdf11)).
 :- use_module(library(semweb/rdfs)).
 
 :- use_module(ag_provenance).
diff --git a/lib/amalgame/edoal.pl b/lib/amalgame/edoal.pl
index 6fb9d9c..ae38840 100644
--- a/lib/amalgame/edoal.pl
+++ b/lib/amalgame/edoal.pl
@@ -17,7 +17,7 @@ http://alignapi.gforge.inria.fr/edoal.html
 */
 
 
-:- use_module(library(semweb/rdf_db)).
+:- use_module(library(semweb/rdf11)).
 :- use_module(map).
 :- use_module(ag_provenance).
 
@@ -50,13 +50,12 @@ assert_alignment(URI, Options) :-
 
 	rdf_assert(URI, align:onto1, O1, Graph),
         rdf_assert(URI, align:onto2, O2, Graph),
-        rdf_assert(URI, align:method, literal(Method), Graph),
-	rdf_assert(URI, align:type, literal(Type), Graph),
+        rdf_assert(URI, align:method, Method^^xsd:string, Graph),
+	rdf_assert(URI, align:type,     Type^^xsd:string, Graph),
 
-	rdf_assert(O1, align:location, literal(L1), Graph),
-	rdf_assert(O2, align:location, literal(L2), Graph),
+	rdf_assert(O1, align:location, L1^^xsd:string, Graph),
+	rdf_assert(O2, align:location, L2^^xsd:string, Graph).
 
-	true.
 
 %%	assert_cell(+C1,+C2,+OptionList) is det.
 %
@@ -90,10 +89,10 @@ assert_cell(C1, C2, Options) :-
 	->  rdf_equal(skos:closeMatch, CloseMatch),
 	    option(measure(M),   Options, 0.00001),
 	    option(relation(R),  Options, CloseMatch),
-	    rdf_assert(Cell, align:measure, literal(M), Graph),
-	    rdf_assert(Cell, align:relation, literal(R), Graph)
+	    rdf_assert(Cell, align:measure,  M^^xsd:float, Graph),
+	    rdf_assert(Cell, align:relation, R^^xsd:string, Graph)
 	;   (   option(measure(M), Options)
-	    ->	rdf_assert(Cell, align:measure, literal(M), Graph)
+	    ->	rdf_assert(Cell, align:measure, M^^xsd:float, Graph)
 	    ;	true
 	    ),
 	    (	option(relation(R), Options)
@@ -156,7 +155,7 @@ assert_prov_elem(user, User, Subject, Graph, _Options) :-
 assert_prov_elem(Key, Value, Subject, Graph, _Options) :-
 	rdf_global_id(amalgame:Key, Property),
 	format(atom(Atom), '~w', [Value]),
-	rdf_assert(Subject, Property, literal(Atom), Graph).
+	rdf_assert(Subject, Property, Atom^^xsd:string, Graph).
 
 rdf_assert_triples([], _).
 rdf_assert_triples([rdf(S,P,O)|Tail], Graph) :-