1#!/usr/local/bin/swipl 
    2
    3:- module(logicmoo_cliop,
    4          [ start_cliop/0
    5          ]).    6
    7:- use_module(library(http/thread_httpd)).    8:- use_module(library(http/http_dispatch)).    9:- use_module(library(http/http_path)).   10:- use_module(library(www_browser)).   11:- if(exists_source(library(uid))).   12:- use_module(library(uid)).   13:- endif.

Isolated startup module for ClioPatria

*/

   21:- use_module(library(must_trace)).   22
   23:- multifile(owl2_model:datatype/1).   24:- dynamic(owl2_model:datatype/1).   25
   26:- if(false).   27
   28
   29
   30:- multifile(owl2_model:datatype/2).   31:- dynamic(owl2_model:datatype/2).   32
   33
   34
   35from_http(G):- with_output_to(main_error,G).
   36
   37:- meta_predicate(from_http(0)).   38
   39
   40reexport_from(ReExporter,From:P):-
   41    From:export(From:P),
   42    ReExporter:import(From:P),
   43    ReExporter:export(From:P).
   44
   45
   46
   47:- if(exists_source(library(trill))).   48
   49:- system:use_module(library(trill)).   50
   51:- reexport_from(system,trill:end_bdd/1),
   52   reexport_from(system,trill:add_var/5),
   53   reexport_from(system,trill:and/4),
   54   reexport_from(system,trill:em/8),
   55   reexport_from(system,trill:randomize/1),
   56   reexport_from(system,trill:rand_seed/1),
   57   reexport_from(system,trill:or/4),
   58   reexport_from(system,trill:ret_prob/3),
   59   reexport_from(system,trill:init_test/2),
   60   reexport_from(system,trill:end/1),
   61   reexport_from(system,trill:end_test/1),
   62   reexport_from(system,trill:bdd_not/3),
   63   reexport_from(system,trill:zero/2),
   64   reexport_from(system,trill:one/2),
   65   reexport_from(system,trill:equality/4),
   66   reexport_from(system,trill:init_bdd/2),
   67   reexport_from(system,trill:init/3).   68
   69:- dynamic(user:db/1).   70:- thread_local(user:db/1).   71
   72:- use_module(library(pita),[]).   73
   74
   75% :- [pack(trill_on_swish/src/lib/authenticate)].
   76% :- use_module(library(r/r_sandbox)).
   77
   78
   79
   80:- use_module(library(aleph),[]).   81:- add_search_path_safe(swish, '/home/prologmud_server/lib/swipl/pack/swish').   82:- use_module(library(cplint_r),[]).   83:- use_module(library(mcintyre)).   84:- use_module(library(slipcover)).   85:- use_module(library(lemur),[]).   86:- use_module(library(auc)).   87:- use_module(library(matrix)).   88
   89:- use_module(library(clpr)).   90
   91:- endif.   92
   93:- multifile sandbox:safe_primitive/1.   94
   95
   96sandbox:safe_primitive(nf_r:{_}).
   97:- dynamic http:location/3.   98:- multifile http:location/3.   99http:location(root, '/', [priority(1100)]).
  100http:location(swish, root('swish'), [priority(500)]).
  101% http:location(root, '/swish', []).
  102
  103
  104:- endif.  105
  106:- dmsg("CLIOP Load").  107
  108start_cliop :- 
  109   dmsg("CLIOP Start"),
  110   cp_server.
  111
  112
  113%:- initialization(start_cliop).
  114
  115/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  116This file provides a skeleton startup file.  It can be localized by running
  117
  118    % ./configure                       (Unix)
  119    % Double-clicking win-config.exe    (Windows)
  120
  121After  that,  the  system  may  be  customized  by  copying  or  linking
  122customization  files  from  config-available    to  config-enabled.  See
  123config-enabled/README.txt for details.
  124
  125To run the system, do one of the following:
  126
  127    * Running for development
  128      Run ./run.pl (Unix) or open run.pl by double clicking it (Windows)
  129
  130    * Running as Unix daemon (service)
  131      See daemon.pl
  132- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  133
  134% Setup search path for cliopatria. We add  both a relative and absolute
  135% path. The absolute path allow us to  start in any directory, while the
  136% relative one ensures that the system remains working when installed on
  137% a device that may be mounted on a different location.
  138
  139add_relative_search_path(Alias, Rel):- 
  140    absolute_file_name(Rel, Real,[file_type(directory),access(read),file_errors(fail)]),
  141    add_relative_search_path0(Alias, Real),!.
  142
  143add_relative_search_path0(Alias, Abs) :-
  144        is_absolute_file_name(Abs), 
  145        exists_directory(Abs),
  146        assertz(user:file_search_path(Alias, Abs)),fail.
  147add_relative_search_path0(Alias, Abs) :-
  148        is_absolute_file_name(Abs), 
  149        prolog_load_context(file, Here),
  150        relative_file_name(Abs, Here, Rel),
  151        assertz(user:file_search_path(Alias, Rel)),fail.
  152add_relative_search_path0(Alias, Rel) :-
  153        assertz(user:file_search_path(Alias, Rel)).
  154
  155
  156% Make loading files silent. Comment if you want verbose loading.
  157
  158:- current_prolog_flag(verbose, Verbose),
  159   asserta(saved_verbose(Verbose)),
  160   set_prolog_flag(verbose, silent).  161
  162:- add_relative_search_path(cliopatria, pack('ClioPatria')).  163% :- add_relative_search_path(cpacks, 'cpack').
  164
  165
  166% :- use_module(library(cplint_r)).
  167
  168
  169                 /*******************************
  170                 *            LOAD CODE         *
  171                 *******************************/
  172
  173% Use the ClioPatria help system.  May   be  commented to disable online
  174% help on the source-code.
  175
  176
  177
  178:- use_module(cliopatria('applications/help/load')).  179
  180
  181% Load ClioPatria itself.  Better keep this line.
  182
  183:- use_module(cliopatria(cliopatria)).  184
  185:- listing(user:file_search_path/2).  186
  187% Get back normal verbosity of the toplevel.
  188
  189:- (   retract(saved_verbose(Verbose))
  190   ->  set_prolog_flag(verbose, Verbose)
  191   ;   true
  192   ).  193
  194
  195
  196:- if(exists_source(rdfql(sparql_csv_result))).  197:- use_module(rdfql(sparql_csv_result)).  198:- endif.  199
  200cliop_restore :- app_argv('--nocliop'),!.
  201cliop_restore :- must(start_cliop).
  202                     
  203:- initialization(cliop_restore).  204:- initialization(cliop_restore,now).  205:- initialization(cliop_restore,restore).  206
  207
  208/*
  209:- ['./cpack/trill_on_swish/lib/trill_on_swish/storage_trill_on_swish'].
  210:- ['./cpack/trill_on_swish/lib/trill_on_swish/gitty_trill_on_swish'].
  211*/