1/* 2% =================================================================== 3% File 'mpred_db_preds.pl' 4% Purpose: Emulation of OpenCyc for SWI-Prolog 5% Maintainer: Douglas Miles 6% Contact: $Author: dmiles $@users.sourceforge.net ; 7% Version: 'interface.pl' 1.0.0 8% Revision: $Revision: 1.9 $ 9% Revised At: $Date: 2002/06/27 14:13:20 $ 10% =================================================================== 11% File used as storage place for all predicates which change as 12% the world is run. 13% 14% 15% Dec 13, 2035 16% Douglas Miles 17*/ 18%:- if(( ( \+ ((current_prolog_flag(logicmoo_include,Call),Call))) )). 19hide_this_mpred_at_box :- fail, nop( module(mpred_at_box,[ 20 assert_setting01/1, 21 make_module_name_local/2, 22 make_module_name_local0/2, 23 (make_shared_multifile)/1, 24 (make_shared_multifile)/3, 25 (make_shared_multifile)/4, 26 % (kb_global)/1, 27 add_import_predicate/3, 28 autoload_library_index/4, 29 ensure_abox/1, 30 baseKB_hybrid_support/2, 31 correct_module/3, 32 correct_module/5, 33 defaultAssertMt/1, 34 ensure_imports/1, 35 36 set_fileAssertMt/1, 37 setup_module_ops/1, 38 39 in_mpred_kb_module/0, 40 41 makeConstant/1, 42 mtCanAssert/1, 43 %registerCycPred/4, 44 %registerCycPred/5, 45 46 set_defaultAssertMt/1, 47 set_fileAssertMt/1, 48 transitive_path/3, 49 which_file/1, 50 user_m_check/1, 51 52 add_abox_module/1, 53 54 ensure_tbox/1, 55 get_file_type_local/2, 56 57 fixup_modules/0, 58 import_predicate/2, 59 skip_user/1, 60 inherit_into_module/2, 61 box_type/3, 62 make_reachable/2, 63 % clause_b/1, 64 fixup_module/2, 65 is_undefaulted/1, 66 ensure_imports_tbox/2, 67 map_inheritance/1, 68 69 70 which_file/1 71 ])). 72 73 74 75%:- endif. 76:- set_module(class(library)). 77 78:- module_transparent(( 79 baseKB_hybrid_support/2, 80 correct_module/3, 81 correct_module/5, 82 defaultAssertMt/1, 83 ensure_imports/1, 84 fileAssertMt/1, 85 86 in_mpred_kb_module/0)). 87 88:-dynamic(unused_predicate/4). 89 90:- include('mpred_header.pi'). 91:- flag_call(runtime_debug=false). 92 93:- set_how_virtualize_file(bodies). 94 95user_m_check(_Out). 96 97:- meta_predicate make_shared_multifile( , , ), mpred_op_each( ). 98:- meta_predicate make_shared_multifile( , , , ). 99 100 101:- meta_predicate transitive_path( , , ). 102 103% add_abox_module(baseKB):-!. 104add_abox_module(ABox):- must(atom(ABox)), 105 must(mtCanAssert(ABox)), 106 ABox:ain(baseKB:mtHybrid(ABox)). 107 108/* 109:- dynamic(baseKB:mtProlog/1). 110*/ 111 112:- kb_global(baseKB:mtNoPrologCode/1). 113baseKBmtNoPrologCode(mpred_userkb). 114 115:- kb_global(baseKB:mtProlog/1). 116baseKBmtProlog(Mt):- baseKB_mtProlog(Mt). 117 118baseKB_mtProlog(Mt):- \+ atom(Mt),!,var(Mt),!,current_module(Mt),baseKB:mtProlog(Mt). 119baseKB_mtProlog(Mt):- \+ current_module(Mt),!,fail. 120baseKB_mtProlog(Mt):- clause_b(mtHybrid(Mt)),!,fail. 121baseKB_mtProlog(Mt):- module_property(Mt,class(library)). 122baseKB_mtProlog(Mt):- module_property(Mt,class(system)). 123baseKB_mtProlog(Mt):- arg(_,v(lmcache,t_l,system),Mt). 124% baseKB_mtProlog(user). 125 126:- multifile(lmcache:has_pfc_database_preds/1). 127:- dynamic(lmcache:has_pfc_database_preds/1).
132assert_setting01(M:P):-safe_functor(P,_,A),dupe_term(P,DP),setarg(A,DP,_),system:retractall(M:DP),system:asserta(M:P). 133 134% :- break.
140which_file(F):- prolog_load_context(source,F) -> true; once(loading_source_file(F)). 141 142:- module_transparent 143 144 assert_setting01/1, 145 make_module_name_local/2, 146 make_module_name_local0/2, 147 148 defaultAssertMt/1, 149 set_defaultAssertMt/1, 150 with_no_retry_undefined/1, 151 which_file/1, 152 fileAssertMt/1, 153 set_fileAssertMt/1, 154 155 correct_module/3, 156 correct_module/5, 157 ensure_imports/1, 158 in_mpred_kb_module/0, 159 which_file/1, 160 user_m_check/1 .
167in_mpred_kb_module:- source_context_module(MT),defaultAssertMt(MT2),!,MT==MT2. 168 169 170map_inheritance(Child):-forall(import_module(Child,Parent),inherit_into_module(Child,Parent)).
177box_type(F,A,tbox):-current_predicate(baseKB:F/A). 178box_type(_,_,abox). 179 180 181 182 183:- thread_local(t_l:current_defaultAssertMt/1). 184:- dynamic(baseKB:file_to_module/2). 185 186 187 188 189 190 191% :- '$hide'(defaultAssertMt(_)).
198get_file_type_local(File,Type):-var(File),!,quietly_must(loading_source_file(File)),get_file_type_local(File,Type),!. 199get_file_type_local(File,pfc):-file_name_extension(_,'.pfc.pl',File),!. 200get_file_type_local(File,pfc):-file_name_extension(_,'.clif',File),!. 201get_file_type_local(File,Type):-file_name_extension(_,Type,File),!. 202get_file_type_local(File,Type):-clause_b(lmcache:mpred_directive_value(File,language,Type)). 203 204 205mtCanAssert(Module):- clause_b(mtNonAssertable(Module)),!,fail. 206mtCanAssert(ABox):- \+ \+ (ABox=abox),!,trace_or_throw_ex(mtCanAssert(ABox)),fail. 207mtCanAssert(Module):- clause_b(mtHybrid(Module)). 208mtCanAssert(user):- is_user_pfc. 209% mtCanAssert(Module):- clause_b(mtExact(Module)). 210mtCanAssert(Module):- module_property(Module,file(_)),!,fail. 211mtCanAssert(Module):- (loading_source_file(File),get_file_type_local(File,pfc),prolog_load_context(module,Module)). 212mtCanAssert(Module):- clause_b(mtProlog(Module)),!,fail. 213mtCanAssert(Module):- \+ pfc_lib:is_code_module(Module),!. 214 215is_user_pfc:- clause_b(mtHybrid(user)).
not just user modules
226fileAssertMt(M):- nonvar(M), fileAssertMt(ABoxVar),!,M=@=ABoxVar. 227fileAssertMt(M):- loading_source_file(File),clause_b(baseKB:file_to_module(File,M)),!. 228fileAssertMt(M):- loading_source_file(File),clause_b(lmcache:mpred_directive_value(File,module,M)),!. 229fileAssertMt(M):- fileAssertMt0(M), (source_location(_,_)->show_call(set_fileAssertMt(M));true). 230 231fileAssertMt0(M):- prolog_load_context(module,M),mtCanAssert(M),!. 232fileAssertMt0(M):- '$current_typein_module'(M),mtCanAssert(M),!. 233fileAssertMt0(M):- 'strip_module'(module,M,module),mtCanAssert(M),!. 234fileAssertMt0(M):- must(get_fallBackAssertMt(M)),!. 235 236 237:- initialization(fix_baseKB_imports,now).
245% set_fileAssertMt(M):- '$current_source_module'(M),!. 246set_fileAssertMt(M):- 247 ensure_abox(M), 248 sanity(mtCanAssert(M)), 249 must(which_file(File)), 250 assert_setting(baseKB:file_to_module(File,M)), 251 assert_setting(lmcache:mpred_directive_value(File,module,M)), 252 asserta_until_eof(t_l:current_defaultAssertMt(M)),!, 253 ((pfc_lib:is_pfc_file) -> must(set_current_modules_until_eof(M)) ; true). 254 255 256%:- import(pfc_lib:is_pfc_file/0). 257% :- '$hide'(set_fileAssertMt(_)). 258 259 260set_current_modules_until_eof(M):- 261 '$current_typein_module'(CM),'$set_typein_module'(M),call_on_eof('$set_typein_module'(CM)), 262 '$current_source_module'(SM),'$set_source_module'(M),call_on_eof('$set_source_module'(SM)).
269set_defaultAssertMt(M):- 270 ignore(show_failure(mtCanAssert(M))), 271 ensure_abox(M),!, 272 % assert_setting(t_l:current_defaultAssertMt(M)), 273 asserta_until_eof(t_l:current_defaultAssertMt(M)), 274 (source_location(_,_)-> ((fileAssertMt(M) -> true; set_fileAssertMt(M))) ;set_current_modules_until_eof(M)). 275 276% :- '$hide'(set_defaultAssertMt(_)).
not just user modules
287defaultAssertMt(M):- nonvar(M), defaultAssertMt(ABoxVar),!,M=@=ABoxVar. 288defaultAssertMt(M):- quietly(defaultAssertMt0(M)),!. 289 290defaultAssertMt0(M):- t_l:current_defaultAssertMt(M). 291defaultAssertMt0(M):- get_fallBackAssertMt(M),!. 292 293get_fallBackAssertMt(M):- loading_source_file(File),clause_b(baseKB:file_to_module(File,M)). 294get_fallBackAssertMt(M):- loading_source_file(File),clause_b(lmcache:mpred_directive_value(File,module,M)). 295get_fallBackAssertMt(M):- guess_maybe_assertMt(M),clause_b(mtHybrid(M)),!. 296get_fallBackAssertMt(M):- guess_maybe_assertMt(M),mtCanAssert(M),!. 297get_fallBackAssertMt(M):- guess_maybe_assertMt(M). 298 299guess_maybe_assertMt(M):- '$current_source_module'(M). 300guess_maybe_assertMt(M):- context_module(M). 301guess_maybe_assertMt(M):- loading_source_file(File),clause_b(baseKB:file_to_module(File,M)). 302guess_maybe_assertMt(M):- loading_source_file(File),clause_b(lmcache:mpred_directive_value(File,module,M)). 303guess_maybe_assertMt(M):- which_file(File)->current_module(M),module_property(M,file(File)),File\==M. 304guess_maybe_assertMt(M):- '$current_typein_module'(M). 305guess_maybe_assertMt(M):- nb_current(defaultQueryMt,M),!. 306guess_maybe_assertMt(M):- which_file(File)->make_module_name_local(File,M),current_module(M),File\==M. 307guess_maybe_assertMt(M):- (loading_source_file(File),get_file_type_local(File,pfc)),prolog_load_context(module,M). 308 309 310 311 312 313defaultQueryMt(M):- nonvar(M), defaultQueryMt(ABoxVar),!,M=@=ABoxVar. 314defaultQueryMt(M):- nb_current(defaultQueryMt,M)->true;(defaultQueryMt0(M)->nb_setval(defaultQueryMt,M)),!. 315 316 317defaultQueryMt0(M):- 'strip_module'(module,M,module),clause_b(mtHybrid(M)),!. 318defaultQueryMt0(M):- prolog_load_context(module,M),clause_b(mtHybrid(M)),!. 319defaultQueryMt0(M):- '$current_typein_module'(M),clause_b(mtHybrid(M)),!. 320defaultQueryMt0(M):- guess_maybe_assertMt(M),clause_b(mtHybrid(M)),!. 321defaultQueryMt0(M):- guess_maybe_assertMt(M),mtCanAssert(M),!. 322defaultQueryMt0(M):- guess_maybe_assertMt(M). 323 324 325 326 327 328 329 330% baseKB:mtGlobal 331% mtCore 332 333 334 335makeConstant(_Mt). 336 337is_pfc_module_file(M):- is_pfc_module_file(M,F,TF),!, (F \== (-)), TF = true. 338 339is_pfc_module_file(M,F,TF):- (module_property(M,file(F)),pfc_lib:is_pfc_file(F)) *-> TF=true ; 340 (module_property(M,file(F))*->TF=false ; (F= (-), TF=false)). 341 342maybe_ensure_abox(M):- is_pfc_module_file(M,F,_), (F \== (-)), !, 343 (pfc_lib:is_pfc_file(F)->show_call(pfc_lib:is_pfc_file(F),ensure_abox(M));dmsg_pretty(not_is_pfc_module_file(M,F))). 344maybe_ensure_abox(M):- show_call(not_is_pfc_file,ensure_abox(M)). 345 346 347:- module_transparent((ensure_abox)/1). 348ensure_abox(M):- 349 ignore(((M==user;M==baseKB)->true;nop(add_import_module(M,pfc_lib,end)))), 350 dynamic(M:defaultTBoxMt/1), 351 must(ensure_abox_support(M,baseKB)),!. 352:- module_transparent((ensure_abox_support)/2). 353ensure_abox_support(M,TBox):- clause_b(M:defaultTBoxMt(TBox)),!. 354ensure_abox_support(M,TBox):- 355 % asserta(M:defaultTBoxMt(TBox)), 356 set_prolog_flag(Munknown,error), 357 must(forall(mpred_database_term(F,A,_Type), 358 kb_shared(M:F/A))), 359 must(M:ain(TBox:mtHybrid(M))), 360 must(system:add_import_module(M,system,end)), 361 (M\==user->must(ignore(system:delete_import_module(M,user)));true),!, 362 must(setup_module_ops(M)),!. 363 364ensure_abox_support(M,TBox):- 365 % system:add_import_module(M,user,end), 366 must(ignore(system:delete_import_module(M,system))), 367 must(ignore(system:delete_import_module(M,baseKB))), 368 system:add_import_module(M,system,end), 369 retractall(M:defaultTBoxMt(TBox)), 370 throw(failed_ensure_abox_support(M,TBox)). 371 372 373 374 375setup_module_ops(M):- mpred_op_each(mpred_op_unless(M)). 376 377mpred_op_unless(M,A,B,C):- op_safe(A,B,M:C). 378 379mpred_op_each(OpEach):- 380 call(OpEach,1199,fx,('==>')), % assert 381 call(OpEach,1199,fx,('?->')), % ask 382 call(OpEach,1190,xfy,('::::')), % Name something 383 call(OpEach,1180,xfx,('==>')), % Forward chaining 384 call(OpEach,1170,xfx,('<==>')), % Forward and backward chaining 385 call(OpEach,1160,xfx,('<==')), % backward chain PFC sytle 386 call(OpEach,1160,xfx,('<-')), % backward chain PTTP sytle (currely really PFC) 387 call(OpEach,1160,xfx,('<=')), % backward chain DRA sytle 388 call(OpEach,1150,xfx,('=>')), % Logical implication 389 call(OpEach,1130,xfx,('<=>')), % Logical bi-implication 390 call(OpEach,600,yfx,('&')), 391 call(OpEach,600,yfx,('v')), 392 call(OpEach,400,fx,('~')), 393 % call(OpEach,300,fx,('-')), 394 call(OpEach,350,xfx,('xor')), 395 % replicate user:op/3s in case we remove inheritance 396 forall(current_op(X,Y,user:Z), 397 call(OpEach,X,Y,Z)). 398 399 400 401 402 403 404 405%:- multifile(get_current_default_tbox/1). 406%:- dynamic(get_current_default_tbox/1). 407%get_current_default_tbox(baseKB). 408:- if(current_predicate(get_current_default_tbox/1)). 409:- redefine_system_predicate(get_current_default_tbox/1). 410:- endif. 411:- module_transparent(get_current_default_tbox/1). 412get_current_default_tbox(TBox):- defaultAssertMt(ABox)->current_module(ABox)->clause(ABox:defaultTBoxMt(TBox),B),call(B),!. 413get_current_default_tbox(baseKB). 414:- sexport(get_current_default_tbox/1). 415 416 417 418 419 420make_module_name_local(A,B):- make_module_name_local0(A,B), \+ exists_file(B),!. 421 422make_module_name_local0(Source,KB):- clause_b(mtProlog(Source)),t_l:current_defaultAssertMt(KB),!. 423make_module_name_local0(Source,KB):- clause_b(mtGlobal(Source)),t_l:current_defaultAssertMt(KB),!. 424make_module_name_local0(Source,SetName):- clause_b(baseKB:file_to_module(Source,SetName)),!. 425make_module_name_local0(Source,Source):- lmcache:has_pfc_database_preds(Source). 426make_module_name_local0(Source,Source):- clause_b(mtHybrid(Source)),!. 427make_module_name_local0(user,KB):- t_l:current_defaultAssertMt(KB),!. 428make_module_name_local0(user,baseKB):-!. 429make_module_name_local0(Source,GetName):- make_module_name00(Source,GetName). 430 431 432ensure_tbox(_ABox).
439:- dynamic(baseKB:mtCore/1). 440baseKBmtCore(baseKB).
baseKB:mtGlobal(mpred_loader)
.
451:- dynamic(baseKB:mtGlobal/1). 452baseKBmtGlobal(boot_system). 453baseKBmtGlobal(system_markers). 454baseKBmtGlobal(system_singleValued). 455baseKBmtGlobal(system_genls). 456baseKBmtGlobal(system_if_missing). 457baseKBmtGlobal(common_logic_clif). 458baseKBmtGlobal(system_mdefault). 459 460:- dynamic(baseKB:mtCycLBroad/1). 461 462baseKBmtCycLBroad(baseKB). 463 464is_undefaulted(user). 465 466/* 467:- dynamic(call_a/0). 468call_a:- arity(tCol,1),arity(arity,2). 469:- must(((clause(call_a, 470 (ereq(arity(tCol,1)),ereq(arity(arity,2))),Ref),erase(Ref)))). 471*/
477ensure_imports(baseKB):-!. 478ensure_imports(M):- ain(genlMt(M,baseKB)). 479% ensure_imports(M):- ain(M:genlMt(M,baseKB)). 480 481:-multifile(lmcache:is_ensured_imports_tbox/2). 482:-dynamic(lmcache:is_ensured_imports_tbox/2).
489skip_user(Mt):- Mt==user,!. 490skip_user(Mt):- import_module(Mt,system), \+ default_module(Mt,user), !. 491skip_user(Mt):- add_import_module(Mt,system,start),ignore(delete_import_module(Mt,user)), 492 forall((import_module(Mt,X),default_module(X,user)),skip_user(X)). 493 494inherit_into_module(Child,Parent):- ==(Child,Parent),!. 495%TODO inherit_into_module(Child,Parent):- ain(Child:genlMt(Child,Parent)). 496inherit_into_module(Child,Parent):- ain(baseKB:genlMt(Child,Parent)).
502ensure_imports_tbox(M,TBox):- trace_or_throw_ex(unexpected_ensure_imports_tbox(M,TBox)), M==TBox,!. 503ensure_imports_tbox(M,TBox):- 504 lmcache:is_ensured_imports_tbox(M,TBox),!. 505ensure_imports_tbox(M,TBox):- 506 asserta(lmcache:is_ensured_imports_tbox(M,TBox)), 507 508 must(( 509 skip_user(TBox), 510 ignore(maybe_delete_import_module(M,TBox)), 511 ignore(maybe_delete_import_module(TBox,M)), 512 forall((user:current_predicate(_,TBox:P), 513 \+ predicate_property(TBox:P,imported_from(_))), 514 add_import_predicate(M,P,TBox)), 515 inherit_into_module(M,user), 516 skip_user(M), 517 ignore(maybe_delete_import_module(M,user)), 518 inherit_into_module(user,M), 519 ignore(maybe_delete_import_module(user,system)), % gets from M now 520 !)). 521 522 523 524% :- inherit_into_module(logicmoo_user,system). 525 526fixup_module(_,_):-!. 527fixup_module(system,_). 528fixup_module(M,_L):- clause_b(tGlobal(M)),skip_user(M). 529fixup_module(system,_L):-skip_user(system). 530fixup_module(_,[user]). 531fixup_module(M,_L):- skip_user(M). 532 533 534fixup_modules:- trace_or_throw_ex(unexpected(fixup_modules)), 535 doall((current_module(M),once((findall(I,import_module(M,I),L))),once(fixup_module(M,L)))). 536 537% :- autoload([verbose(false)]). 538:- flag_call(runtime_debug=true). 539 540% :- fixup_modules. 541 542 543 544 545 546 547 548% ============================================
554correct_module(M,G,T):-safe_functor(G,F,A),quietly_must(correct_module(M,G,F,A,T)),!.
560correct_module(abox,G,F,A,T):- !, defaultAssertMt(M),correct_module(M,G,F,A,T). 561correct_module(tbox,G,F,A,T):- !, get_current_default_tbox(M),correct_module(M,G,F,A,T). 562correct_module(user,G,F,A,T):- fail,!,defaultAssertMt(M),correct_module(M,G,F,A,T). 563 564correct_module(HintMt,Goal,F,A,OtherMt):-var(Goal),safe_functor(Goal,F,A),!,correct_module(HintMt,Goal,F,A,OtherMt). 565correct_module(HintMt,Goal,_,_,OtherMt):- predicate_property(HintMt:Goal,imported_from(OtherMt)). 566correct_module(_,Goal,_,_,OtherMt):- predicate_property(Goal,imported_from(OtherMt)). 567correct_module(HintMt,_,_,_,HintMt):- call_u(mtExact(HintMt)). 568correct_module(HintMt,Goal,_,_,HintMt):- predicate_property(HintMt:Goal,exported). 569correct_module(_,Goal,_,_,OtherMt):- var(OtherMt),!, predicate_property(OtherMt:Goal,file(_)). 570correct_module(_,Goal,_,_,OtherMt):- clause_b(mtGlobal(OtherMt)), predicate_property(OtherMt:Goal,file(_)). 571correct_module(MT,_,_,_,MT):-!. 572 573 574 575:- dynamic(lmcache:how_registered_pred/4). 576:- module_transparent(lmcache:how_registered_pred/4). 577 578add_import_predicate(Mt,Goal,OtherMt):- fail, 579 clause_b(mtGlobal(Mt)), 580 clause_b(mtGlobal(OtherMt)), 581 \+ import_module(OtherMt,Mt), 582 catch(add_import_module(Mt,OtherMt,end), 583 error(permission_error(add_import,module,baseKB), 584 context(system:add_import_module/3,'would create a cycle')),fail), 585 must(predicate_property(Mt:Goal,imported_from(OtherMt))),!. 586 587 588add_import_predicate(Mt,Goal,OtherMt):- trace_or_throw_ex(add_import_predicate(Mt,Goal,OtherMt)), 589 catch(Mt:import(OtherMt:Goal),_,fail),!. 590add_import_predicate(Mt,Goal,OtherMt):- 591 safe_functor(Goal,F,A), 592 make_as_dynamic(imported_from(OtherMt),Mt,F,A), 593 assert_if_new(( Mt:Goal :- OtherMt:Goal)). 594 595 596transitive_path(F,[Arg1,Arg2],Arg2):- 597 dif(Arg1,Arg2),call(F,Arg1,Arg2),!. 598transitive_path(F,[Arg1,SecondNodeMt|REST],Arg2):- 599 dif(Arg1,Arg2),dif(Arg1,SecondNodeMt), 600 call(F,Arg1,SecondNodeMt),sanity(stack_check), 601 transitive_path(F,[SecondNodeMt|REST],Arg2). 602 603 604 605autoload_library_index(F,A,PredMt,File):- safe_functor(P,F,A),'$autoload':library_index(P,PredMt,File). 606 607 608:- multifile(baseKB:hybrid_support/2). 609:- dynamic(baseKB:hybrid_support/2). 610baseKB_hybrid_support(F,A):-suggest_m(M),clause_b(baseKB:safe_wrap(M,F,A,_)). 611baseKB_hybrid_support(F,A):-clause_b(hybrid_support(F,A)). 612 613baseKBhybrid_support(predicateConventionMt,2). 614 615baseKBhybrid_support(functorDeclares,1). 616baseKBhybrid_support(arity,2). 617 618%baseKB:hybrid_support(spft,3). 619 620baseKBhybrid_support(mtHybrid,1). 621baseKBhybrid_support(mtCycLBroad,1). 622baseKBhybrid_support(genlMt,2). 623 624 625:- if(\+ exists_source(library(retry_undefined))). 626 627 628:- endif. 629 630 631%=
PredMt:MPI) (:-
638 context_module_of_file(CallerMt),!,
639 with_pfa_group(make_shared_multifile,CallerMt,PredMt, MPI),!.
646make_shared_multifile(CallerMt, PredMt,FA):- get_fa(FA,F,A), make_shared_multifile(CallerMt, PredMt,F,A),!. 647 CallerMt, t_l,F,A) (:-!,CallerMt:thread_local(t_l:F/A),CallerMt:multifile(t_l:F/A). 649% make_shared_multifile(CallerMt,baseKB ,F,A):-!,CallerMt:multifile(baseKB:F/A),CallerMt:dynamic(baseKB:F/A),!. 650make_shared_multifile(CallerMt,lmcache,F,A):-!,CallerMt:multifile(lmcache:F/A),CallerMt:volatile(lmcache:F/A),CallerMt:dynamic(lmcache:F/A),!. 651 652make_shared_multifile(CallerMt,PredMt,F,A):- 653 safe_functor(Goal,F,A), 654 correct_module(PredMt,Goal,F,A,HomeM), 655 HomeM\==PredMt,!, 656 make_shared_multifile(CallerMt,HomeM,F,A). 657 658make_shared_multifile(CallerMt,Home,F,A):- clause_b(mtProlog(Home)),!, 659 wdmsg_pretty(mtSharedPrologCodeOnly_make_shared_multifile(CallerMt,Home:F/A)),!. 660 661make_shared_multifile(_CallerMt, baseKB,F,A):- kb_global(baseKB:F/A),!. 662 663make_shared_multifile(_CallerMt,PredMt,F,A):-!, 664 dmsg_pretty(make_shared_multifile(PredMt:F/A)), 665 locally(set_prolog_flag(access_level,system), 666 PredMt:( 667 sanity( \+ ((PredMt:F/A) = (qrTBox:p/1))), 668 PredMt:check_never_assert(declared(PredMt:F/A)), 669 decl_mpred(PredMt:F/A))).
678make_reachable(_,Test):- \+ \+ ((Test= (_:F/_), is_ftVar(F))),!. 679make_reachable(CM,M:F/A):- atom(CM),ignore(CM=M),quietly_must(atom(CM)),quietly_must(atom(M)), 680 safe_functor(G,F,A), 681 correct_module(M,G,F,A,TT), !,import_predicate(CM,TT:F/A).
689import_predicate(CM,M:_):- CM==M,!. 690import_predicate(CM,M:_):- default_module(CM,M),!. 691import_predicate(CM,M:F/A):- show_call(nop(CM:z333import(M:F/A))),CM:multifile(M:F/A), 692 on_xf_cont(CM:discontiguous(M:F/A)). 693 694 695 696/* 697system:call_expansion(T,(mpred_at_box:defaultAssertMt(NewVar),NewT)):- current_predicate(_,get_lang(pfc)), compound(T), 698 subst(T,abox,NewVar,NewT),NewT\=@=T. 699 700system:body_expansion(T,(mpred_at_box:defaultAssertMt(NewVar),NewT)):- current_predicate(_,get_lang(pfc)), compound(T), 701 subst(T,abox,NewVar,NewT),NewT\=@=T. 702*/ 703 704 705:- fixup_exports.