View source with raw comments or as raw
    1/*  Part of ClioPatria semantic web server
    2
    3    Author:        Jan Wielemaker
    4    E-mail:        J.Wielemaker@vu.nl
    5    WWW:           http://www.swi-prolog.org
    6    Copyright (c)  2007-2018, University of Amsterdam
    7                              VU University Amsterdam
    8    All rights reserved.
    9
   10    Redistribution and use in source and binary forms, with or without
   11    modification, are permitted provided that the following conditions
   12    are met:
   13
   14    1. Redistributions of source code must retain the above copyright
   15       notice, this list of conditions and the following disclaimer.
   16
   17    2. Redistributions in binary form must reproduce the above copyright
   18       notice, this list of conditions and the following disclaimer in
   19       the documentation and/or other materials provided with the
   20       distribution.
   21
   22    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   23    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   24    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   25    FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   26    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   27    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   28    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   29    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   30    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   31    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   32    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   33    POSSIBILITY OF SUCH DAMAGE.
   34*/
   35
   36:- module(cp_parms,
   37          [
   38          ]).   39:- use_module(library(settings)).   40:- use_module(library(semweb/rdf_db)).   41:- use_module(library(http/html_write)).   42:- use_module(library(http/http_hook)).

ClioPatria parameters

This file contains the locations of file-directories and web-directories in addition to settings that can be managed by the end-user. It should not be necessary to modify this file:

See also
- run.pl[.in] contains an example startup script. */
   58                 /*******************************
   59                 *          FILE PATHS          *
   60                 *******************************/
   61
   62:- multifile
   63    user:file_search_path/2.   64
   65% ClioPatria specific ones
   66user:file_search_path(rdfql,            cliopatria(rdfql)).
   67user:file_search_path(cpack,            cliopatria(cpack)).
   68
   69% Allow local file overwrites
   70user:file_search_path(web,              web).
   71
   72% Configuration
   73user:file_search_path(config_https,     cp_application('config-enabled/https')).
   74
   75% Package merge
   76user:file_search_path(cpacks,           cliopatria('.')).
   77
   78user:file_search_path(library,          cpacks(lib)).
   79user:file_search_path(rdf,              cpacks(rdf)).
   80user:file_search_path(entailment,       cpacks(entailment)).
   81user:file_search_path(components,       cpacks(components)).
   82user:file_search_path(applications,     cpacks(applications)).
   83user:file_search_path(api,              cpacks(api)).
   84user:file_search_path(user,             cpacks(user)).
   85user:file_search_path(config_available, cpacks('config-available')).
   86user:file_search_path(skin,             cpacks(skin)).
   87user:file_search_path(web,              cpacks(web)).
   88user:file_search_path(css,              web(css)).
   89user:file_search_path(icons,            web(icons)).
   90user:file_search_path(yui,              web('yui/2.7.0')).
   91user:file_search_path(js,               web(js)).
   92user:file_search_path(html,             web(html)).
   93user:file_search_path(help,             web(help)).
   94user:file_search_path(tutorial,         web(tutorial)).
   95user:file_search_path(flint,            web('FlintSparqlEditor/sparql')).
   96user:file_search_path(yasqe,            web('yasqe/dist')).
   97user:file_search_path(yasr,             web('yasr/dist')).
   98
   99
  100                 /*******************************
  101                 *           HTTP PATHS         *
  102                 *******************************/
  103
  104http:location(cliopatria,  root(.),            []).
  105http:location(web,         cliopatria(web),    []).
  106http:location(sesame,      root(servlets),     []).
  107http:location(sparql,      root(sparql),       []).
  108http:location(rdf_browser, cliopatria(browse), []).
  109http:location(flint,       cliopatria(flint),  []).
  110http:location(api,         cliopatria(api),    []).
  111http:location(json,        api(json),          []).
  112http:location(yasgui,      cliopatria(yasgui), []).
  113http:location(yasqe,       cliopatria(yasqe),  []).
  114http:location(yasr,        cliopatria(yasr),   []).
  115
  116                 /*******************************
  117                 *             TYPES            *
  118                 *******************************/
  119
  120%       make the type 'uri' work such  that   we  can  write NS:Local in
  121%       settings defaults.
  122
  123:- multifile
  124    error:has_type/2,
  125    settings:eval_default/3,
  126    settings:convert_text/3,
  127    http_settings:input_item/5.  128
  129error:has_type(uri, X) :-               % URI is an atom.  We do not use atom
  130    atom(X).                        % to allow for conversion
  131
  132                                        % Convert NS:Local
  133settings:eval_default(URI, uri, URI) :-
  134    atom(URI),
  135    !.
  136settings:eval_default(NS:Local, uri, URI) :-
  137    rdf_global_id(NS:Local, URI).
  138
  139settings:convert_text(uri, Text, URI) :-
  140    !,
  141    (   sub_atom(Text, B, _, A, :),
  142        sub_atom(Text, 0, B, _, NS),
  143        sub_atom(Text, _, A, 0, Local),
  144        identifier(NS),
  145        identifier(Local)
  146    ->  rdf_global_id(NS:Local, URI)
  147    ;   URI = Text
  148    ).
 identifier(+Atom) is semidet
True if Atom contains only alphanumerical characters or undercores.
To be done
- Must we support unicode here? Check with Turtle.
  157identifier(Text) :-
  158    atom_codes(Text, Codes),
  159    identifier_codes(Codes).
  160
  161identifier_codes([]).
  162identifier_codes([H|T]) :-
  163    identifier_code(H),
  164    identifier_codes(T).
  165
  166identifier_code(C) :-
  167    code_type(C, csym).
  168
  169                                        % Render as plain atom
  170http_settings:input_item(uri, Value, Name) -->
  171    html(input([name(Name), size(40), value(Value)])).
  172
  173
  174                 /*******************************
  175                 *             HTTP             *
  176                 *******************************/
  177
  178:- setting(http:port, any, env('PORT', 3020),
  179           'Port the http server listens to or interface:port').  180:- setting(http:workers, between(1, 20), env('PROLOG_HTTP_WORKERS', 5),
  181           'Number of server threads').  182:- setting(http:worker_options, list(any), [],
  183           'Additional options to pass to the HTTP server').  184:- setting(http:max_idle_time, nonneg, 3600,
  185           'Session timeout.  If 0, session never times out').  186:- setting(http:server_url, atom, 'http://localhost:'+setting(http:port),
  187           'Url of the server itself').  188:- if(\+current_setting(http:prefix)).  189:- setting(http:prefix, atom, '',
  190           'Prefix to rebase the server').  191:- endif.  192
  193
  194                 /*******************************
  195                 *      CLIOPATRIA SETTINGS     *
  196                 *******************************/
  197
  198:- setting(cliopatria:user_data, atom, 'users.db',
  199           'File holding account information').  200:- setting(cliopatria:enable_self_register, boolean, false,
  201           'Set to true to allow users to self register'). % using cpa_admin:add_user/1
  202:- setting(cliopatria:default_entailment, atom, rdfs,
  203           'Default entailment rules applied').  204:- setting(cliopatria:optimise_query, boolean, true,
  205           'Optimise queries before execution').  206:- setting(cliopatria:rdf_db_namespaces, boolean, true,
  207           'Allow registered namespaces in queries').  208:- setting(cliopatria:persistent_store, atom, '',
  209           'Directory for persistent copy of in-memory RDF').  210:- setting(cliopatria:pre_index_tokens, boolean, false,
  211           'Build the fulltext token index while loading').  212:- setting(cliopatria:pre_index_stems, boolean, false,
  213           'Build the fulltext stem index while loading').  214
  215
  216                 /*******************************
  217                 *        QUERY-SETTINGS        *
  218                 *******************************/
  219
  220:- setting(sparql:max_clients, nonneg, 100,
  221           'Maximum number of concurrent requests').  222:- setting(sparql:stack_size, nonneg, 1000,
  223           'Size of the global stack in mega-bytes').  224
  225                 /*******************************
  226                 *        BROWSE-SETTINGS       *
  227                 *******************************/
  228
  229:- setting(cpa_browse:resource_format, atom, nslabel,
  230           'Default resource_format passed to rdf_link//2').