* minor reorganization
authorjcheney@inf.ed.ac.uk
Wed, 06 Feb 2013 17:35:56 +0000
changeset 5489 f9e5f131496e
parent 5488 8f44385bbb06
child 5491 7349cb4fab78
* minor reorganization
semantics/checker.pl
semantics/prov_xml_test.pl
--- a/semantics/checker.pl	Wed Feb 06 17:18:41 2013 +0000
+++ b/semantics/checker.pl	Wed Feb 06 17:35:56 2013 +0000
@@ -429,8 +429,6 @@
 	       -> (J = I)
 	       ; J = invalid(I)).
 
-normalize(I,I) :- \+(infer(I,_)), !.
-normalize(I,K) :- infer(I,J), !, normalize(J,K).
 
 
 
@@ -872,6 +870,21 @@
 
 impos_check(I,T) :- \+(impos(I,T,_)).
 
+% Main body of validator: normalization, validation.
+
+normalize(I,I) :- \+(infer(I,_)), !.
+normalize(I,K) :- infer(I,J), !, normalize(J,K).
+
+
+normalize_document((I,Bundles),(J,Bundles2)) :- 
+  normalize(I,J),
+  normalize_bundles(Bundles,Bundles2).
+
+normalize_bundles([],[]).
+normalize_bundles([(ID,J)|Bundles],[(ID,K)|Bundles2]) :- 
+  normalize(J,K),
+  normalize_bundles(Bundles,Bundles2).
+
 valid(I) :- normalize(I,J),
 	J \= invalid(_),
 	freeze(J,K,0,_),
@@ -884,7 +897,7 @@
   valid(I),
   valid_bundles(Bundles).
 
-valid_bundles([],[]).
+valid_bundles([]).
 valid_bundles([(ID,J)|Bundles]) :- 
   valid(J),
   \+(member((ID,_),Bundles)),
--- a/semantics/prov_xml_test.pl	Wed Feb 06 17:18:41 2013 +0000
+++ b/semantics/prov_xml_test.pl	Wed Feb 06 17:35:56 2013 +0000
@@ -16,7 +16,7 @@
 	\+memberchk(File,['.','..']),
 	absolute_file_name(File,AbsFile,[relative_to(Dir)]),
 	exists_file(AbsFile),
-	succeeds(provx_load_instance(AbsFile,J),PassOrFail),
+	succeeds(provx_load_document(AbsFile,J),PassOrFail),
 	write(PassOrFail),write('\t'),write(File),nl,nl.
 
 test_all:-
@@ -26,7 +26,7 @@
 
 validate_all:-
 	test2(File,_,J,pass),
-	(valid(J)
+	(valid_document(J)
 	-> ( write('valid\t'),write(File), nl,nl)
 	; (write('invalid\t'),write(File), nl,nl)),
 	fail.
@@ -34,8 +34,8 @@
 
 test3(File,J,K) :- Dir='constraint_test_provx',
 	absolute_file_name(File,AbsFile,[relative_to(Dir)]),
-	succeeds(provx_load_instance(AbsFile,J),_),
-	normalize(J,K).
+	succeeds(provx_load_document(AbsFile,J),_),
+	normalize_document(J,K).
 
 succeeds(Goal,pass):-
 	call(Goal),