annotate jamendo/sparql-archived/SeRQL/debug.pl @ 27:d95e683fbd35 tip

Enable CORS on urispace redirects as well
author Chris Cannam
date Tue, 20 Feb 2018 14:52:02 +0000
parents df9685986338
children
rev   line source
Chris@0 1 /* This file is part of ClioPatria.
Chris@0 2
Chris@0 3 Author:
Chris@0 4 HTTP: http://e-culture.multimedian.nl/
Chris@0 5 GITWEB: http://gollem.science.uva.nl/git/ClioPatria.git
Chris@0 6 GIT: git://gollem.science.uva.nl/home/git/ClioPatria.git
Chris@0 7 GIT: http://gollem.science.uva.nl/home/git/ClioPatria.git
Chris@0 8 Copyright: 2007, E-Culture/MultimediaN
Chris@0 9
Chris@0 10 ClioPatria is free software: you can redistribute it and/or modify
Chris@0 11 it under the terms of the GNU General Public License as published by
Chris@0 12 the Free Software Foundation, either version 2 of the License, or
Chris@0 13 (at your option) any later version.
Chris@0 14
Chris@0 15 ClioPatria is distributed in the hope that it will be useful,
Chris@0 16 but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 18 GNU General Public License for more details.
Chris@0 19
Chris@0 20 You should have received a copy of the GNU General Public License
Chris@0 21 along with ClioPatria. If not, see <http://www.gnu.org/licenses/>.
Chris@0 22 */
Chris@0 23
Chris@0 24 /* File: debug.pl
Chris@0 25 Author: Jan Wielemaker
Chris@0 26 Created: Aug 2 2004
Chris@0 27 Purpose:
Chris@0 28 */
Chris@0 29
Chris@0 30 :- module(rdf_debug,
Chris@0 31 [ count/1
Chris@0 32 ]).
Chris@0 33 :- use_module(library('semweb/rdf_db')).
Chris@0 34 :- use_module(library('semweb/rdfs')).
Chris@0 35
Chris@0 36
Chris@0 37 /*******************************
Chris@0 38 * MEASURE *
Chris@0 39 *******************************/
Chris@0 40
Chris@0 41 :- meta_predicate
Chris@0 42 count(:).
Chris@0 43
Chris@0 44 count(G) :-
Chris@0 45 get_time(T0),
Chris@0 46 statistics(cputime, CPU0),
Chris@0 47 C = c(0),
Chris@0 48 ( G,
Chris@0 49 arg(1, C, C0),
Chris@0 50 C1 is C0+1,
Chris@0 51 nb_setarg(1, C, C1),
Chris@0 52 fail
Chris@0 53 ; arg(1, C, Count)
Chris@0 54 ),
Chris@0 55 statistics(cputime, CPU1),
Chris@0 56 get_time(T1),
Chris@0 57 CPU is CPU1 - CPU0,
Chris@0 58 Wall is T1 - T0,
Chris@0 59 format('~D solutions, ~2f CPU in ~2f seconds~n',
Chris@0 60 [ Count, CPU, Wall ]).
Chris@0 61
Chris@0 62
Chris@0 63 /*******************************
Chris@0 64 * PORTRAY *
Chris@0 65 *******************************/
Chris@0 66
Chris@0 67 :- multifile
Chris@0 68 user:portray/1.
Chris@0 69
Chris@0 70 user:portray(X) :-
Chris@0 71 atom(X),
Chris@0 72 rdf_global_id(NS:Local, X),
Chris@0 73 ( rdfs_label(X, Label)
Chris@0 74 -> format('~q (~w)', [NS:Local, Label])
Chris@0 75 ; writeq(NS:Local)
Chris@0 76 ).