rdf-mt/commit
Hook entailment and consistency into the tester
author | Jan Wielemaker |
---|---|
Tue Dec 17 10:35:21 2013 +0100 | |
committer | Jan Wielemaker |
Tue Dec 17 10:35:21 2013 +0100 | |
commit | 4581f392e6277d988a7e81b04f166bfc3070021f |
tree | 8f5c4146a4eeb0b6c8f1e2ee38ccfcae3d7c8f1a |
parent | 5742292d41178af3386027cebc2b78fc65ec442e |
Diff style: patch stat
diff --git a/config-available/rdf-mt.pl b/config-available/rdf-mt.pl index 5ebc431..4297c67 100644 --- a/config-available/rdf-mt.pl +++ b/config-available/rdf-mt.pl @@ -47,6 +47,9 @@ :- use_module(library(rdf_mt/mt_simple)). :- use_module(library(rdf_mt/mt_rdf)). :- use_module(library(rdf_mt/mt_rdfs)). +:- use_module(library(rdf_mt/graph_list)). +:- use_module(library(rdf_mt/graph_properties)). +:- use_module(library(rdf_mt/graph_consistency)). :- dynamic test_result/3. % Test, Time, Result @@ -132,10 +135,10 @@ load_test_data(Test) :- load_test_result(Test) :- forall(mf_rdf(Test, mf:result, Data), - ( Data = literal(_) - -> true - ; rdf_load(Data, [silent(true), graph(result)]) - )). + rdf_load(Data, [silent(true), graph(result)])). + +false_result_test(Test) :- + mf_rdf(Test, mf:result, literal(type(_,false))). %% test_entailment_properties(+Test, -Props) % @@ -205,8 +208,22 @@ assert_result(Goal, Test) :- % % True if the test has passed. -assess_result(_PosNeg, Test) :- - load_test_result(Test). +assess_result(positive, Test) :- + false_result_test(Test), !, + \+ consistent_graph(data). +assess_result(positive, Test) :- !, + load_test_result(Test), + graph_list(data, Data), + graph_list(result, Result), + simply_entails(Data, Result). +assess_result(negative, Test) :- + false_result_test(Test), !, + consistent_graph(data). +assess_result(negative, Test) :- + load_test_result(Test), + graph_list(data, Data), + graph_list(result, Result), + \+ simply_entails(Data, Result). /******************************* diff --git a/lib/rdf_mt/graph_consistency.pl b/lib/rdf_mt/graph_consistency.pl new file mode 100644 index 0000000..db2bdc6 --- /dev/null +++ b/lib/rdf_mt/graph_consistency.pl @@ -0,0 +1,41 @@ +/* Part of ClioPatria SeRQL and SPARQL server + + Author: Jan Wielemaker + E-mail: J.Wielemaker@cs.vu.nl + WWW: http://www.swi-prolog.org + Copyright (C): 2013, University of Amsterdam, + VU University Amsterdam + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + As a special exception, if you link this library with other files, + compiled with a Free Software compiler, to produce an executable, this + library does not by itself cause the resulting executable to be covered + by the GNU General Public License. This exception does not however + invalidate any other reasons why the executable file might be covered by + the GNU General Public License. +*/ + +:- module(graph_consistency, + [ consistent_graph/1 % +GraphName + ]). + + +%% consistent_graph(+Name) +% +% True if the named graph Name does not contain any +% inconsistencies. + +consistent_graph(_Name). diff --git a/lib/rdf_mt/graph_list.pl b/lib/rdf_mt/graph_list.pl index 2cad322..0e2642d 100644 --- a/lib/rdf_mt/graph_list.pl +++ b/lib/rdf_mt/graph_list.pl @@ -29,7 +29,7 @@ */ :- module(graph_list, - [ graph_list/2 + [ graph_list/2 % +GraphName, -Graph:list(triple) ]). :- use_module(library(semweb/rdf_db)). :- use_module(library(assoc)). @@ -43,7 +43,7 @@ graph_list(GraphName, List) :- findall(rdf(S,P,O), rdf(S,P,O,GraphName), List0), bnode_variables(List0, List1), - List = List1. + sort(List1, List). bnode_variables(List0, List) :- empty_assoc(Assoc0),