Chris@0: /* $Id$ Chris@0: Chris@0: Part of SWI-Prolog Chris@0: Chris@0: Author: Jan Wielemaker Chris@0: E-mail: wielemak@science.uva.nl Chris@0: WWW: http://www.swi-prolog.org Chris@0: Copyright (C): 1985-2005, University of Amsterdam Chris@0: Chris@0: This program is free software; you can redistribute it and/or Chris@0: modify it under the terms of the GNU General Public License Chris@0: as published by the Free Software Foundation; either version 2 Chris@0: of the License, or (at your option) any later version. Chris@0: Chris@0: This program is distributed in the hope that it will be useful, Chris@0: but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@0: GNU General Public License for more details. Chris@0: Chris@0: You should have received a copy of the GNU Lesser General Public Chris@0: License along with this library; if not, write to the Free Software Chris@0: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Chris@0: Chris@0: As a special exception, if you link this library with other files, Chris@0: compiled with a Free Software compiler, to produce an executable, this Chris@0: library does not by itself cause the resulting executable to be covered Chris@0: by the GNU General Public License. This exception does not however Chris@0: invalidate any other reasons why the executable file might be covered by Chris@0: the GNU General Public License. Chris@0: */ Chris@0: Chris@0: :- module(rdf_jrn_export, []). Chris@0: :- use_module(library('semweb/rdf_persistency')). Chris@0: :- use_module(user_db). Chris@0: :- use_module(http_admin). Chris@0: :- use_module(http_user). Chris@0: :- use_module(library('http/http_parameters')). Chris@0: :- use_module(library('http/mimetype')). Chris@0: :- use_module(library('http/http_dispatch')). Chris@0: Chris@0: /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Chris@0: This module exports the journal files defined in rdf_persistency. This Chris@0: is will be used to synchronise servers. Chris@0: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ Chris@0: Chris@0: :- http_handler('/SeRQL/list_journals', list_journals, []). Chris@0: :- http_handler('/SeRQL/journal', journal, []). Chris@0: Chris@0: %% list_journals Chris@0: % Chris@0: % HTTP handler to list the available journals from the persistent Chris@0: % store. Chris@0: Chris@0: list_journals(_Request) :- !, Chris@0: authorized(read(default, list_journals)), Chris@0: format('Content-type: text/xml~n~n'), Chris@0: format('~n'), Chris@0: forall(rdf_journal_file(DB, _File), Chris@0: format(' ~n', [DB])), Chris@0: format('~n'). Chris@0: Chris@0: %% journal Chris@0: % Chris@0: % HTTP handler that serves the journal for an RDF named graph. Chris@0: Chris@0: journal(Request) :- !, Chris@0: http_parameters(Request, Chris@0: [ 'DB'(DB, []) Chris@0: ], Chris@0: [ Chris@0: ]), Chris@0: authorized(read(DB, read_journal)), Chris@0: rdf_journal_file(DB, Path), Chris@0: throw(http_reply(file(text/'x-prolog', Path))).