forked from ClioPatria/ClioPatria
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parms.pl
217 lines (175 loc) · 7.26 KB
/
parms.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
/* Part of ClioPatria semantic web server
Author: Jan Wielemaker
E-mail: [email protected]
WWW: http://www.swi-prolog.org
Copyright (C): 2008-2014, 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(cp_parms,
[
]).
:- use_module(library(settings)).
:- use_module(library(semweb/rdf_db)).
:- use_module(library(http/html_write)).
:- use_module(library(http/http_hook)).
/** <module> 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:
* Web-locations can be modified externally using http:location/3
with an option priority(N), where N > 0. See http_absolute_location/3.
* Settings can be changed using set_setting_default/2.
@see run.pl[.in] contains an example startup script.
*/
/*******************************
* FILE PATHS *
*******************************/
:- multifile
user:file_search_path/2.
% ClioPatria specific ones
user:file_search_path(rdfql, cliopatria(rdfql)).
user:file_search_path(cpack, cliopatria(cpack)).
% Allow local file overwrites
user:file_search_path(web, web).
% Configuration
user:file_search_path(config_https, cp_application('config-enabled/https')).
% Package merge
user:file_search_path(cpacks, cliopatria('.')).
user:file_search_path(library, cpacks(lib)).
user:file_search_path(rdf, cpacks(rdf)).
user:file_search_path(entailment, cpacks(entailment)).
user:file_search_path(components, cpacks(components)).
user:file_search_path(applications, cpacks(applications)).
user:file_search_path(api, cpacks(api)).
user:file_search_path(user, cpacks(user)).
user:file_search_path(config_available, cpacks('config-available')).
user:file_search_path(skin, cpacks(skin)).
user:file_search_path(web, cpacks(web)).
user:file_search_path(css, web(css)).
user:file_search_path(icons, web(icons)).
user:file_search_path(yui, web('yui/2.7.0')).
user:file_search_path(js, web(js)).
user:file_search_path(html, web(html)).
user:file_search_path(help, web(help)).
user:file_search_path(tutorial, web(tutorial)).
user:file_search_path(flint, web('FlintSparqlEditor/sparql')).
user:file_search_path(yasqe, web('yasqe/dist')).
user:file_search_path(yasr, web('yasr/dist')).
/*******************************
* HTTP PATHS *
*******************************/
http:location(cliopatria, root(.), []).
http:location(web, cliopatria(web), []).
http:location(sesame, root(servlets), []).
http:location(sparql, root(sparql), []).
http:location(rdf_browser, cliopatria(browse), []).
http:location(flint, cliopatria(flint), []).
http:location(api, cliopatria(api), []).
http:location(json, api(json), []).
http:location(yasgui, cliopatria(yasgui), []).
http:location(yasqe, cliopatria(yasqe), []).
http:location(yasr, cliopatria(yasr), []).
/*******************************
* TYPES *
*******************************/
% make the type 'uri' work such that we can write NS:Local in
% settings defaults.
:- multifile
error:has_type/2,
settings:eval_default/3,
settings:convert_text/3,
http_settings:input_item/5.
error:has_type(uri, X) :- % URI is an atom. We do not use atom
atom(X). % to allow for conversion
% Convert NS:Local
settings:eval_default(URI, uri, URI) :-
atom(URI), !.
settings:eval_default(NS:Local, uri, URI) :-
rdf_global_id(NS:Local, URI).
settings:convert_text(uri, Text, URI) :- !,
( sub_atom(Text, B, _, A, :),
sub_atom(Text, 0, B, _, NS),
sub_atom(Text, _, A, 0, Local),
identifier(NS),
identifier(Local)
-> rdf_global_id(NS:Local, URI)
; URI = Text
).
%% identifier(+Atom) is semidet.
%
% True if Atom contains only alphanumerical characters or
% undercores.
%
% @tbd Must we support unicode here? Check with Turtle.
identifier(Text) :-
atom_codes(Text, Codes),
identifier_codes(Codes).
identifier_codes([]).
identifier_codes([H|T]) :-
identifier_code(H),
identifier_codes(T).
identifier_code(C) :-
code_type(C, csym).
% Render as plain atom
http_settings:input_item(uri, Value, Name) -->
html(input([name(Name), size(40), value(Value)])).
/*******************************
* HTTP *
*******************************/
:- setting(http:port, any, env('PORT', 3020),
'Port the http server listens to or interface:port').
:- setting(http:workers, between(1, 20), env('PROLOG_HTTP_WORKERS', 5),
'Number of server threads').
:- setting(http:worker_options, list(any), [],
'Additional options to pass to the HTTP server').
:- setting(http:max_idle_time, nonneg, 3600,
'Session timeout. If 0, session never times out').
:- setting(http:server_url, atom, 'http://localhost:'+setting(http:port),
'Url of the server itself').
:- if(\+current_setting(http:prefix)).
:- setting(http:prefix, atom, '',
'Prefix to rebase the server').
:- endif.
/*******************************
* CLIOPATRIA SETTINGS *
*******************************/
:- setting(cliopatria:user_data, atom, 'users.db',
'File holding account information').
:- setting(cliopatria:enable_self_register, boolean, false,
'Set to true to allow users to self register'). % using cpa_admin:add_user/1
:- setting(cliopatria:default_entailment, atom, rdfs,
'Default entailment rules applied').
:- setting(cliopatria:optimise_query, boolean, true,
'Optimise queries before execution').
:- setting(cliopatria:rdf_db_namespaces, boolean, true,
'Allow registered namespaces in queries').
:- setting(cliopatria:persistent_store, atom, '',
'Directory for persistent copy of in-memory RDF').
:- setting(cliopatria:pre_index_tokens, boolean, false,
'Build the fulltext token index while loading').
:- setting(cliopatria:pre_index_stems, boolean, false,
'Build the fulltext stem index while loading').
/*******************************
* QUERY-SETTINGS *
*******************************/
:- setting(sparql:max_clients, nonneg, 100,
'Maximum number of concurrent requests').
:- setting(sparql:stack_size, nonneg, 1000,
'Size of the global stack in mega-bytes').