flora-commits Mailing List for Flora-2
Brought to you by:
kifer
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(59) |
Jun
(43) |
Jul
(4) |
Aug
(4) |
Sep
(102) |
Oct
(20) |
Nov
(47) |
Dec
(32) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(24) |
Feb
(34) |
Mar
(72) |
Apr
(36) |
May
(10) |
Jun
(46) |
Jul
(36) |
Aug
(24) |
Sep
(37) |
Oct
(27) |
Nov
(43) |
Dec
(40) |
| 2004 |
Jan
(35) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(30) |
Aug
(83) |
Sep
(68) |
Oct
(38) |
Nov
(3) |
Dec
(7) |
| 2005 |
Jan
(9) |
Feb
(31) |
Mar
(46) |
Apr
(73) |
May
(21) |
Jun
(1) |
Jul
(32) |
Aug
(33) |
Sep
(3) |
Oct
(28) |
Nov
(4) |
Dec
(23) |
| 2006 |
Jan
(22) |
Feb
(2) |
Mar
(12) |
Apr
(23) |
May
(73) |
Jun
(14) |
Jul
|
Aug
(20) |
Sep
(14) |
Oct
(5) |
Nov
|
Dec
(14) |
| 2007 |
Jan
(54) |
Feb
(81) |
Mar
(286) |
Apr
(313) |
May
(154) |
Jun
(85) |
Jul
(8) |
Aug
(11) |
Sep
(12) |
Oct
(14) |
Nov
(6) |
Dec
(6) |
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(12) |
May
(4) |
Jun
|
Jul
(13) |
Aug
(22) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(46) |
Jun
(43) |
Jul
(46) |
Aug
(9) |
Sep
(13) |
Oct
(31) |
Nov
(42) |
Dec
(18) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(11) |
Apr
(13) |
May
(16) |
Jun
(6) |
Jul
(17) |
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
|
Feb
(17) |
Mar
(4) |
Apr
(3) |
May
(2) |
Jun
(3) |
Jul
(2) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
|
|
2
|
3
(2) |
4
(2) |
5
|
6
|
7
|
8
|
|
9
|
10
(9) |
11
|
12
|
13
|
14
(8) |
15
|
|
16
|
17
|
18
(3) |
19
|
20
|
21
(13) |
22
(2) |
|
23
(2) |
24
(6) |
25
(4) |
26
(7) |
27
(8) |
28
(5) |
29
|
|
30
(1) |
31
|
|
|
|
|
|
|
From: <ki...@us...> - 2003-03-30 22:44:59
|
Update of /cvsroot/flora/flora2
In directory sc8-pr-cvs1:/tmp/cvs-serv19314
Modified Files:
flrwrapper.P flrwrapper.H
Log Message:
added caching to flora_decode_predicate and flora_module_predicate to speed up
various operations.
Index: flrwrapper.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrwrapper.P,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- flrwrapper.P 27 Mar 2003 11:47:47 -0000 1.15
+++ flrwrapper.P 30 Mar 2003 22:44:55 -0000 1.16
@@ -38,16 +38,16 @@
Flora user module.
*****************************************************************************/
flora_user_module_predicate(Functor,Args,WS,Predicate) :-
- flora_decode_pred(Functor,Args,WS,user,Predicate),
+ flora_encoded_call_cache(Functor,Args,WS,user,Predicate),
!.
flora_user_module_predicate(Functor,Args,WS,Predicate) :-
flora_concat_atoms([FLORA_USER_MODULE_PREFIX,'''',WS,'''',Functor],PF),
Predicate =.. [PF|Args],
- length(Args,Arity),
- length(NewArgs,Arity),
- PredTemplate =.. [PF|NewArgs],
- assert(flora_decode_pred(Functor,NewArgs,WS,user,PredTemplate)).
+ functor(Predicate,_,Arity),
+ length(NewArgsTempl,Arity),
+ PredTemplate =.. [PF|NewArgsTempl],
+ assert(flora_encoded_call_cache(Functor,NewArgsTempl,WS,user,PredTemplate)).
/*****************************************************************************
flora_system_module_predicate(+Functor,+Args,+SysModID,-Predicate)
@@ -57,16 +57,16 @@
to a Flora system module.
*****************************************************************************/
flora_system_module_predicate(Functor,Args,SysModID,Predicate) :-
- flora_decode_pred(Functor,Args,SysModID,system,Predicate),
+ flora_encoded_call_cache(Functor,Args,SysModID,system,Predicate),
!.
flora_system_module_predicate(Functor,Args,SysModID,Predicate) :-
flora_concat_atoms([FLORA_SYSTEM_MODULE_PREFIX,'''',SysModID,'''',Functor],PF),
Predicate =.. [PF|Args],
- length(Args,Arity),
- length(NewArgs,Arity),
- PredTemplate =.. [PF|NewArgs],
- assert(flora_decode_pred(Functor,NewArgs,SysModID,system,PredTemplate)).
+ functor(Predicate,_,Arity),
+ length(NewArgsTempl,Arity),
+ PredTemplate =.. [PF|NewArgsTempl],
+ assert(flora_encoded_call_cache(Functor,NewArgsTempl,SysModID,system,PredTemplate)).
/*****************************************************************************
flora_module_predicate(+Functor,+Args,+ModuleName,-Predicate)
@@ -77,10 +77,12 @@
It fails if the input is not a valid Flora module name. It is used for
either F-logic or HiLog wrapper predicates.
*****************************************************************************/
-%% Tabling this expensive predicate can speed up dynamic module calls
-%% like foo@X
-:- table flora_module_predicate/4.
-
+%% Cached predicate: although flora_user_module_predicate and
+%% flora_system_module_predicate are cached, we cache this one also, to speed
+%% up meta-ops
+flora_module_predicate(Functor,Args,ModuleName,Predicate) :-
+ flora_encoded_call_cache(Functor,Args,ModuleName,Predicate),
+ !.
flora_module_predicate(Functor,Args,ModuleName,Predicate) :-
flora_module_name(ModuleName,Type,WS),
!,
@@ -90,8 +92,13 @@
; Type == systemmodule ->
flora_system_module_predicate(Functor,Args,WS,Predicate)
;
- fail
- ).
+ fail
+ ),
+ %% Cache the call
+ functor(Predicate,_,Arity),
+ length(ArgsTempl,Arity),
+ flora_encoded_call_cache(Functor,ArgsTempl,WS,_,PredTempl),
+ assert(flora_encoded_call_cache(Functor,ArgsTempl,ModuleName,PredTempl)).
/*****************************************************************************
@@ -463,8 +470,12 @@
ArgsList=[]. In (3), PredicateSymbol=[] and ArgsList=[].
*****************************************************************************/
-%% This is an expensive predicate -- table it
-:- table flora_decode_predicate/6.
+%% This predicate is cached
+flora_decode_predicate(Predicate,PredicateType,ModuleName,
+ WrapPrefix,PredicateSymbol,ArgsList) :-
+ flora_decoded_predicate_cache(Predicate,PredicateType,ModuleName,
+ WrapPrefix,PredicateSymbol,ArgsList),
+ !.
flora_decode_predicate(Predicate,PredicateType,ModuleName,
WrapPrefix,PredicateSymbol,ArgsList) :-
@@ -490,12 +501,11 @@
!,
( Wrapper == WRAP_HILOG ->
%% a HiLog Predicate
- PredicateType=hilog,
+ PredicateType = (hilog),
( Args=[PredicateSymbol|ArgsList] ->
true
;
- PredicateSymbol=[],
- ArgsList=[]
+ flora_abort([flora_decode_predicate, ': A zero-ary HiLog wrapper encountered - a possible FLORA-2 bug'])
)
;
%% either an F-logic wrapper or Flora system wrapper predicate
@@ -515,14 +525,33 @@
%% a Flora builtin predicate, like difobjeql/2
PredicateType = (flora)
)
- ).
+ ),
+ %% Cache the resuult in the most general form
+ functor(Predicate,PredFunctor,Arity),
+ length(OldArgsTempl,Arity),
+ (PredicateType == (hilog)
+ %% OldArgsTempl = [] is impossible: a flora_abort would be issued first
+ -> OldArgsTempl = [PredicateSymbol|NewArgsTempl]
+ ; NewArgsTempl = OldArgsTempl
+ ),
+ PredTemplate =.. [PredFunctor|OldArgsTempl],
+ assert(flora_decoded_predicate_cache(PredTemplate,PredicateType,
+ ModuleName,WrapPrefix,
+ PredicateSymbol,NewArgsTempl)).
flora_decode_predicate(Predicate,PredicateType,_ModuleName,
_WrapPrefix,PredicateSymbol,ArgsList) :-
PredicateType = prolog,
%% prolog catches all other cases.
Predicate =.. [PredicateSymbol|ArgsList],
- !.
+ !,
+ %% Cache the resuult in the most general form
+ functor(Predicate,_,Arity),
+ length(NewArgsTempl,Arity),
+ PredTemplate =.. [PredicateSymbol|NewArgsTempl],
+ assert(flora_decoded_predicate_cache(PredTemplate,PredicateType,
+ _ModuleName,_WrapPrefix,
+ PredicateSymbol,NewArgsTempl)).
/*****************************************************************************
Index: flrwrapper.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrwrapper.H,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- flrwrapper.H 27 Mar 2003 11:47:47 -0000 1.10
+++ flrwrapper.H 30 Mar 2003 22:44:56 -0000 1.11
@@ -33,7 +33,9 @@
:- dynamic flora_flogic_fact_wrapper(_,_).
:- dynamic flora_current_flogic_module(_).
-:- dynamic flora_decode_pred(_,_,_,_,_).
+:- dynamic flora_encoded_call_cache(_,_,_,_,_).
+:- dynamic flora_encoded_call_cache(_,_,_,_).
+:- dynamic flora_decoded_predicate_cache(_,_,_,_,_,_).
:- index(flora_flogic_fact_wrapper/2,trie).
:- index(flora_current_flogic_module/1,trie).
|
|
From: <ki...@us...> - 2003-03-28 18:31:55
|
Update of /cvsroot/flora/flora2/genincludes In directory sc8-pr-cvs1:/tmp/cvs-serv1552/genincludes Modified Files: flrpatch.fli Log Message: replace "normal" in the rule dump spec with the more self-explanatory "fdb" Index: flrpatch.fli =================================================================== RCS file: /cvsroot/flora/flora2/genincludes/flrpatch.fli,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- flrpatch.fli 8 Dec 2002 09:45:32 -0000 1.5 +++ flrpatch.fli 28 Mar 2003 18:31:49 -0000 1.6 @@ -91,24 +91,24 @@ :- WRAP_STORAGE(rule(WRAP_HILOG/20,WRAP_HILOG)). :- WRAP_STORAGE(rule(WRAP_HILOG/21,WRAP_HILOG)). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/1,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/2,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/3,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/4,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/5,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/6,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/7,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/8,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/9,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/1,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/11,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/12,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/13,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/14,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/15,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/16,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/17,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/18,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/19,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/20,WRAP_HILOG,normal,leading([0]))). -:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/21,WRAP_HILOG,normal,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/1,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/2,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/3,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/4,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/5,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/6,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/7,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/8,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/9,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/1,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/11,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/12,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/13,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/14,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/15,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/16,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/17,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/18,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/19,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/20,WRAP_HILOG,fdb,leading([0]))). +:- WRAP_STORAGE(rule(WRAP_TABLED_HILOG/21,WRAP_HILOG,fdb,leading([0]))). |
|
From: <ki...@us...> - 2003-03-28 18:31:55
|
Update of /cvsroot/flora/flora2
In directory sc8-pr-cvs1:/tmp/cvs-serv1552
Modified Files:
flrwraparound.P
Log Message:
replace "normal" in the rule dump spec with the more self-explanatory "fdb"
Index: flrwraparound.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrwraparound.P,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- flrwraparound.P 25 Mar 2003 04:01:24 -0000 1.8
+++ flrwraparound.P 28 Mar 2003 18:31:49 -0000 1.9
@@ -242,7 +242,7 @@
%% A storage rule looks like this: rule(head-predicate/arity,body-predicate)
dump_storage_rule(rule(HeadSpec,TailPred)) :-
- dump_storage_rule(rule(HeadSpec,TailPred,normal)).
+ dump_storage_rule(rule(HeadSpec,TailPred,fdb)).
dump_storage_rule(rule(HeadSpec,TailPred,Storage)) :-
dump_storage_rule(rule(HeadSpec,TailPred,Storage,no_leading)).
@@ -254,7 +254,7 @@
( Storage=fld,
write('flora_db_find_base(FLORA_THIS_FLD_STORAGE,')
;
- Storage=normal,
+ Storage=fdb,
write('flora_db_find_base(FLORA_THIS_FDB_STORAGE,')
),
%% attach tail's functor to Head's variables
|
Update of /cvsroot/flora/flora2/syslib
In directory sc8-pr-cvs1:/tmp/cvs-serv4209/syslib
Modified Files:
flrshdirect.P flrdynrule.P flrdbop.P flrbtdbop.P NMakefile.mak
Makefile
Added Files:
flrstorageutils.P
Removed Files:
flrstorage.P
Log Message:
renamed syslib/flrstorage.P to syslib/flrstorageutils.P
--- NEW FILE: flrstorageutils.P ---
/* File: flrstorageutils.P
**
** Author(s): Guizhen Yang
**
** Contact: flo...@li...
**
** Copyright (C) The Research Foundation of SUNY, 1999-2001
**
** FLORA-2 is free software; you can redistribute it and/or modify it under the
** terms of the GNU Library General Public License as published by the Free
** Software Foundation; either version 2 of the License, or (at your option)
** any later version.
**
** FLORA-2 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 Library General Public License for
** more details.
**
** You should have received a copy of the GNU Library General Public License
** along with FLORA-2; if not, write to the Free Software Foundation,
** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
**
*/
:- compiler_options([xpp_on]).
#include "flora_terms.flh"
#include "flora_porting.flh"
#include "flora_exceptions.flh"
:- import
flora_error_heading/0,
flora_stderr_string/1,
flora_stderr_nl/0
from flrprint.
:- import flora_display_error/1 from flrdisplay.
:- import flora_module_registry/1 from flrregistry.
:- import
flora_module_name/3,
flora_module_name_error/1,
flora_fdb_storage_name/2,
flora_decode_module_name/2,
flora_module_predicate/4
from flrwrapper.
:- import flora_abort/0, flora_abort/1 from flrutils.
:- import
FLSYSDBUPDATE/2,
FLSYSDBUPDATE/3,
FLLIBMODLIT/3,
FLLIBMODOBJ/4
from usermod.
:- import
flora_db_find_base/2
from flrstoragebase.
:- export
flora_storage_check_module_name/1,
flora_storage_check_existence/1,
flora_storage_check_deletepredicate/2,
flora_storage_convertlist/3,
flora_storage_is_negation_symbol/1.
/*****************************************************************************
flora_storage_check_module_name(+ModuleName)
The procedure is called to checks if a module name is valid during an update
operation. Note that updating a Flora system module is not allowed.
*****************************************************************************/
flora_storage_check_module_name(ModuleName) :-
flora_module_name(ModuleName,Type,WS),
!,
( Type == invalid ->
flora_module_name_error(ModuleName)
; Type == systemmodule ->
flora_abort(['Updates to system modules (',WS,') are not allowed'])
;
true
),
flora_storage_check_existence(WS).
/*****************************************************************************
flora_storage_check_existence(+ModuleName)
The procedure is called to checks if a module is loaded.
*****************************************************************************/
flora_storage_check_existence(ModuleName) :-
( flora_module_registry(ModuleName) ->
true
;
flora_abort(['Module ',ModuleName,' does not exist'])
).
/*****************************************************************************
flora_storage_check_deletepredicate(+P,-UpdateStruct)
It is used to call a predicate in the list of literals to be deleted.
It supports the meta-programming feature of delete where a variable is
used to pass the predicate.
Note: If the variable is bound to a conjunction, then it will be broken up
accordingly into a nested list structure. This feature is defferent
from Prolog which does not treat conjunction any diferently from
other builtin predicates. However, deletion of disjunction or negation
is not allowed.
*****************************************************************************/
flora_storage_check_deletepredicate(P,_UpdateStruct) :-
var(P),
!,
flora_abort('Uninstantiated argument in DELETE operation').
flora_storage_check_deletepredicate(','(C1,C2),[P1,P2]) :-
!,
%% Break up conjunction, although deletion of conjunction is not
%% allowed in XSB.
flora_storage_check_deletepredicate(C1,P1),
flora_storage_check_deletepredicate(C2,P2).
flora_storage_check_deletepredicate(P,FLSYSDBUPDATE(P,StorageName)) :-
%% This is a meta programming feature.
functor(P,F,N),
( flora_decode_module_name(F,ModuleName) ->
flora_storage_check_module_name(ModuleName),
flora_fdb_storage_name(ModuleName,StorageName),
flora_db_find_base(StorageName,P)
; N == 2, F == ';' ->
flora_abort('Deletion of disjunction is not allowed')
; N == 1, flora_storage_is_negation_symbol(F) ->
flora_abort('Deletion of negated facts is not allowed')
;
flora_error_heading,
flora_stderr_string('Deletion of '),
( F == WRAP_HILOG ->
flora_stderr_string('HiLog term ')
;
flora_stderr_string('Prolog term ')
),
flora_display_error(P),
flora_stderr_string(' is not allowed!'),
flora_stderr_nl,
flora_abort
).
/*****************************************************************************
flora_storage_convertlist(+List,-CallList,-FactList)
*****************************************************************************/
flora_storage_convertlist([],[],[]) :- !.
flora_storage_convertlist([P|Fs],
[flora_storage_check_deletepredicate(P,UpdateStruct)|CL],
[UpdateStruct|FL]) :-
var(P),
!,
%% This is a meta-programming feature.
flora_storage_convertlist(Fs,CL,FL).
flora_storage_convertlist([FLSYSDBUPDATE(P,StorageName,Module)|Fs],
[flora_db_find_base(StorageName,P)|CL],
[FLSYSDBUPDATE(P,StorageName)|FL]) :-
!,
flora_storage_check_existence(Module),
flora_storage_convertlist(Fs,CL,FL).
flora_storage_convertlist([FLLIBMODLIT(F,Args,ModuleName)|Fs],
[flora_storage_check_module_name(ModuleName),
flora_module_predicate(F,Args,ModuleName,P),
flora_fdb_storage_name(ModuleName,StorageName),
flora_db_find_base(StorageName,P)|CL
],
[FLSYSDBUPDATE(P,StorageName)|FL]) :-
!,
flora_storage_convertlist(Fs,CL,FL).
flora_storage_convertlist([FLLIBMODOBJ(F,Args,ModuleName,O)|Fs],
[( flora_check_module_name(ModuleName) ->
flora_module_predicate(F,Args,ModuleName,O)
;
flora_abort
)|CL],
FL) :-
!,
flora_storage_convertlist(Fs,CL,FL).
flora_storage_convertlist([P|Fs],
[flora_storage_check_deletepredicate(P,UpdateStruct)|CL],
[UpdateStruct|FL]) :-
%% This is a meta-programming feature.
flora_storage_convertlist(Fs,CL,FL).
/*****************************************************************************
flora_storage_is_negation_symbol(+Functor)
*****************************************************************************/
flora_storage_is_negation_symbol('\+').
flora_storage_is_negation_symbol(not).
flora_storage_is_negation_symbol(tnot).
flora_storage_is_negation_symbol(FLORA_TNOT_PREDICATE).
Index: flrshdirect.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrshdirect.P,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- flrshdirect.P 26 Mar 2003 17:30:34 -0000 1.8
+++ flrshdirect.P 28 Mar 2003 06:35:53 -0000 1.9
@@ -37,7 +37,7 @@
:- import flora_shdefine_arguments/3 from flrarguments.
-:- import flora_storage_check_module_name/1 from flrstorage.
+:- import flora_storage_check_module_name/1 from flrstorageutils.
:- import
flora_dyna_hilog_user_module_predicate_symbol/2,
Index: flrdynrule.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrdynrule.P,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- flrdynrule.P 27 Mar 2003 11:44:14 -0000 1.8
+++ flrdynrule.P 28 Mar 2003 06:35:53 -0000 1.9
@@ -68,7 +68,7 @@
from flrhilogtable.
:- import
flora_storage_check_module_name/1
- from flrstorage.
+ from flrstorageutils.
:- import
get_canonical_form/2
from flrcanon.
Index: flrdbop.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrdbop.P,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- flrdbop.P 26 Mar 2003 17:30:32 -0000 1.8
+++ flrdbop.P 28 Mar 2003 06:35:53 -0000 1.9
@@ -51,7 +51,7 @@
flora_storage_convertlist/3,
flora_storage_is_negation_symbol/1,
flora_storage_check_existence/1
- from flrstorage.
+ from flrstorageutils.
:- import
flora_db_find_base/2,
Index: flrbtdbop.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrbtdbop.P,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- flrbtdbop.P 26 Mar 2003 17:30:31 -0000 1.8
+++ flrbtdbop.P 28 Mar 2003 06:35:53 -0000 1.9
@@ -51,7 +51,7 @@
flora_storage_convertlist/3,
flora_storage_is_negation_symbol/1,
flora_storage_check_existence/1
- from flrstorage.
+ from flrstorageutils.
:- import
flora_db_insert_base_bt/2,
Index: NMakefile.mak
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/NMakefile.mak,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- NMakefile.mak 23 Feb 2003 08:25:55 -0000 1.5
+++ NMakefile.mak 28 Mar 2003 06:35:53 -0000 1.6
@@ -16,7 +16,8 @@
flraggmax$(OBJEXT) \
flraggmin$(OBJEXT) \
flraggsum$(OBJEXT) \
- flrstorage$(OBJEXT) \
+ flrstorageutils$(OBJEXT) \
+ flrstoragebase$(OBJEXT) \
flrdbop$(OBJEXT) \
flrbtdbop$(OBJEXT) \
flrshdirect$(OBJEXT) \
Index: Makefile
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Makefile 24 Mar 2003 08:08:41 -0000 1.7
+++ Makefile 28 Mar 2003 06:35:53 -0000 1.8
@@ -44,7 +44,7 @@
flraggmax$(OBJEXT) \
flraggmin$(OBJEXT) \
flraggsum$(OBJEXT) \
- flrstorage$(OBJEXT) \
+ flrstorageutils$(OBJEXT) \
flrstoragebase$(OBJEXT) \
flrdbop$(OBJEXT) \
flrbtdbop$(OBJEXT) \
--- flrstorage.P DELETED ---
|
|
From: <ki...@us...> - 2003-03-28 06:35:56
|
Update of /cvsroot/flora/flora2 In directory sc8-pr-cvs1:/tmp/cvs-serv4209 Modified Files: flrhilogtable.H Log Message: renamed syslib/flrstorage.P to syslib/flrstorageutils.P Index: flrhilogtable.H =================================================================== RCS file: /cvsroot/flora/flora2/flrhilogtable.H,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- flrhilogtable.H 26 Mar 2003 17:32:22 -0000 1.6 +++ flrhilogtable.H 28 Mar 2003 06:35:54 -0000 1.7 @@ -59,7 +59,7 @@ :- import flora_storage_check_module_name/1 - from flrstorage. + from flrstorageutils. :- export flora_hilogtable/2, |
|
From: <ki...@us...> - 2003-03-28 06:35:15
|
Update of /cvsroot/flora/flora2/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv3839/docs
Modified Files:
flora2.tex
Log Message:
some fixes/improvements in the manual
Index: flora2.tex
===================================================================
RCS file: /cvsroot/flora/flora2/docs/flora2.tex,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- flora2.tex 27 Mar 2003 11:44:13 -0000 1.42
+++ flora2.tex 28 Mar 2003 06:35:06 -0000 1.43
@@ -183,49 +183,49 @@
\section{Introduction}
-\FLORA is a sophisticated compiler and application development platform
-that translates a unified language of \fl \cite{KLW95}, HiLog
-\cite{hilog-jlp}, and Transaction Logic \cite{trans-chapter-98,trans-tcs94}
-into tabled Prolog code. It takes a program written in the \fl language
-with HiLog and Transaction Logic extensions (which must be in a file with
-extension {\tt .flr}, {\it e.g.}, {\tt file.flr}) and outputs a regular
-Prolog program (with extension {\tt .P}). This program is then passed to
-XSB for compilation (which produces {\tt file.\ofile}) and execution,
-which, however, requires \FLORA runtime support.
+\FLORA is a sophisticated object-oriented knowledge base language and
+application development platform. It is implemented as a set of run-time
+libraries and a compiler that translates a unified language of \fl
+\cite{KLW95}, HiLog \cite{hilog-jlp}, and Transaction Logic
+\cite{trans-chapter-98,trans-tcs94} into tabled Prolog code.
+
+Applications of \FLORA include intelligent agents, Semantic Web, ontology
+management, integration of information, and others.
\index{FLIP}
\index{FLORID}
%%
-The programming language
-supported by \FLORA is a dialect of \fl with numerous extensions. Some
-extensions are borrowed from \FLORID, a C++-based \fl system developed at
+The programming language supported by \FLORA is a dialect of \fl with
+numerous extensions, which include a natural way to do meta-programming in
+the style of HiLog and logical updates in the style of Transaction
+Logic. \FLORA was designed with extensibility and flexibility in mind, and
+it provides strong support for modular software design through its unique
+feature of dynamic modules.
+Other extensions, such as the versatile syntax of \FLORID path
+expressions, are borrowed from
+\FLORID, a C++-based \fl system developed at
Freiburg University.\footnote{
%%
See {\tt http://www.informatik.uni-freiburg.de/$\sim$dbis/florid/} for more
details.
%%
- }
+}
%%
-In particular, \FLORA fully supports the versatile syntax of \FLORID path
-expressions. Other important extensions are motivated by the need to
-support a flexible module system (and enable modular software development
-in \fl) and in order to support HiLog \cite{hilog-jlp} and Transaction
-Logic \cite{trans-chapter-98,trans-iclp93,trans-tcs94}, both of which are
-smoothly integrated with \fl. Extensions aside, the syntax of \FLORA also
-differs in some important ways from \FLORID, from the original version of
-\fl, as described in \cite{KLW95}, and from an earlier implementation
-of \FLORAone. These syntactic changes were needed in order to bring the
-syntax of \FLORA closer to that of Prolog and make it possible to include
-typical Prolog programs into \FLORA programs without choking the compiler.
-Other syntactic deviations from the original F-logic syntax are a direct
-consequence of the added support for HiLog, which obviates the need for the
-``@'' sign in method invocations (this sign is now used to denote calls to
-\FLORA modules).
+Extensions aside, the syntax of \FLORA differs in many
+important ways from \FLORID, from the original version of \fl, as described
+in \cite{KLW95}, and from an earlier implementation of \FLORAone. These
+syntactic changes were needed in order to bring the syntax of \FLORA closer
+to that of Prolog and make it possible to include simple Prolog programs
+into \FLORA programs without choking the compiler. Other syntactic
+deviations from the original F-logic syntax are a direct consequence of the
+added support for HiLog, which obviates the need for the ``@'' sign in
+method invocations (this sign is now used to denote calls to \FLORA
+modules).
\FLORA is distributed in two ways. First, it is part of the official
distribution of XSB and thus is installed together with XSB
({\tt http://xsb.sourceforge.net}). Second, a more
-up-to-date, bleeding edge version of \FLORA can be downloaded from its own
+up-to-date version of the system is available on \FLORA's
Web site at
%%
\begin{quote}
@@ -238,7 +238,7 @@
released in-between the releases of XSB). The installation instructions are
somewhat different in these two cases.
-\paragraph{Installting \FLORA under UNIX.}
+\paragraph{Installing \FLORA under UNIX.}
To configure a version of \FLORA that was downloaded as part of the
distribution of XSB, simply configure XSB as usual:
%%
@@ -249,8 +249,6 @@
makexsb packages
\end{verbatim}
%%
-(Under Windows, XSB is configured with the script {\tt makexsb\_wind} in
-directory {\tt XSB$\backslash$build}.)
If you downloaded XSB from its CVS repository earlier and are updating your
copy using the {\tt cvs update} command, then it might be a good idea to
@@ -263,12 +261,8 @@
\end{verbatim}
%%
-Under Windows also make sure that the {\tt packages} directory contains a
-shortcut called {\tt flora2.P} to the file
-{\tt packages$\backslash$flora2$\backslash$flora2.P}.
-
To install the ``bleeding edge'' version of \FLORA from {\tt
-http://flora.sourceforge.net} you must download it (either as a tarball
+http://flora.sourceforge.net}, download it (either as a tarball
or from CVS) into a separate directory \emph{outside} of the XSB
installation tree. After unpacking (or checking out from CVS) the \FLORA
sources will be placed in the subdirectory called {\tt flora2}. To
@@ -281,7 +275,8 @@
\end{verbatim}
%%
(assuming that XSB has been already installed and configured separately).
-If an XSB executable is not on your program search {\tt PATH}, then you
+If an XSB executable is not on your program search {\tt PATH}, then in the
+third command above you
need to provide the XSB installation directory to {\tt makeflora} as
an argument, {\it e.g.},
%%
@@ -293,14 +288,17 @@
\paragraph{Installing \FLORA in Windows.}
First, you need Microsoft's {\tt nmake}.
Then use the following commands to configure
-\FLORA (assuming that XSB is installed and configured):
+\FLORA (assuming that XSB is already installed and configured):
%%
-\begin{verbatim}
+\begin{alltt}
cd flora2
makeflora clean
- makeflora path-to-prolog-executable
-\end{verbatim}
+ makeflora \emph{path-to-prolog-executable}
+\end{alltt}
%%
+Also make sure that the {\tt packages} directory contains a
+shortcut called {\tt flora2.P} to the file
+{\tt packages$\backslash$flora2$\backslash$flora2.P}.
\paragraph{Running \FLORA.}
@@ -384,7 +382,7 @@
(in Bash):
%%
\begin{verbatim}
- alias flora2='xsb -e "[flora2], flora\_shell."'
+ alias flora2='xsb -e "[flora2], flora_shell."'
alias runflora='~/bleeding-edge/flora2/runflora'
\end{verbatim}
%%
@@ -4668,7 +4666,7 @@
methods should not occur.
-\section{Rule Insertion and Deletion}
+\section{Insertion and Deletion of Rules into Modules}
\index{rule insertion}
\index{rule deletion}
@@ -4697,7 +4695,7 @@
indexing, and the cut.
-\subsection{Creating a Module at Run-time}
+\subsection{Creating a New Module at Run-time}
\index{newmodule/1}
@@ -4776,22 +4774,23 @@
\index{deleterule\_z}
\index{deleterule}
%%
-Dynamic rules inserted using {\tt insertrule\_a} can be deleted using
-the premitive {\tt deleterule\_a}, and rules inserted using {\tt
-insertrule\_z} can be deleted using the primitive {\tt
-deleterule\_z}. If the user does not care about whether the rule to be
-deleted is inserted using {\tt insertrule\_a} or {\tt insertrule\_z}, the
-premitive{\tt deleterule} can be used. Similar to rule insertion,
-several rules can be deleted in the same command. The syntax of deleting
-a list of rules is as follows: {\tt
+Rules inserted dynamically using {\tt insertrule\_a} can be deleted using
+the primitive {\tt deleterule\_a}, and rules inserted using {\tt
+ insertrule\_z} can be deleted using the primitive {\tt deleterule\_z}. If
+the user wishes to delete a rule that was previously inserted using either
+{\tt insertrule\_a} or {\tt insertrule\_z} then the premitive{\tt
+ deleterule} can be used. Similarly to rule insertion, several rules can be
+deleted in the same command:
+{\tt
\begin{quote}
\emph{delruleop}\{\emph{rulelist}\}
\end{quote}
}
\noindent
-where \emph{delruleop} is either {\tt deleterule\_a} or {\tt
- deleterule\_z}, rulelist is a comma-separated list of rules, which
- \emph{should not} terminate with a period.
+where \emph{delruleop} is either {\tt deleterule\_a} or {\tt deleterule\_z}
+and \emph{rulelist} is a comma-separated list of rules. Rules in the list
+mast be enclosed in parentheses and \emph{should not} terminate with a
+period.
To delete the rules inserted in the second example of
Section~\ref{sec-insertingrule}, we can use
@@ -4811,15 +4810,15 @@
\end{verbatim}
\end{quote}
-The head of the rule to be deleted must be specific. To make it clear,
-if we have
+The head of a rule to be deleted cannot be a variable and the module
+associated with any rule must be bound. For example, in
%%
\begin{quote}
\begin{verbatim}
flora2 ?- deleterule{(X:-Y@M1)@M2}.
\end{verbatim}
\end{quote}
-both X and M2 must be bound. But this is not required for Y and M1.
+both X and M2 must be bound. However, Y and M1 can be unbound.
\subsection{Tabling and Indexing of Dynamically Defined Predicates}
|
|
From: <ch...@us...> - 2003-03-27 11:47:51
|
Update of /cvsroot/flora/flora2
In directory sc8-pr-cvs1:/tmp/cvs-serv16638
Modified Files:
flrwrapper.H flrwrapper.P
Log Message:
more efficient flora_user_module_predicate/4 and flora_system_module_predicate/4
Index: flrwrapper.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrwrapper.H,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- flrwrapper.H 26 Mar 2003 17:32:25 -0000 1.9
+++ flrwrapper.H 27 Mar 2003 11:47:47 -0000 1.10
@@ -33,7 +33,7 @@
:- dynamic flora_flogic_fact_wrapper(_,_).
:- dynamic flora_current_flogic_module(_).
-:- dynamic flora_decode_pred(_,_,_,_).
+:- dynamic flora_decode_pred(_,_,_,_,_).
:- index(flora_flogic_fact_wrapper/2,trie).
:- index(flora_current_flogic_module/1,trie).
Index: flrwrapper.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrwrapper.P,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- flrwrapper.P 26 Mar 2003 17:32:25 -0000 1.14
+++ flrwrapper.P 27 Mar 2003 11:47:47 -0000 1.15
@@ -28,6 +28,7 @@
#include "flora_terms.flh"
+:- import length/2 from basics.
/*****************************************************************************
flora_user_module_predicate(+Functor,+Args,+Workspace,-Predicate)
@@ -37,17 +38,16 @@
Flora user module.
*****************************************************************************/
flora_user_module_predicate(Functor,Args,WS,Predicate) :-
- flora_user_module_functor(Functor,WS,PF),
- Predicate =.. [PF|Args].
-
-flora_user_module_functor(Functor,WS,PF) :-
- flora_decode_pred(Functor,WS,user,PF),
+ flora_decode_pred(Functor,Args,WS,user,Predicate),
!.
-flora_user_module_functor(Functor,WS,PF) :-
+flora_user_module_predicate(Functor,Args,WS,Predicate) :-
flora_concat_atoms([FLORA_USER_MODULE_PREFIX,'''',WS,'''',Functor],PF),
- assert(flora_decode_pred(Functor,WS,user,PF)).
-
+ Predicate =.. [PF|Args],
+ length(Args,Arity),
+ length(NewArgs,Arity),
+ PredTemplate =.. [PF|NewArgs],
+ assert(flora_decode_pred(Functor,NewArgs,WS,user,PredTemplate)).
/*****************************************************************************
flora_system_module_predicate(+Functor,+Args,+SysModID,-Predicate)
@@ -57,16 +57,16 @@
to a Flora system module.
*****************************************************************************/
flora_system_module_predicate(Functor,Args,SysModID,Predicate) :-
- flora_system_module_functor(Functor,SysModID,PF),
- Predicate =.. [PF|Args].
-
-flora_system_module_functor(Functor,SysModID,PF) :-
- flora_decode_pred(Functor,SysModID,system,PF),
+ flora_decode_pred(Functor,Args,SysModID,system,Predicate),
!.
-flora_system_module_functor(Functor,SysModID,PF) :-
+flora_system_module_predicate(Functor,Args,SysModID,Predicate) :-
flora_concat_atoms([FLORA_SYSTEM_MODULE_PREFIX,'''',SysModID,'''',Functor],PF),
- assert(flora_decode_pred(Functor,SysModID,system,PF)).
+ Predicate =.. [PF|Args],
+ length(Args,Arity),
+ length(NewArgs,Arity),
+ PredTemplate =.. [PF|NewArgs],
+ assert(flora_decode_pred(Functor,NewArgs,SysModID,system,PredTemplate)).
/*****************************************************************************
flora_module_predicate(+Functor,+Args,+ModuleName,-Predicate)
|
|
From: <ch...@us...> - 2003-03-27 11:45:26
|
Update of /cvsroot/flora/flora2/syslib
In directory sc8-pr-cvs1:/tmp/cvs-serv15316/syslib
Modified Files:
flrcanon.P
Log Message:
add comments
Index: flrcanon.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrcanon.P,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- flrcanon.P 26 Mar 2003 21:41:37 -0000 1.2
+++ flrcanon.P 27 Mar 2003 11:45:19 -0000 1.3
@@ -1,6 +1,7 @@
/* File: flrcanon.P
**
-** Author(s): Chang Zhao
+** Author(s): Michael Kifer
+** Chang Zhao
**
** Contact: flo...@li...
**
@@ -40,6 +41,12 @@
:- export get_canonical_form/2.
+/******************************************************************************
+ get_canonical_form(+Term,-Canon)
+ get the canonical form Canon of the given Term. Canon is in the form
+ of (Wrap,Args,Module,Callable)
+******************************************************************************/
+%% Case of Var
get_canonical_form(Term,(_,_,_,Term)) :-
var(Term),
!.
|
|
From: <ch...@us...> - 2003-03-27 11:44:18
|
Update of /cvsroot/flora/flora2
In directory sc8-pr-cvs1:/tmp/cvs-serv14694
Modified Files:
flrcoder.P flrcompiler.P flrlibman.P flrparser.P
Log Message:
add the primitive deleterule
Index: flrcoder.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrcoder.P,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- flrcoder.P 26 Mar 2003 17:32:19 -0000 1.15
+++ flrcoder.P 27 Mar 2003 11:44:12 -0000 1.16
@@ -229,6 +229,7 @@
is_ruleupdate(FLLIBINSERTRULE_Z) :- !.
is_ruleupdate(FLLIBDELETERULE_A) :- !.
is_ruleupdate(FLLIBDELETERULE_Z) :- !.
+is_ruleupdate(FLLIBDELETERULE) :- !.
/****************************************************************************
get_fingerprint(+Funct,+Arity,-WrappedF,-NewF,-NewArity,-ArgList)
@@ -938,7 +939,8 @@
/****************************************************************************
flora_write_dynrulelist(+DynRuleList,+Lib)
Lib can be FLLIBINSERTRULE_A, FLLIBINSERTRULE_Z, FLLIBDELETERULE_A,
- or FLLIBDELETERULE_Z. dynrule is similar to rule but its head is a list
+ or FLLIBDELETERULE_Z, FLLIBDELETE. dynrule is similar to rule but its
+ head is a list
****************************************************************************/
flora_write_dynrulelist([],_Lib) :- !.
flora_write_dynrulelist([Term],Lib) :-
@@ -952,7 +954,11 @@
((Lib==FLLIBINSERTRULE_A;Lib==FLLIBDELETERULE_A) ->
flora_write_structlist(Head,FLDYNAPREFIX)
;
- flora_write_structlist(Head,FLDYNZPREFIX)
+ ((Lib==FLLIBINSERTRULE_Z;Lib==FLLIBDELETERULE_Z) ->
+ flora_write_structlist(Head,FLDYNZPREFIX)
+ ;
+ flora_write_structlist(Head,FLHEADPREFIX)
+ )
),
put(0']),
flora_set_counter(using_debug_prefix,1),
@@ -1459,7 +1465,11 @@
((Lib==FLLIBINSERTRULE_A;Lib==FLLIBDELETERULE_A) ->
flora_build_structlist(Head,DWS,FLDYNAPREFIX,VarList,HCode,HICode)
;
- flora_build_structlist(Head,DWS,FLDYNZPREFIX,VarList,HCode,HICode)
+ ((Lib==FLLIBINSERTRULE_A;Lib==FLLIBDELETERULE_A) ->
+ flora_build_structlist(Head,DWS,FLDYNZPREFIX,VarList,HCode,HICode)
+ ;
+ flora_build_structlist(Head,DWS,FLHEADPREFIX,VarList,HCode,HICode)
+ )
),
flora_set_counter(using_debug_prefix,1),
flora_build_struct(Body,DWS,FLBODYPREFIX,VarList,BCode,BICode),
Index: flrcompiler.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrcompiler.P,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- flrcompiler.P 26 Mar 2003 17:32:20 -0000 1.21
+++ flrcompiler.P 27 Mar 2003 11:44:13 -0000 1.22
@@ -456,6 +456,7 @@
updaterule_syslib(FL_INSERTRULE_Z,FLLIBINSERTRULE_Z) :- !.
updaterule_syslib(FL_DELETERULE_A,FLLIBDELETERULE_A) :- !.
updaterule_syslib(FL_DELETERULE_Z,FLLIBDELETERULE_Z) :- !.
+updaterule_syslib(FL_DELETERULE,FLLIBDELETERULE) :- !.
aggregate_struct(Op,V,GV,B,Object,Code) :-
%% Index denotes the textual information for the aggregate
@@ -1359,6 +1360,7 @@
; is_flworkspace(ParserTerm,P,WS) ->
compile_head_wsliteral(P,WS,Code,Status)
+
; is_flvar(ParserTerm,Name,Index) ->
compile_flvar(Name,Index,Code),
Status=[]
@@ -3500,6 +3502,11 @@
; is_flobjeql(ParserTerm,O1,O2) ->
compile_head_wsflobjeql(O1,O2,WS,Code,Status)
+
+ ; is_flvar(ParserTerm,VarName,Index) ->
+ compile_flvar(VarName,Index,VarCode),
+ workspacelit_struct(VarCode,WS,Code),
+ Status=[]
;
atomlit_struct(ParserTerm,ACode),
workspacelit_struct(ACode,WS,Code),
Index: flrlibman.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrlibman.P,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- flrlibman.P 26 Mar 2003 17:32:22 -0000 1.7
+++ flrlibman.P 27 Mar 2003 11:44:13 -0000 1.8
@@ -181,6 +181,7 @@
flora_library_file(FLLIBINSERTRULE_Z,flrdynrule,syslib) :- !.
flora_library_file(FLLIBDELETERULE_A,flrdynrule,syslib) :- !.
flora_library_file(FLLIBDELETERULE_Z,flrdynrule,syslib) :- !.
+flora_library_file(FLLIBDELETERULE,flrdynrule,syslib) :- !.
flora_library_file(FLLIBCONTROL,flrcontrol,syslib) :- !.
flora_library_file(FLLIBIFTHENELSE,flrcontrol,syslib) :- !.
Index: flrparser.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrparser.P,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- flrparser.P 26 Mar 2003 17:32:23 -0000 1.21
+++ flrparser.P 27 Mar 2003 11:44:13 -0000 1.22
@@ -635,6 +635,7 @@
is_ruleupdateop(FL_INSERTRULE_Z) :- !.
is_ruleupdateop(FL_DELETERULE_A) :- !.
is_ruleupdateop(FL_DELETERULE_Z) :- !.
+is_ruleupdateop(FL_DELETERULE) :- !.
is_reifyop(FL_REIFYOP) :- !.
|
|
From: <ch...@us...> - 2003-03-27 11:44:18
|
Update of /cvsroot/flora/flora2/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv14694/docs
Modified Files:
dynamic_rule.txt flora2.tex
Log Message:
add the primitive deleterule
Index: dynamic_rule.txt
===================================================================
RCS file: /cvsroot/flora/flora2/docs/dynamic_rule.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dynamic_rule.txt 26 Mar 2003 17:31:26 -0000 1.3
+++ dynamic_rule.txt 27 Mar 2003 11:44:13 -0000 1.4
@@ -29,6 +29,8 @@
deleterule_a{RuleList}
or
deleterule_z{RuleList}
+ or
+ deleterule{RuleList}
where RuleList is the same as rule insertion.
(4) table syntax
@@ -204,6 +206,8 @@
delete related rules as directed by the record
end for
end for
+FLLIBDELETERULE(RuleList) :- FLLIBDELETERULE_A(RuleList).
+FLLIBDELETERULE(RuleList) :- FLLIBDELETERULE_Z(RuleList).
3. What's left
(1) cut in rules inserted by insertrule_a doesn't not work properly
Index: flora2.tex
===================================================================
RCS file: /cvsroot/flora/flora2/docs/flora2.tex,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- flora2.tex 26 Mar 2003 17:31:27 -0000 1.41
+++ flora2.tex 27 Mar 2003 11:44:13 -0000 1.42
@@ -4774,13 +4774,16 @@
\index{deleterule\_a}
\index{deleterule\_z}
+\index{deleterule}
%%
Dynamic rules inserted using {\tt insertrule\_a} can be deleted using
the premitive {\tt deleterule\_a}, and rules inserted using {\tt
insertrule\_z} can be deleted using the primitive {\tt
-deleterule\_z}. Similar to rule insertion, several rules can be deleted
-in the same command. The syntax of deleting a list of rules is as
-follows: {\tt
+deleterule\_z}. If the user does not care about whether the rule to be
+deleted is inserted using {\tt insertrule\_a} or {\tt insertrule\_z}, the
+premitive{\tt deleterule} can be used. Similar to rule insertion,
+several rules can be deleted in the same command. The syntax of deleting
+a list of rules is as follows: {\tt
\begin{quote}
\emph{delruleop}\{\emph{rulelist}\}
\end{quote}
@@ -4799,13 +4802,21 @@
(X:student:-enroll(X,_T))@mod1}.
\end{verbatim}
\end{quote}
+or
+%%
+\begin{quote}
+\begin{verbatim}
+flora2 ?- deleterule{(X:student:-enroll(X,_T)),
+ (X:student:-enroll(X,_T))@mod1}.
+\end{verbatim}
+\end{quote}
The head of the rule to be deleted must be specific. To make it clear,
if we have
%%
\begin{quote}
\begin{verbatim}
-flora2 ?- deleterule_a{(X:-Y@M1)@M2}.
+flora2 ?- deleterule{(X:-Y@M1)@M2}.
\end{verbatim}
\end{quote}
both X and M2 must be bound. But this is not required for Y and M1.
|
|
From: <ch...@us...> - 2003-03-27 11:44:18
|
Update of /cvsroot/flora/flora2/syslib
In directory sc8-pr-cvs1:/tmp/cvs-serv14694/syslib
Modified Files:
flrdynrule.P
Log Message:
add the primitive deleterule
Index: flrdynrule.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrdynrule.P,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- flrdynrule.P 26 Mar 2003 17:30:33 -0000 1.7
+++ flrdynrule.P 27 Mar 2003 11:44:14 -0000 1.8
@@ -38,6 +38,9 @@
:- import
flora_warning_line/2
from flrprint.
+:- import
+ flora_concat_atoms/2
+ from flrporting.
:- import
flora_patch_full_filename/1,
flora_set_xpp_options_for_compile/1,
@@ -134,7 +137,7 @@
flora_expand_and_ins_rules(InsOp,HeadList,Body,BodySig,HVars,BVars) :-
HeadList=[H|_L],
( var(H) ->
- flora_abort(['uninstantiated rule head'])
+ flora_abort('uninstantiated rule head')
;
( H=FLLIBMODLIT(_F,_Args1,MName) ->
true
@@ -143,7 +146,7 @@
(((Type==hilog);(Type==flora)) ->
true
;
- flora_abort(['invalid rule head'])
+ flora_abort('invalid rule head')
)
)
),
@@ -176,11 +179,16 @@
************************************************************************/
flora_insert_rule(InsOp,Head,Body,BodySig,BridgeRule,HVars,BVars) :-
( var(Head) ->
- flora_abort(['uninstantiated rule head'])
+ flora_abort('uninstantiated rule head')
;
- ( Head=FLLIBMODLIT(F,Args1,MName) ->
- flora_storage_check_module_name(MName),
- flora_module_predicate(F,Args1,MName,InstHead)
+ ( Head=FLLIBMODLIT(_F,_A1,MName) ->
+ get_canonical_form(Head,(Wrap,_A2,MName,InstHead)),
+ ( var(Wrap) ->
+ flora_abort('uninstantiated rule head')
+ ;
+ true
+ ),
+ flora_storage_check_module_name(MName)
;
InstHead=Head
),
@@ -189,7 +197,7 @@
(((Type==hilog);(Type==flora)) ->
true
;
- flora_abort(['invalid rule head'])
+ flora_abort('invalid rule head')
),
flora_storage_check_module_name(Module),
( (Type == hilog) ->
@@ -242,9 +250,14 @@
/***********************************************************************
FLLIBDELETERULE_A(+RuleList)
FLLIBDELETERULE_Z(+RuleList)
+ FLLIBDELETERULE(+RuleList)
************************************************************************/
FLLIBDELETERULE_A(RuleList) :- flora_delete_rules(FLLIBDELETERULE_A,RuleList).
FLLIBDELETERULE_Z(RuleList) :- flora_delete_rules(FLLIBDELETERULE_Z,RuleList).
+FLLIBDELETERULE(RuleList) :-
+ flora_delete_rules(FLLIBDELETERULE_A,RuleList).
+FLLIBDELETERULE(RuleList) :-
+ flora_delete_rules(FLLIBDELETERULE_Z,RuleList).
/***********************************************************************
flora_delete_rules(+DelOp,+RuleList)
@@ -264,11 +277,16 @@
flora_delete_rule(DelOp,Head,BodySig) :-
( var(Head) ->
- flora_abort(['uninstantiated rule head'])
+ flora_abort('uninstantiated rule head')
;
- ( Head=FLLIBMODLIT(F,Args1,MName) ->
- flora_storage_check_module_name(MName),
- flora_module_predicate(F,Args1,MName,InstHead)
+ ( Head=FLLIBMODLIT(_F,_A1,MName) ->
+ get_canonical_form(Head,(Wrap,_A2,MName,InstHead)),
+ ( var(Wrap) ->
+ flora_abort('uninstantiated rule head')
+ ;
+ true
+ ),
+ flora_storage_check_module_name(MName)
;
InstHead=Head
),
@@ -276,7 +294,7 @@
(((Type==hilog);(Type==flora)) ->
true
;
- flora_abort(['invalid rule head'])
+ flora_abort('invalid rule head')
),
flora_storage_check_module_name(Module),
( (Type == hilog) ->
@@ -285,11 +303,16 @@
;
flora_dynz_hilog_user_module_predicate_symbol(Module,Wrapper)
),
- NewHead =.. [Wrapper,Pred|Args],
- flora_match_and_delete_rule(NewHead,BodySig)
+ NewHead =.. [Wrapper,Pred|Args]
;
- flora_match_and_delete_rule(InstHead,BodySig)
- )
+ ( DelOp == FLLIBDELETERULE_A ->
+ flora_concat_atoms([FLDYNAPREFIX,Pred],Wrapper)
+ ;
+ flora_concat_atoms([FLDYNZPREFIX,Pred],Wrapper)
+ ),
+ flora_module_predicate(Wrapper,Args,Module,NewHead)
+ ),
+ flora_match_and_delete_rule(NewHead,BodySig)
).
flora_match_and_delete_rule(Head,BodySig) :-
@@ -316,6 +339,10 @@
inst_body(+Body,-InstBody)
get rid of fllibmodlit with module name already bound
************************************************************************/
+inst_body(B,B) :-
+ var(B),
+ !.
+
inst_body(','(B1,B2),','(NB1,NB2)) :-
!,
inst_body(B1,NB1),
@@ -341,9 +368,8 @@
NB =.. [Ctl|InstBranches].
inst_body(FLLIBMODLIT(F,Args,MName),Inst) :-
- not var(MName),
- !,
- flora_module_predicate(F,Args,MName,Inst).
+ !,
+ get_canonical_form(FLLIBMODLIT(F,Args,MName),(_W,_A,_M,Inst)).
inst_body(Body,Body).
|
|
From: <ch...@us...> - 2003-03-27 11:44:18
|
Update of /cvsroot/flora/flora2/flrincludes
In directory sc8-pr-cvs1:/tmp/cvs-serv14694/flrincludes
Modified Files:
flora_terms.flh
Log Message:
add the primitive deleterule
Index: flora_terms.flh
===================================================================
RCS file: /cvsroot/flora/flora2/flrincludes/flora_terms.flh,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- flora_terms.flh 26 Mar 2003 17:31:29 -0000 1.17
+++ flora_terms.flh 27 Mar 2003 11:44:14 -0000 1.18
@@ -224,6 +224,7 @@
#define FL_INSERTRULE_Z insertrule_z
#define FL_DELETERULE_A deleterule_a
#define FL_DELETERULE_Z deleterule_z
+#define FL_DELETERULE deleterule
#define FL_CONSTRAINT_START '{'
#define FL_CONSTRAINT_END '}'
@@ -603,6 +604,7 @@
#define FLLIBINSERTRULE_Z fllibinsertrule_z
#define FLLIBDELETERULE_A fllibdeleterule_a
#define FLLIBDELETERULE_Z fllibdeleterule_z
+#define FLLIBDELETERULE fllibdeleterule
#define FLLIBSHDIRECT fllibshdirect
|
|
From: <ch...@us...> - 2003-03-27 11:32:40
|
Update of /cvsroot/flora/flora2 In directory sc8-pr-cvs1:/tmp/cvs-serv8627 Modified Files: flrhilogtable.P Log Message: fix a bug in flora_enter_not_tabled_registry Index: flrhilogtable.P =================================================================== RCS file: /cvsroot/flora/flora2/flrhilogtable.P,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- flrhilogtable.P 26 Mar 2003 17:32:22 -0000 1.7 +++ flrhilogtable.P 27 Mar 2003 11:32:37 -0000 1.8 @@ -125,14 +125,19 @@ ( atom(Pred),flora_not_tabled_registry(Module,P,N),P==Pred -> true ; - ( var(Pred), flora_not_tabled_registry(Module,Pred,N) -> - true - ; - + ( var(Pred), no_matching_in_not_tabled_registry(Module,Pred,N) -> assert(flora_not_tabled_registry(Module,Pred,N)) + ; + true ) ). +no_matching_in_not_tabled_registry(Module,Pred,N) :- + flora_not_tabled_registry(Module,Pred,N), + !, + fail. + +no_matching_in_not_tabled_registry(_M,_P,_N). /**************************************************************************** flora_table_info(+TermList) |
|
From: <ch...@us...> - 2003-03-27 11:20:43
|
Update of /cvsroot/flora/flora-testsuite/general_tests
In directory sc8-pr-cvs1:/tmp/cvs-serv2541
Modified Files:
ruleupdates.flr ruleupdates_load_old
Log Message:
add more rule update tests
Index: ruleupdates.flr
===================================================================
RCS file: /cvsroot/flora/flora-testsuite/general_tests/ruleupdates.flr,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ruleupdates.flr 26 Mar 2003 17:24:34 -0000 1.1
+++ ruleupdates.flr 27 Mar 2003 11:20:36 -0000 1.2
@@ -41,4 +41,16 @@
?- writeln('Query 9 begins')@prolog().
?- X[register->>Term], fmt_write('%S[register->>%S]\n',arg(X,Term))@flora(io).
+?- insertrule_a{(p(X),q(X)) :- r1(X)}.
+?- insertrule_z{P(X) :- r2(P,X)}.
+?- insert{r1(a), r2(p,b), r2(q,b)}.
+?- writeln('Query 10 begins')@prolog().
+?- p(X), fmt_write('p(%S)\n', arg(X))@flora(io).
+?- writeln('Query 11 begins')@prolog().
+?- q(X), fmt_write('q(%S)\n', arg(X))@flora(io).
+?- deleterule{p(_X) :- Y}.
+?- writeln('Query 12 begins')@prolog().
+?- p(X), fmt_write('p(%S)\n', arg(X))@flora(io).
+?- writeln('Query 13 begins')@prolog().
+?- q(X), fmt_write('q(%S)\n', arg(X))@flora(io).
Index: ruleupdates_load_old
===================================================================
RCS file: /cvsroot/flora/flora-testsuite/general_tests/ruleupdates_load_old,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ruleupdates_load_old 26 Mar 2003 17:24:35 -0000 1.1
+++ ruleupdates_load_old 27 Mar 2003 11:20:36 -0000 1.2
@@ -14,6 +14,24 @@
Mary[register->>S03]
Mary:student
Mary:student
+p(a)
+p(a)
+p(b)
+p(b)
+q(a)
+q(a)
+q(a)
+q(a)
+q(b)
+q(b)
+Query 10 begins
+Query 10 begins
+Query 11 begins
+Query 11 begins
+Query 12 begins
+Query 12 begins
+Query 13 begins
+Query 13 begins
Query 1 begins
Query 1 begins
Query 2 begins
|
|
From: <ki...@us...> - 2003-03-26 21:41:43
|
Update of /cvsroot/flora/flora2/syslib
In directory sc8-pr-cvs1:/tmp/cvs-serv3448/syslib
Modified Files:
flrstorage.P flrcanon.P
Log Message:
minor fixes
Index: flrstorage.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrstorage.P,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- flrstorage.P 26 Mar 2003 17:30:35 -0000 1.8
+++ flrstorage.P 26 Mar 2003 21:41:36 -0000 1.9
@@ -81,17 +81,13 @@
!,
( Type == invalid ->
flora_module_name_error(ModuleName)
-
+
; Type == systemmodule ->
flora_abort(['Updates to system modules (',WS,') are not allowed'])
;
- true
+ true
),
- ( flora_module_registry(WS) ->
- true
- ;
- flora_abort(['Module ',WS,' does not exist'])
- ).
+ flora_storage_check_existence(WS).
/*****************************************************************************
flora_storage_check_existence(+ModuleName)
Index: flrcanon.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrcanon.P,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- flrcanon.P 26 Mar 2003 17:30:29 -0000 1.1
+++ flrcanon.P 26 Mar 2003 21:41:37 -0000 1.2
@@ -1,3 +1,30 @@
+/* File: flrcanon.P
+**
+** Author(s): Chang Zhao
+**
+** Contact: flo...@li...
+**
+** Copyright (C) The Research Foundation of SUNY, 2003
+**
+** FLORA-2 is free software; you can redistribute it and/or modify it under the
+** terms of the GNU Library General Public License as published by the Free
+** Software Foundation; either version 2 of the License, or (at your option)
+** any later version.
+**
+** FLORA-2 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 Library General Public License for
+** more details.
+**
+** You should have received a copy of the GNU Library General Public License
+** along with FLORA-2; if not, write to the Free Software Foundation,
+** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+**
+*/
+
+
+
:- compiler_options([xpp_on]).
#include "flora_terms.flh"
|
|
From: <ch...@us...> - 2003-03-26 17:32:37
|
Update of /cvsroot/flora/flora2
In directory sc8-pr-cvs1:/tmp/cvs-serv9846
Modified Files:
flrcoder.P flrcompiler.P flrdependency.P flrhilogtable.H
flrhilogtable.P flrlibman.P flrnodefp.P flrparser.P flrutils.H
flrutils.P flrwrapper.H flrwrapper.P
Log Message:
add rule deletion; check module existence for db updates; add var checks for rule insertion
Index: flrcoder.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrcoder.P,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- flrcoder.P 10 Mar 2003 07:38:13 -0000 1.14
+++ flrcoder.P 26 Mar 2003 17:32:19 -0000 1.15
@@ -46,6 +46,8 @@
is_prquery(PRQUERY(Goal),Goal).
is_prdirective(PRDIRECTIVE(Direct),Direct).
+is_prdynrule(PRDYNRULE(Head,Body,HVars,BVars),Head,Body,HVars,BVars).
+
is_prreify(PRREIFY(Formula),Formula).
is_prcommand(PRCOMMAND(C),C).
@@ -223,6 +225,11 @@
is_fllibdb(FLLIBBTERASE) :- !.
is_fllibdb(FLLIBBTERASEALL) :- !.
+is_ruleupdate(FLLIBINSERTRULE_A) :- !.
+is_ruleupdate(FLLIBINSERTRULE_Z) :- !.
+is_ruleupdate(FLLIBDELETERULE_A) :- !.
+is_ruleupdate(FLLIBDELETERULE_Z) :- !.
+
/****************************************************************************
get_fingerprint(+Funct,+Arity,-WrappedF,-NewF,-NewArity,-ArgList)
****************************************************************************/
@@ -652,7 +659,6 @@
!,
write_canonical(Term).
-
/****************************************************************************
flora_write_variable(+Name)
@@ -917,7 +923,7 @@
).
flora_write_syslib(Lib,1,[WrappedList],_Prefix) :-
- (Lib==FLLIBINSERTRULE_A; Lib==FLLIBINSERTRULE_Z),
+ is_ruleupdate(Lib),
!,
write_canonical(Lib),
put(0'(), put(0'[),
@@ -931,19 +937,19 @@
/****************************************************************************
flora_write_dynrulelist(+DynRuleList,+Lib)
- Lib can be FLLIBINSERTRULE_A or FLLIBINSERTRULE_Z
- dynrule is similar to rule but its head is a list
+ Lib can be FLLIBINSERTRULE_A, FLLIBINSERTRULE_Z, FLLIBDELETERULE_A,
+ or FLLIBDELETERULE_Z. dynrule is similar to rule but its head is a list
****************************************************************************/
flora_write_dynrulelist([],_Lib) :- !.
flora_write_dynrulelist([Term],Lib) :-
- is_prrule(Term,HeadList,Body),
+ is_prdynrule(Term,HeadList,Body,HVars,BVars),
!,
flora_write_atom(FLSYSRULEUPDATE),
put(0'(),
flora_set_counter(using_debug_prefix,0),
is_prlist(HeadList,Head,_T,_I),
put(0'[),
- (Lib==FLLIBINSERTRULE_A ->
+ ((Lib==FLLIBINSERTRULE_A;Lib==FLLIBDELETERULE_A) ->
flora_write_structlist(Head,FLDYNAPREFIX)
;
flora_write_structlist(Head,FLDYNZPREFIX)
@@ -952,6 +958,10 @@
flora_set_counter(using_debug_prefix,1),
put(0',),
flora_write_struct(Body,FLBODYPREFIX),
+ put(0',),
+ flora_write_struct(HVars,FLBODYPREFIX),
+ put(0',),
+ flora_write_struct(BVars,FLBODYPREFIX),
flora_write_atom(')').
flora_write_dynrulelist([H|L],Lib) :-
@@ -959,7 +969,6 @@
put(0',),
flora_write_dynrulelist(L,Lib).
-
/****************************************************************************
flora_write_newpred(+F,+N,+Args,+Prefix)
****************************************************************************/
@@ -1428,7 +1437,7 @@
).
flora_build_syslib(Lib,1,[WrappedList],DWS,Prefix,VarList,Code,CInd) :-
- (Lib==FLLIBINSERTRULE_A; Lib==FLLIBINSERTRULE_Z),
+ is_ruleupdate(Lib),
!,
is_prlist(WrappedList,List,_T,_I),
flora_build_dynrulelist(List,Lib,DWS,Prefix,VarList,RLCode,RLCInd),
@@ -1444,18 +1453,20 @@
****************************************************************************/
flora_build_dynrulelist([],_Lib,_DWS,_Prefix,_VarList,[],[]) :- !.
flora_build_dynrulelist([Term|T],Lib,DWS,Prefix,VarList,[Code|TCode],[CInd|TCInd]) :-
- is_prrule(Term,HeadList,Body),
+ is_prdynrule(Term,HeadList,Body,HVars,BVars),
flora_set_counter(using_debug_prefix,0),
is_prlist(HeadList,Head,_T,_I),
- (Lib==FLLIBINSERTRULE_A ->
+ ((Lib==FLLIBINSERTRULE_A;Lib==FLLIBDELETERULE_A) ->
flora_build_structlist(Head,DWS,FLDYNAPREFIX,VarList,HCode,HICode)
;
flora_build_structlist(Head,DWS,FLDYNZPREFIX,VarList,HCode,HICode)
),
flora_set_counter(using_debug_prefix,1),
flora_build_struct(Body,DWS,FLBODYPREFIX,VarList,BCode,BICode),
- Code =.. [FLSYSRULEUPDATE,HCode,BCode],
- CInd =.. [FLSYSRULEUPDATE,HICode,BICode],
+ flora_build_struct(HVars,DWS,FLBODYPREFIX,VarList,HVCode,HVICode),
+ flora_build_struct(BVars,DWS,FLBODYPREFIX,VarList,BVCode,BVICode),
+ Code =.. [FLSYSRULEUPDATE,HCode,BCode,HVCode,BVCode],
+ CInd =.. [FLSYSRULEUPDATE,HICode,BICode,HVICode,BVICode],
flora_build_dynrulelist(T,Lib,DWS,Prefix,VarList,TCode,TCInd).
/****************************************************************************
Index: flrcompiler.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrcompiler.P,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- flrcompiler.P 21 Mar 2003 02:31:03 -0000 1.20
+++ flrcompiler.P 26 Mar 2003 17:32:20 -0000 1.21
@@ -56,6 +56,8 @@
is_flquery(FLQUERY(Body),Body).
is_fldirective(FLDIRECTIVE(DirectList),DirectList).
+is_fldynrule(FLDYNRULE(Head,Body),Head,Body).
+
is_flcommand(FLCOMMAND(C),C).
is_fltable(FLTABLE(P,A),P,A).
is_fltable(FLTABLE(M,P,A),M,P,A).
@@ -124,7 +126,7 @@
%% Op is needed for newmodule only because of its position information
is_flnewmodule(FLNEWMODULE(Op,ModList),Op,ModList).
-is_flinsertrule(FLINSERTRULE(Op,RuleList),Op,RuleList).
+is_flupdaterule(FLUPDATERULE(Op,RuleList),Op,RuleList).
is_flaggregate(FLAGGREGATE(Op,V,GV,Goal),Op,V,GV,Goal).
@@ -217,11 +219,12 @@
encoding utilities
****************************************************************************/
rule_struct(Head,Body,PRRULE(Head,Body)).
-
fact_struct(Head,PRFACT(Head)).
query_struct(Goal,PRQUERY(Goal)).
directive_struct(Direct,PRDIRECTIVE(Direct)).
+dynrule_struct(Head,Body,HVars,BVars,PRDYNRULE(Head,Body,HVars,BVars)).
+
reify_struct(Formula,PRREIFY(Formula)).
command_struct(C,PRCOMMAND(C)).
@@ -449,8 +452,10 @@
delete_syslib(FL_BTERASE,FLLIBBTERASE) :- !.
delete_syslib(FL_BTERASEALL,FLLIBBTERASEALL) :- !.
-insertrule_syslib(FL_INSERTRULE_A,FLLIBINSERTRULE_A) :- !.
-insertrule_syslib(FL_INSERTRULE_Z,FLLIBINSERTRULE_Z) :- !.
+updaterule_syslib(FL_INSERTRULE_A,FLLIBINSERTRULE_A) :- !.
+updaterule_syslib(FL_INSERTRULE_Z,FLLIBINSERTRULE_Z) :- !.
+updaterule_syslib(FL_DELETERULE_A,FLLIBDELETERULE_A) :- !.
+updaterule_syslib(FL_DELETERULE_Z,FLLIBDELETERULE_Z) :- !.
aggregate_struct(Op,V,GV,B,Object,Code) :-
%% Index denotes the textual information for the aggregate
@@ -1354,6 +1359,9 @@
; is_flworkspace(ParserTerm,P,WS) ->
compile_head_wsliteral(P,WS,Code,Status)
+ ; is_flvar(ParserTerm,Name,Index) ->
+ compile_flvar(Name,Index,Code),
+ Status=[]
;
atomlit_struct(ParserTerm,Code),
Status=[]
@@ -1479,8 +1487,8 @@
Status=[],
OidCode=NULL
- ; is_flinsertrule(ParserTerm,Op,List) ->
- compile_flinsertrule(Op,List,SpecCode,Status),
+ ; is_flupdaterule(ParserTerm,Op,List) ->
+ compile_flupdaterule(Op,List,SpecCode,Status),
OidCode=NULL
@@ -4030,38 +4038,43 @@
%% The name of the module is known.
storage_struct(WS,SCode)
;
- thisstorage_struct(fdb,SCode)
+ thisstorage_struct(fdb,SCode),
+ thismodule_struct(WS)
),
atomobj_struct(FLSYSDBUPDATE,FCode),
- prologterm_struct(FCode,2,[C,SCode],DBCode),
+ prologterm_struct(FCode,3,[C,SCode,WS],DBCode),
compile_dbupdate_list(CL,DBCodeList).
/****************************************************************************
- compile_flinsertrule(+Op,+List,-Code,Status)
+ compile_flupdatetrule(+Op,+List,-Code,Status)
****************************************************************************/
-compile_flinsertrule(Op,List,Code,Status) :-
+compile_flupdaterule(Op,List,Code,Status) :-
is_flatom(Op,OpAtom,Index),
- compile_flinsertrule_list(List,CodeList,Status),
+ compile_fldynrule_list(List,CodeList,Status),
( Status == [] ->
list_struct(CodeList,[],ListCode),
- insertrule_syslib(OpAtom,InsertruleLib),
+ updaterule_syslib(OpAtom,InsertruleLib),
florasyslib_struct(Index,InsertruleLib,1,[ListCode],Code)
;
true
).
-compile_flinsertrule_list([],[],[]) :- !.
-compile_flinsertrule_list([H|L],[HCode|LCode],Status) :-
- is_flrule(H,Head,Body),
+compile_fldynrule_list([],[],[]) :- !.
+compile_fldynrule_list([H|L],[HCode|LCode],Status) :-
+ is_fldynrule(H,Head,Body),
compile_head(Head,HeadCode,HS),
+ collect_namevars(Head,HeadVars),
+ list_struct(HeadVars,[],HVL),
compile_conjunct2list(HeadCode,HeadCodeListPre),
remove_empty_list(HeadCodeListPre,HeadCodeList),
( HS == [] ->
compile_body(Body,BodyCode,BS),
( BS == [] ->
+ collect_namevars(Body,BodyVars),
+ list_struct(BodyVars,[],BVL),
list_struct(HeadCodeList,[],HCL),
- rule_struct(HCL,BodyCode,HCode),
- compile_flinsertrule_list(L,LCode,Status)
+ dynrule_struct(HCL,BodyCode,HVL,BVL,HCode),
+ compile_fldynrule_list(L,LCode,Status)
;
Status=BS
)
Index: flrdependency.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrdependency.P,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- flrdependency.P 5 Sep 2002 02:33:04 -0000 1.4
+++ flrdependency.P 26 Mar 2003 17:32:21 -0000 1.5
@@ -460,9 +460,9 @@
assert_rules(HeadCode,Args,ArgsI,anu(A,N,U)).
assert_rule(HeadCode,BodyCode,(BCI,_I),anu(A,N,U)) :-
- BodyCode = flsysdbupdate(NewBody,_),
+ BodyCode = flsysdbupdate(NewBody,_,_),
!,
- BCI = flsysdbupdate(NewBCI,_),
+ BCI = flsysdbupdate(NewBCI,_,_),
assert_rule(HeadCode,NewBody,NewBCI,anu(A,N,U)).
assert_rule(HeadCode,BodyCode,BCwithIndex,anu(A,N,U)) :-
Index: flrhilogtable.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrhilogtable.H,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- flrhilogtable.H 23 Feb 2003 08:25:57 -0000 1.5
+++ flrhilogtable.H 26 Mar 2003 17:32:22 -0000 1.6
@@ -54,17 +54,12 @@
from flrporting.
:- import
- flora_error_line/1,
- flora_error_line/2
+ flora_error_line/1
from flrprint.
:- import
flora_storage_check_module_name/1
from flrstorage.
-
-:- import
- flora_module_registry/1
- from flrregistry.
:- export
flora_hilogtable/2,
Index: flrhilogtable.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrhilogtable.P,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- flrhilogtable.P 23 Feb 2003 08:25:57 -0000 1.6
+++ flrhilogtable.P 26 Mar 2003 17:32:22 -0000 1.7
@@ -29,6 +29,7 @@
#include "flora_terms.flh"
+#include "flora_exceptions.flh"
/****************************************************************************
flora_reset_hilogtable/0
@@ -61,12 +62,6 @@
****************************************************************************/
flora_shdefine_hilogtable(Module,Functor,Arity) :-
flora_storage_check_module_name(Module),
- ( flora_module_registry(Module) ->
- true
- ;
- flora_error_line("Module `~w' does not exist", [Module]),
- flora_abort
- ),
( flora_check_not_tabled_registry(Module,Functor,Arity) ->
flora_error_line('Unable to table predicates that already appear in rule heads'),
flora_abort
Index: flrlibman.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrlibman.P,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- flrlibman.P 14 Mar 2003 07:58:24 -0000 1.6
+++ flrlibman.P 26 Mar 2003 17:32:22 -0000 1.7
@@ -179,6 +179,8 @@
flora_library_file(FLLIBNEWMODULE,flrdynrule,syslib) :- !.
flora_library_file(FLLIBINSERTRULE_A,flrdynrule,syslib) :- !.
flora_library_file(FLLIBINSERTRULE_Z,flrdynrule,syslib) :- !.
+flora_library_file(FLLIBDELETERULE_A,flrdynrule,syslib) :- !.
+flora_library_file(FLLIBDELETERULE_Z,flrdynrule,syslib) :- !.
flora_library_file(FLLIBCONTROL,flrcontrol,syslib) :- !.
flora_library_file(FLLIBIFTHENELSE,flrcontrol,syslib) :- !.
Index: flrnodefp.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrnodefp.P,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- flrnodefp.P 30 Jan 2003 02:40:55 -0000 1.2
+++ flrnodefp.P 26 Mar 2003 17:32:23 -0000 1.3
@@ -66,7 +66,6 @@
flora_nodefp(FL_IMPLYOP,1) :- !.
flora_nodefp(FL_QUERYOP,1) :- !.
-
%% FLORA builtins
flora_nodefp(FL_UNIVEQFORM,2) :- !.
flora_nodefp(FL_REIFYOP,1) :- !.
Index: flrparser.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrparser.P,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- flrparser.P 18 Mar 2003 06:46:06 -0000 1.20
+++ flrparser.P 26 Mar 2003 17:32:23 -0000 1.21
@@ -494,6 +494,8 @@
flquery_struct(Body,FLQUERY(Body)).
fldirective_struct(Direct,FLDIRECTIVE(Direct)).
+fldynrule_struct(Head,Body,FLDYNRULE(Head,Body)).
+
flcmddirect_struct(C,FLCOMMAND(C)).
fltbldirect_struct(F,A,FLTABLE(F,A)).
fltbldirect_struct(M,F,A,FLTABLE(M,F,A)).
@@ -629,8 +631,10 @@
is_throwop(FL_THROW) :- !.
is_p2hop(FL_P2H) :- !.
-is_ruleinsertop(FL_INSERTRULE_A) :- !.
-is_ruleinsertop(FL_INSERTRULE_Z) :- !.
+is_ruleupdateop(FL_INSERTRULE_A) :- !.
+is_ruleupdateop(FL_INSERTRULE_Z) :- !.
+is_ruleupdateop(FL_DELETERULE_A) :- !.
+is_ruleupdateop(FL_DELETERULE_Z) :- !.
is_reifyop(FL_REIFYOP) :- !.
@@ -642,7 +646,7 @@
fldelete_struct(Op,List,FLDELETE(Op,List)).
flnewmodule_struct(Op,Mod,FLNEWMODULE(Op,Mod)).
-flinsertrule_struct(Op,RuleList,FLINSERTRULE(Op,RuleList)).
+flupdaterule_struct(Op,RuleList,FLUPDATERULE(Op,RuleList)).
flifthenelse_struct(Cond,Then,Else,FLIFTHENELSE(Cond,Then,Else)).
flifthen_struct(Cond,Then,FLIFTHEN(Cond,Then)).
@@ -1913,19 +1917,19 @@
parsing_error(Ip,ERROR_NEWMODULE,Status)
).
-%% insertrule_a{...} or insertrule_z{...}
+%% insertrule_a{...}, insertrule_z{...}, deleterule_a{...}, or
+%% deleterule_z{...}
flora_body_literal(CANOTERM(Funct,N,FL_BRACE,Args,_If,Ip),Code,Status) :-
get_name(Funct,Atom),
- is_ruleinsertop(Atom),
+ is_ruleupdateop(Atom),
!,
( N == 0 ->
parsing_error(Ip,EXP_ARGS,Status)
;
flobject_struct(Funct,FCode),
- flora_ruleinsert(FCode,N,Args,Code,Status)
+ flora_ruleupdate(FCode,N,Args,Code,Status)
).
-
%% :=:
flora_body_literal(CANOTERM(Funct,2,FL_PARENTHESIS,Args,_If,_Ip),Code,Status) :-
get_atom(Funct,FL_OBJEQL),
@@ -2018,7 +2022,7 @@
flora_body_wsliteral(CANOTERM(Funct,_N,FL_BRACE,_Args,_If,Ip),_Code,Status) :-
get_atom(Funct,F),
- ((is_dbinsertop(F); is_dbdeleteop(F); is_ruleinsertop(F)) ->
+ ((is_dbinsertop(F); is_dbdeleteop(F); is_ruleupdateop(F)) ->
parsing_error(Ip,NO_WORKSPACE,Status)
).
@@ -2628,7 +2632,7 @@
)
; get_name(Funct,FAtom),
- (is_dbinsertop(FAtom); is_dbdeleteop(FAtom); is_ruleinsertop(FAtom)) ->
+ (is_dbinsertop(FAtom); is_dbdeleteop(FAtom); is_ruleupdateop(FAtom)) ->
parsing_error(If,ERROR_UPDATEOP,Status)
;
parsing_error(If,UNKNOWN_AGGREGT,Status)
@@ -3581,12 +3585,15 @@
flora_db_pathexp(Mode,CanoniTerm,Code,Status).
/****************************************************************************
- flora_ruleinsert(+OpCode,+N,+ArgsList,-Code,-Status)
+ flora_ruleupdate(+OpCode,+N,+ArgsList,-Code,-Status)
****************************************************************************/
-flora_ruleinsert(OpCode,_N,Args,Code,Status) :-
+flora_ruleupdate(OpCode,_N,Args,Code,Status) :-
flora_dynrule_list(Args,CodeList,Status),
- (Status == [] -> flinsertrule_struct(OpCode,CodeList,Code); true).
+ (Status == [] -> flupdaterule_struct(OpCode,CodeList,Code); true).
+/****************************************************************************
+ flora_dynrule_list(+RuleList,-CodeList,-Status)
+****************************************************************************/
flora_dynrule_list([],[],[]) :- !.
flora_dynrule_list([H|T],CodeList,Status) :-
!,
@@ -3659,11 +3666,11 @@
flora_wsdynrule(CanoniTerm,WS,[Code],Status) :-
( is_rule(CanoniTerm,Head,Body) ->
- flora_head(Head,HCL,S),
+ flora_dynhead(Head,HCL,S),
( S == [] ->
flora_body(Body,FLORAUSERMOD(WS),BodyCode,Status),
flmodule_structlist(HCL,WS,FLORAUSERMOD,WSHCL),
- flrule_struct(WSHCL,BodyCode,Code)
+ fldynrule_struct(WSHCL,BodyCode,Code)
;
Status=S
)
@@ -3676,15 +3683,62 @@
****************************************************************************/
flora_dynrl(CanoniTerm,Code,Status) :-
( is_rule(CanoniTerm,Head,Body) ->
- flora_head(Head,HCL,S),
+ flora_dynhead(Head,HCL,S),
( S == [] ->
flora_body(Body,BodyCode,Status),
- flrule_struct(HCL,BodyCode,Code)
+ fldynrule_struct(HCL,BodyCode,Code)
;
Status=S
)
;
parsing_error(CanoniTerm, EXP_RULES, Status)
+ ).
+
+/****************************************************************************
+ flora_dynhead(+CanoniTerm,-CodeList,-Status)
+
+ Similar to flora_head, but each element of the conjuction may be a
+ normal variable or flora_head_literal
+****************************************************************************/
+flora_dynhead(CANOTERM(Funct,2,FL_PARENTHESIS,[L,R],If,_Ip),CodeList,Status) :-
+ get_atom(Funct,F),
+ ( F == FL_COMMA ->
+ flora_dynhead(L,LCodeList,S),
+ ( S == [] ->
+ flora_dynhead(R,RCodeList,Status),
+ ( Status == [] ->
+ append(LCodeList,RCodeList,CodeList)
+ ;
+ true
+ )
+ ;
+ Status=S
+ )
+
+ ; F == FL_SEMICOLON -> % Disjunction is prohibited.
+ parsing_error(If,NO_DISJUNCTION,Status)
+
+ ; % Module name in rule head is prohibited.
+ F == FL_AT,
+ parsing_error(If,NO_WSINRULEHEAD,Status)
+ ),
+ !.
+
+flora_dynhead(CANOTERM(Funct,1,FL_PARENTHESIS,[_G],If,_Ip),_CodeList,Status) :-
+ get_atom(Funct,F),
+ (is_notop(F); is_tnotop(F)),
+ !,
+ parsing_error(If,NO_NEGATION,Status).
+
+flora_dynhead(CanoniTerm,[Code],Status) :-
+ ( get_flvar_struct(CanoniTerm, Code) ->
+ ( Code=FLVAR(FL_UNDERSCORE,I) ->
+ parsing_error(I,ERROR_HDLITERAL,Status)
+ ;
+ Status=[]
+ )
+ ;
+ flora_head_literal(CanoniTerm,Code,Status)
).
/****************************************************************************
Index: flrutils.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrutils.H,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- flrutils.H 24 Mar 2003 08:08:42 -0000 1.14
+++ flrutils.H 26 Mar 2003 17:32:23 -0000 1.15
@@ -202,6 +202,7 @@
flora_set_xpp_options_for_read/1,
flora_set_xpp_options_for_read/2,
flora_clear_xpp_options/0,
+ flora_add_xpp_options/1,
flora_list2conjunct/2,
flora_check_workspace/1,
Index: flrutils.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrutils.P,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- flrutils.P 24 Mar 2003 08:08:42 -0000 1.19
+++ flrutils.P 26 Mar 2003 17:32:24 -0000 1.20
@@ -269,7 +269,7 @@
flora_patch_full_filename(PatchFullName),
telling(PreOutFile),
tell(PatchFullName),
- flora_include_file([FLHEADER,FLHEADER2,FLDEFINITION,FLPATCH,FLDYNA,
+ flora_include_file([FLHEADER,FLDEFINITION,FLHEADER2,FLPATCH,FLDYNA,
FLDYNZ,FLPREDDEF,FLREFRESHTABLE],
HeaderStatus),
told,
Index: flrwrapper.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrwrapper.H,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- flrwrapper.H 10 Mar 2003 07:38:13 -0000 1.8
+++ flrwrapper.H 26 Mar 2003 17:32:25 -0000 1.9
@@ -33,6 +33,7 @@
:- dynamic flora_flogic_fact_wrapper(_,_).
:- dynamic flora_current_flogic_module(_).
+:- dynamic flora_decode_pred(_,_,_,_).
:- index(flora_flogic_fact_wrapper/2,trie).
:- index(flora_current_flogic_module/1,trie).
Index: flrwrapper.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrwrapper.P,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- flrwrapper.P 24 Mar 2003 03:53:55 -0000 1.13
+++ flrwrapper.P 26 Mar 2003 17:32:25 -0000 1.14
@@ -37,8 +37,16 @@
Flora user module.
*****************************************************************************/
flora_user_module_predicate(Functor,Args,WS,Predicate) :-
+ flora_user_module_functor(Functor,WS,PF),
+ Predicate =.. [PF|Args].
+
+flora_user_module_functor(Functor,WS,PF) :-
+ flora_decode_pred(Functor,WS,user,PF),
+ !.
+
+flora_user_module_functor(Functor,WS,PF) :-
flora_concat_atoms([FLORA_USER_MODULE_PREFIX,'''',WS,'''',Functor],PF),
- Predicate =.. [PF|Args].
+ assert(flora_decode_pred(Functor,WS,user,PF)).
/*****************************************************************************
@@ -49,9 +57,16 @@
to a Flora system module.
*****************************************************************************/
flora_system_module_predicate(Functor,Args,SysModID,Predicate) :-
- flora_concat_atoms([FLORA_SYSTEM_MODULE_PREFIX,'''',SysModID,'''',Functor],PF),
+ flora_system_module_functor(Functor,SysModID,PF),
Predicate =.. [PF|Args].
+flora_system_module_functor(Functor,SysModID,PF) :-
+ flora_decode_pred(Functor,SysModID,system,PF),
+ !.
+
+flora_system_module_functor(Functor,SysModID,PF) :-
+ flora_concat_atoms([FLORA_SYSTEM_MODULE_PREFIX,'''',SysModID,'''',Functor],PF),
+ assert(flora_decode_pred(Functor,SysModID,system,PF)).
/*****************************************************************************
flora_module_predicate(+Functor,+Args,+ModuleName,-Predicate)
|
|
From: <ch...@us...> - 2003-03-26 17:31:33
|
Update of /cvsroot/flora/flora2/flrincludes
In directory sc8-pr-cvs1:/tmp/cvs-serv9360/flrincludes
Modified Files:
flora_terms.flh
Log Message:
add rule deletion; check module existence for db updates; add var checks for rule insertion
Index: flora_terms.flh
===================================================================
RCS file: /cvsroot/flora/flora2/flrincludes/flora_terms.flh,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- flora_terms.flh 21 Mar 2003 02:31:01 -0000 1.16
+++ flora_terms.flh 26 Mar 2003 17:31:29 -0000 1.17
@@ -222,7 +222,8 @@
#define FL_NEWMODULE newmodule
#define FL_INSERTRULE_A insertrule_a
#define FL_INSERTRULE_Z insertrule_z
-
+#define FL_DELETERULE_A deleterule_a
+#define FL_DELETERULE_Z deleterule_z
#define FL_CONSTRAINT_START '{'
#define FL_CONSTRAINT_END '}'
@@ -292,7 +293,7 @@
FLREFRESH(Op,LiteralList)
FLNEWMODULE(Module)
- FLINSERTRULE(Op,RuleList)
+ FLUPDATERULE(Op,RuleList)
FLIFTHEN(IfCondition,ThenStatement)
FLIFTHENELSE(IfCondition,ThenStatement,ElseStatement)
@@ -318,6 +319,8 @@
#define FLQUERY flquery
#define FLDIRECTIVE fldirective
+#define FLDYNRULE fldynrule
+
#define FLCOMMAND flcommand
#define FLTABLE fltable
#define FLIMPORT flimport
@@ -366,7 +369,7 @@
#define FLREFRESH flrefresh
#define FLNEWMODULE flnewmodule
-#define FLINSERTRULE flinsertrule
+#define FLUPDATERULE flupdaterule
#define FLCONSTRAINT flconstraint
@@ -412,6 +415,8 @@
#define PRQUERY prquery
#define PRDIRECTIVE prdirective
+#define PRDYNRULE prdynrule
+
#define PRREIFY prreify
#define PRCONSTRAINT prconstraint
@@ -596,6 +601,8 @@
#define FLLIBNEWMODULE fllibnewmodule
#define FLLIBINSERTRULE_A fllibinsertrule_a
#define FLLIBINSERTRULE_Z fllibinsertrule_z
+#define FLLIBDELETERULE_A fllibdeleterule_a
+#define FLLIBDELETERULE_Z fllibdeleterule_z
#define FLLIBSHDIRECT fllibshdirect
@@ -735,3 +742,4 @@
xsb compiler options
****************************************************************************/
#define XSB_SPECREPR spec_repr
+
|
|
From: <ch...@us...> - 2003-03-26 17:31:33
|
Update of /cvsroot/flora/flora2/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv9360/docs
Modified Files:
dynamic_rule.txt flora2.tex
Log Message:
add rule deletion; check module existence for db updates; add var checks for rule insertion
Index: dynamic_rule.txt
===================================================================
RCS file: /cvsroot/flora/flora2/docs/dynamic_rule.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dynamic_rule.txt 26 Nov 2002 21:06:51 -0000 1.2
+++ dynamic_rule.txt 26 Mar 2003 17:31:26 -0000 1.3
@@ -1,5 +1,5 @@
-DYNAMICALLY CREATING MODULES AND INSERTING RULES
-================================================
+DYNAMICALLY CREATING MODULES, INSERTING RULES, AND DELETING RULES
+=================================================================
Chang Zhao, Nov. 25, 2002
1. Syntax
@@ -25,7 +25,13 @@
variable, or _@. At runtime, the system will check to make sure that Module
is bound to some already loaded module name.
-(3) table syntax
+(3) delete a list of rules
+ deleterule_a{RuleList}
+ or
+ deleterule_z{RuleList}
+where RuleList is the same as rule insertion.
+
+(4) table syntax
The compile directive table can't be used to table predicates in other modules.
To be able to table predicates in another module, the instruction
?- table(Module, SpecList).
@@ -37,7 +43,7 @@
a) the head is subsumed by Pred/Arity
b) when the rule is compiled/inserted, it's not tabled
-(4) index syntax
+(5) index syntax
Similarly, the compile directive index can't be used to index predicates in
other modules. But the instruct index can:
?- index(Module, Arity-Position).
@@ -47,7 +53,7 @@
?- index(Wrap_dyna_hilog_of_Module/A,P).
?- index(Wrap_dynz_hilog_of_Module/A,P).
-(5) example
+(6) example
A simple example is as follows:
e(a,b). e(b,c). e(c,d).
?- newmodule{mod1}.
@@ -56,6 +62,12 @@
((tc(X,Y) :- tc(X,Z),e(Z,Y)@_@)@M)
}.
?- tc(X,Y)@mod1.
+?- deleterule_a{(tc(X,Y) :- tc(X,Z),e(Z,Y)@_@)@mod1}.
+?- refresh{tc(X,Y)}.
+?- tc(X,Y)@mod1.
+?- M=mod1, deleterule_a{(tc(X,Y) :- P@SomeModule)@M}.
+?- refresh{tc(X,Y)}.
+?- tc(X,Y)@mod1.
2. Implementation
@@ -96,7 +108,40 @@
WRAP_HILOG(X1,X2) :- WRAP_DYNZ_HILOG(X1,X2).
derived_isa(X,Y) :- WRAP_DYNZ_ISA(X,Y).
-(3) compilation
+(3) flora_rule_signature(Head,BodySignature,RuleList,BridgeRuleList)
+We maintain a flora_rule_signature record for each dynamic rule. When the rule
+is inserted, its signature is inserted into flora_rule_signature. When it is
+deleted, its signature is deleted from flora_rule_signature. This is necessary
+mainly because of two reasons:
+ a) A rule inserted may correspond to as many as three rules because of
+ conjuction in rule head and tabling. For example
+ :- table p/1.
+ ?- insertrule_a{(p(X),q(X)) :- r(X)}.
+ the rule p(X):-r(X) is actually translated into three rules:
+ newpredicate1(X) :- r(X).
+ flapply(p,X) :- tabled_flapply(p,X,1).
+ tabled_flapply(p,X,1) :- newpredicate1(X).
+ In this case, BridgeRuleList is [newpredicate1(X):-r(X)], and RuleList is
+ [(flapply(p,X):-tabled_flapply(p,X,1)),
+ (tabled_flapply(p,X,1):-newpredicate(X))].
+
+ b) We want the dynamic rule p(X) :- p(X)@foo be deleted when the user issues
+ ?- deleterule_a{p(X) :- p(X)@M}.
+ To make 'usermod'foo'flapply(p,X) unify with fllibmodlit(flapply,[p,X],M),
+ we build the canonical form BodySignature of rule body when the rule is
+ inserted. When a rule is to be deleted, its canonical form is buit and
+ match with those in flora_rule_signature. BodySignature takes the form:
+ (Wrap,Args,Module,Callable)
+ Some examples are as follows:
+ p(a)@foo canonical: (flapply,[p,a],foo,p(a)@foo)
+ X@Y canonical: (_P,_A,Y,X)
+ a:b@X canonical: (d_isa,[a,b],X,_Call)
+
+Notice that flora_rule_signature contains Head instead of HeadSigature,
+because it is required that the predicate name and module name of the rule
+head be bound when the rule is to be deleted.
+
+(4) compilation
Similar to insert and delete, newmodule and insertrule_a (insertrule_z) are
compiled into system calls FLLIBNEWMODULE and FLLIBINSERTRULE_A
(FLLIBINSERTRULE_Z), respectively. Something noticeable is that the split of
@@ -113,7 +158,7 @@
The distribution of workspace occurs at compile time. FLLIBMODLIT is still used
for variable module name.
-(4) execution
+(5) execution
FLLIBNEWMODULE(Module) is treated as FLLIBNEWMODULE(Module,NONE).
FLLIBNEWMODULE(Module,TrailerType) first checks to make sure Module is bound
to an atom which is not an existing module name. Then it compiles and loads
@@ -121,15 +166,16 @@
FLLIBINSERTRULE_A(RuleList) does the following for each element Rule in the
list RuleList, where Rule is encoded as FLSYSRULEUPDATE(HeadList,Body):
- a) remove fllibmodlit in Body where module name is already bound. Currently
+ a) build the canonical form of the rule body
+ b) remove fllibmodlit in Body where module name is already bound. Currently
this is only done for the subgoals and control constructs but not for meta
arguments.
- b) if there is only one element Head in HeadList, go to c). else generate
+ c) if there is only one element Head in HeadList, go to c). else generate
a new predicate in the same module as those in the HeadList. Its arguments
are all the variables in Body. A global counter is maintained to generate
new predicates. Assert a rule whose head is this new predicate and the body
is Body. For each element Head in HeadList and the new predicate, do c).
- c) for a rule to be inserted with Head and Body, first get rid of
+ d) for a rule to be inserted with Head and Body, first get rid of
fllibmodlit from Head if any. Then get the module name from Head and checks
whether it is a loaded user module. The Head might be
* a tabled hilog predicate Pred(Args)
@@ -144,13 +190,22 @@
WRAP_DYNA_HILOG(Pred,Args) :- Body.
* otherwise just assert
Head :- Body.
- d) insert the skeleton of the head into corresponding fld trie.
+ e) insert a record into flora_rule_signature
+ f) insert the skeleton of the head into corresponding fld trie.
FLLIBINSERTRULE_Z(RuleList) is almost the same as FLLIBINSERTRULE_A(RuleList),
but just substitute WRAP_DYNA_HILOG with WRAP_DYNZ_HILOG.
+FLLIBDELETERULE_A(RuleList) and FLLIBDELETERULE_Z(RuleList) does the following:
+ for each element FLSYSRULEUPDATE(HeadList,Body) in RuleList
+ build the canonical form BodySig of Body
+ for each element Head in HeadList
+ find a flora_rule_signature record with the Head and BodySig
+ delete related rules as directed by the record
+ end for
+ end for
+
3. What's left
-(1) deleterule
-(2) cut in rules inserted by insertrule_a doesn't not work properly
+(1) cut in rules inserted by insertrule_a doesn't not work properly
Index: flora2.tex
===================================================================
RCS file: /cvsroot/flora/flora2/docs/flora2.tex,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- flora2.tex 14 Mar 2003 07:58:22 -0000 1.40
+++ flora2.tex 26 Mar 2003 17:31:27 -0000 1.41
@@ -4668,29 +4668,33 @@
methods should not occur.
-\section{Rule Insertion}
+\section{Rule Insertion and Deletion}
\index{rule insertion}
+\index{rule deletion}
\index{rule!static}
\index{rule!dynamic}
\index{dynamic rule}
\index{static rule}
%%
-\FLORA supports \emph{non-backtrackable} insertion of rules into modules.
-A \FLORA module gets created when a program is loaded into it, as described
-in Section~\ref{sec-shell-commands}, or it can be created using the
-primitive {\tt newmodule}. Subsequently, rules can be added to an existing
-module. Rules that are inserted via the {\tt insertrule} command are
-called \emph{dynamic} and the rules loaded using the {\tt flLoad} or
-{\tt [...]} commands are called \emph{static} or \emph{compiled}.
-As mentioned in Section~\ref{sec-updates}, \FLORA predicates and molecules
-can have both static and dynamic parts and no special declaration is
-required to make a predicate dynamic. The same molecule or a predicate can
-be defined by a mixture of static or dynamic rules.
+\FLORA supports \emph{non-backtrackable} insertion of rules into modules
+as well as deletion of inserted rules. A \FLORA module gets created
+when a program is loaded into it, as described in
+Section~\ref{sec-shell-commands}, or it can be created using the
+primitive {\tt newmodule}. Subsequently, rules can be added to an
+existing module. Rules that are inserted via the {\tt insertrule}
+command are called \emph{dynamic} and the rules loaded using the {\tt
+flLoad} or {\tt [...]} commands are called \emph{static} or
+\emph{compiled}. Dynamic rules can be deleted via the {\tt deleterule}
+command. As mentioned in Section~\ref{sec-updates}, \FLORA predicates
+and molecules can have both static and dynamic parts and no special
+declaration is required to make a predicate dynamic. The same molecule
+or a predicate can be defined by a mixture of static or dynamic rules.
-In this section, we will first look at the syntax of creating new modules.
-Then we will describe how to insert rules and, finally, we address other
-related issues, including tabling, indexing, and the cut.
+In this section, we will first look at the syntax of creating new
+modules. Then we will describe how to insert rules and delete
+rules. Finally, we address other related issues, including tabling,
+indexing, and the cut.
\subsection{Creating a Module at Run-time}
@@ -4718,7 +4722,7 @@
\subsection{Inserting Rules}
-
+\label{sec-insertingrule}
\index{insertrule\_a}
\index{insertrule\_z}
@@ -4764,6 +4768,47 @@
For this to be executed successfully, the module {\tt mod1} must already
exist.
+
+\subsection{Deleting Rules}
+
+
+\index{deleterule\_a}
+\index{deleterule\_z}
+%%
+Dynamic rules inserted using {\tt insertrule\_a} can be deleted using
+the premitive {\tt deleterule\_a}, and rules inserted using {\tt
+insertrule\_z} can be deleted using the primitive {\tt
+deleterule\_z}. Similar to rule insertion, several rules can be deleted
+in the same command. The syntax of deleting a list of rules is as
+follows: {\tt
+\begin{quote}
+\emph{delruleop}\{\emph{rulelist}\}
+\end{quote}
+}
+\noindent
+where \emph{delruleop} is either {\tt deleterule\_a} or {\tt
+ deleterule\_z}, rulelist is a comma-separated list of rules, which
+ \emph{should not} terminate with a period.
+
+To delete the rules inserted in the second example of
+Section~\ref{sec-insertingrule}, we can use
+%%
+\begin{quote}
+\begin{verbatim}
+flora2 ?- deleterule_a{(X:student:-enroll(X,_T)),
+ (X:student:-enroll(X,_T))@mod1}.
+\end{verbatim}
+\end{quote}
+
+The head of the rule to be deleted must be specific. To make it clear,
+if we have
+%%
+\begin{quote}
+\begin{verbatim}
+flora2 ?- deleterule_a{(X:-Y@M1)@M2}.
+\end{verbatim}
+\end{quote}
+both X and M2 must be bound. But this is not required for Y and M1.
\subsection{Tabling and Indexing of Dynamically Defined Predicates}
|
Update of /cvsroot/flora/flora2/syslib
In directory sc8-pr-cvs1:/tmp/cvs-serv8813/syslib
Modified Files:
flrbtdbop.P flrdbop.P flrdecode.P flrdynrule.P flrmetaops.P
flrshdirect.P flrstorage.P flrtables.P
Added Files:
flrcanon.P
Log Message:
add rule deletion; check module existence for db updates; add var checks for rule insertion
--- NEW FILE: flrcanon.P ---
:- compiler_options([xpp_on]).
#include "flora_terms.flh"
:- import
flora_module_predicate/4,
flora_decode_predicate/6
from flrwrapper.
:- import
flora_concat_atoms/2
from flrporting.
:- export get_canonical_form/2.
get_canonical_form(Term,(_,_,_,Term)) :-
var(Term),
!.
%% Case of Var@...
get_canonical_form(FLLIBMODLIT(FL_LIBMOD,Term,Mod),(Wrap,Args,Module,Callable)) :-
!,
get_canonical_form(Term,Canon),
Canon = (Wrap,Args,NewMod,Callable),
(var(Term) -> Module = Mod
; var(NewMod) -> Module=Mod
; Module = NewMod
).
%% Case of nonvar@Var
get_canonical_form(FLLIBMODLIT(Wrap,Args,Mod), (Wrap,Args,Mod,Callable)) :-
!,
(var(Mod) -> true
; flora_module_predicate(Wrap,Args,Mod,Callable)
).
get_canonical_form(Term, Canon) :-
flora_decode_predicate(Term,Type,TermModuleName,Prefix,Wrapper,ArgL),
(Type = (hilog) ->
Canon = (WRAP_HILOG,[Wrapper|ArgL],TermModuleName,_)
; (atom(Prefix) -> flora_concat_atoms([Prefix,Wrapper],Wrapper1)
; Wrapper1 = Wrapper
),
Canon = (Wrapper1,ArgL,TermModuleName,Term)
).
Index: flrbtdbop.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrbtdbop.P,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- flrbtdbop.P 24 Mar 2003 08:08:41 -0000 1.7
+++ flrbtdbop.P 26 Mar 2003 17:30:31 -0000 1.8
@@ -49,7 +49,8 @@
flora_storage_check_module_name/1,
flora_storage_check_deletepredicate/2,
flora_storage_convertlist/3,
- flora_storage_is_negation_symbol/1
+ flora_storage_is_negation_symbol/1,
+ flora_storage_check_existence/1
from flrstorage.
:- import
@@ -93,8 +94,9 @@
!,
flora_abort('Uninstantiated argument in btinsert{...}').
-flora_storage_insertfacts_bt([FLSYSDBUPDATE(P,StorageName)|T]) :-
+flora_storage_insertfacts_bt([FLSYSDBUPDATE(P,StorageName,Module)|T]) :-
!,
+ flora_storage_check_existence(Module),
flora_internal_db_insert_bt(StorageName,P),
flora_storage_insertfacts_bt(T).
@@ -188,8 +190,9 @@
!,
flora_abort('Uninstantiated argument in btdelete{...}').
-FLLIBBTDELETE([FLSYSDBUPDATE(P,StorageName)],true) :-
+FLLIBBTDELETE([FLSYSDBUPDATE(P,StorageName,Module)],true) :-
!,
+ flora_storage_check_existence(Module),
flora_db_find_base(StorageName,P),
flora_internal_db_delete_bt(StorageName,P).
@@ -254,8 +257,9 @@
!,
flora_abort('Uninstantiated argument in btdeleteall{...}').
-FLLIBBTDELETEALL([FLSYSDBUPDATE(P,StorageName)],true) :-
+FLLIBBTDELETEALL([FLSYSDBUPDATE(P,StorageName,Module)],true) :-
!,
+ flora_storage_check_existence(Module),
flora_storage_deleteall_bt(P,StorageName).
FLLIBBTDELETEALL([FLLIBMODLIT(F,Args,ModuleName)],true) :-
Index: flrdbop.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrdbop.P,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- flrdbop.P 24 Mar 2003 08:08:41 -0000 1.7
+++ flrdbop.P 26 Mar 2003 17:30:32 -0000 1.8
@@ -49,7 +49,8 @@
flora_storage_check_module_name/1,
flora_storage_check_deletepredicate/2,
flora_storage_convertlist/3,
- flora_storage_is_negation_symbol/1
+ flora_storage_is_negation_symbol/1,
+ flora_storage_check_existence/1
from flrstorage.
:- import
@@ -93,8 +94,9 @@
!,
flora_abort('Uninstantiated argument in insert{...}').
-flora_storage_insertfacts([FLSYSDBUPDATE(P,StorageName)|T]) :-
+flora_storage_insertfacts([FLSYSDBUPDATE(P,StorageName,Module)|T]) :-
!,
+ flora_storage_check_existence(Module),
flora_internal_db_insert(StorageName,P),
flora_storage_insertfacts(T).
@@ -190,8 +192,9 @@
!,
flora_abort('Uninstantiated argument in delete{...}').
-FLLIBDELETE([FLSYSDBUPDATE(P,StorageName)],true) :-
+FLLIBDELETE([FLSYSDBUPDATE(P,StorageName,Module)],true) :-
!,
+ flora_storage_check_existence(Module),
flora_db_find_base(StorageName,P),
flora_internal_db_delete(StorageName,P).
@@ -256,8 +259,9 @@
!,
flora_abort('Uninstantiated argument in deleteall{...}').
-FLLIBDELETEALL([FLSYSDBUPDATE(P,StorageName)],true) :-
+FLLIBDELETEALL([FLSYSDBUPDATE(P,StorageName,Module)],true) :-
!,
+ flora_storage_check_existence(Module),
flora_storage_deleteall(P,StorageName).
FLLIBDELETEALL([FLLIBMODLIT(F,Args,ModuleName)],true) :-
Index: flrdecode.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrdecode.P,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- flrdecode.P 24 Mar 2003 08:08:41 -0000 1.5
+++ flrdecode.P 26 Mar 2003 17:30:33 -0000 1.6
@@ -327,9 +327,9 @@
decode_literal_internal(Query,QueryCode,0),
decode_update_literals(UpdLiterals,UpdLiteralsCode).
-%% decodes lists of update literals [FLSYSDBUPDATE(Lit,_Storage),...]
+%% decodes lists of update literals [FLSYSDBUPDATE(Lit,_Storage,_Module),...]
decode_update_literals([],[]) :- !.
-decode_update_literals([FLSYSDBUPDATE(Lit,_Storage)|T],[LitCode,Comma|TCode]) :-
+decode_update_literals([FLSYSDBUPDATE(Lit,_Storage,_Module)|T],[LitCode,Comma|TCode]) :-
!,
decode_literal_internal(Lit,LitCode,0),
(T == [] -> Comma = '' ; Comma = ', '),
Index: flrdynrule.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrdynrule.P,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- flrdynrule.P 24 Mar 2003 03:53:55 -0000 1.6
+++ flrdynrule.P 26 Mar 2003 17:30:33 -0000 1.7
@@ -35,18 +35,20 @@
flora_module_registry/1,
flora_trailer_registry/1
from flrregistry.
+:- import
+ flora_warning_line/2
+ from flrprint.
:- import
flora_patch_full_filename/1,
flora_set_xpp_options_for_compile/1,
+ flora_add_xpp_options/1,
flora_clear_xpp_options/0,
- flloadtrailer/2
+ flloadtrailer/2,
+ flora_abort/0,
+ flora_abort/1
from flrutils.
:- import
- flora_module_registry/1
- from flrregistry.
-
-:- import
flora_dyna_hilog_user_module_predicate_symbol/2,
flora_dynz_hilog_user_module_predicate_symbol/2,
flora_tdyn_hilog_user_module_predicate_symbol/2,
@@ -64,8 +66,11 @@
:- import
flora_storage_check_module_name/1
from flrstorage.
+:- import
+ get_canonical_form/2
+ from flrcanon.
-:- import flora_abort/1 from flrutils.
+:- dynamic flora_rule_signature(_,_,_,_).
/***********************************************************************
FLLIBNEWMODULE(+Module,[+TrailerType])
@@ -93,7 +98,7 @@
flora_set_xpp_options_for_compile(Module),
compile(PatchFullName,[optimize,ti_all]),
consult(PatchFullName),
- flloadtrailer(NONE,Module),
+ flloadtrailer(Trailer,Module),
flora_clear_xpp_options
).
@@ -110,9 +115,10 @@
process each element ([HeadList] :- Body) in the rule list
************************************************************************/
flora_insert_rules(_InsOp,[]) :- !.
-flora_insert_rules(InsOp,[FLSYSRULEUPDATE(HeadList,Body)|L]) :-
+flora_insert_rules(InsOp,[FLSYSRULEUPDATE(HeadList,Body,HVars,BVars)|L]) :-
+ flora_build_pred_signature(Body,BodySig),
inst_body(Body,InstBody),
- flora_expand_and_ins_rules(InsOp,HeadList,InstBody),
+ flora_expand_and_ins_rules(InsOp,HeadList,InstBody,BodySig,HVars,BVars),
flora_insert_rules(InsOp,L).
/***********************************************************************
@@ -121,118 +127,210 @@
predicate with all vars in the body as the arguments, and assert
a rule with the new predicate as the head and Body as the body
************************************************************************/
-flora_expand_and_ins_rules(_InsOp,[],_Body) :- !.
-flora_expand_and_ins_rules(InsOp,[Head],Body) :-
+flora_expand_and_ins_rules(_InsOp,[],_Body,_BodySig,_HVars,_BVars) :- !.
+flora_expand_and_ins_rules(InsOp,[Head],Body,BodySig,HVars,BVars) :-
!,
- flora_insert_rule(InsOp,Head,Body).
-flora_expand_and_ins_rules(InsOp,HeadList,Body) :-
+ flora_insert_rule(InsOp,Head,Body,BodySig,[],HVars,BVars).
+flora_expand_and_ins_rules(InsOp,HeadList,Body,BodySig,HVars,BVars) :-
HeadList=[H|_L],
- ( H=FLLIBMODLIT(_F,_Args1,MName) ->
- true
- ;
- flora_decode_predicate(H,_Type,MName,_Prefix,_Pred,_Args)
- ),
+ ( var(H) ->
+ flora_abort(['uninstantiated rule head'])
+ ;
+ ( H=FLLIBMODLIT(_F,_Args1,MName) ->
+ true
+ ;
+ flora_decode_predicate(H,Type,MName,_Prefix,_Pred,_Args),
+ (((Type==hilog);(Type==flora)) ->
+ true
+ ;
+ flora_abort(['invalid rule head'])
+ )
+ )
+ ),
flora_storage_check_module_name(MName),
- ( flora_module_registry(MName) ->
- true
- ;
- flora_abort([MName,': Module does not exist'])
- ),
new_dynpredicate(NewF),
collect_vars(Body,BodyVars),
sort(BodyVars,SortedBodyVars),
flora_module_predicate(NewF,SortedBodyVars,MName,NewPred),
Bridge =.. [FL_IMPLYOP,NewPred,Body],
assert(Bridge),
- flora_insert_rulelist(InsOp,HeadList,NewPred).
+ flora_insert_rulelist(InsOp,HeadList,NewPred,BodySig,[Bridge],HVars,BVars).
/***********************************************************************
- flora_insert_rulelist(+Op,+HeadList,+Body)
+ flora_insert_rulelist(+Op,+HeadList,+Body,+NamedHeadVars,+NamedBodyVars)
For each element E in the HeadList, call flora_insert_rule(Op,E,Body)
************************************************************************/
-flora_insert_rulelist(_InsOp,[],_Body) :- !.
-flora_insert_rulelist(InsOp,[H|L],Body) :-
- flora_insert_rule(InsOp,H,Body),
- flora_insert_rulelist(InsOp,L,Body).
+flora_insert_rulelist(_InsOp,[],_Body,_BodySig,_Bridge,_HVars,_BVars) :- !.
+flora_insert_rulelist(InsOp,[H|L],Body,BodySig,Bridge,HVars,BVars) :-
+ flora_insert_rule(InsOp,H,Body,BodySig,Bridge,HVars,BVars),
+ flora_insert_rulelist(InsOp,L,Body,BodySig,Bridge,HVars,BVars).
/***********************************************************************
- flora_insert_rules(+InsOp,+Head,+Body)
+ flora_insert_rules(+InsOp,+Head,+Body,+BodySignature,,+BridgeRule,
+ +NamedHeadVars, +NamedBodyVars)
Assert a rule with the given Head and Body and define the head for
undefinedness checking. If the head is a hilog predicate, wrap it
appropriately with WRAP_DYNA_HILOG, WRAP_DYNZ_HILOG, WRAP_TDYNA_HILOG,
or WRAP_TDYNZ_HILOG, and update flora_not_tabled_registry if the head
is not tabled
************************************************************************/
-flora_insert_rule(InsOp,Head,Body) :-
- ( Head=FLLIBMODLIT(F,Args1,MName) ->
- flora_storage_check_module_name(MName),
- ( flora_module_registry(MName) ->
- true
+flora_insert_rule(InsOp,Head,Body,BodySig,BridgeRule,HVars,BVars) :-
+ ( var(Head) ->
+ flora_abort(['uninstantiated rule head'])
+ ;
+ ( Head=FLLIBMODLIT(F,Args1,MName) ->
+ flora_storage_check_module_name(MName),
+ flora_module_predicate(F,Args1,MName,InstHead)
;
- flora_abort([MName,': Module does not exist'])
+ InstHead=Head
),
- flora_module_predicate(F,Args1,MName,InstHead)
- ;
- InstHead=Head
- ),
- flora_decode_predicate(InstHead,Type,Module,_Prefix,Pred,Args),
- ( (Type == hilog) ->
- ( InsOp == FLLIBINSERTRULE_A ->
- flora_dyna_hilog_user_module_predicate_symbol(Module,Wrapper)
+ check_vars(Head,Body,HVars,BVars),
+ flora_decode_predicate(InstHead,Type,Module,_Prefix,Pred,Args),
+ (((Type==hilog);(Type==flora)) ->
+ true
+ ;
+ flora_abort(['invalid rule head'])
+ ),
+ flora_storage_check_module_name(Module),
+ ( (Type == hilog) ->
+ ( InsOp == FLLIBINSERTRULE_A ->
+ flora_dyna_hilog_user_module_predicate_symbol(Module,Wrapper)
+ ;
+ flora_dynz_hilog_user_module_predicate_symbol(Module,Wrapper)
+ ),
+ NewHead =.. [Wrapper,Pred|Args],
+
+ runtime_get_fingerprint(Pred,Args,Funct,Arity),
+ ( flora_check_tabled_registry(Module,Funct,Arity) ->
+ conget(flora_global_tabled_dynrule_num,RN),
+ NewRN is RN+1,
+ conset(flora_global_tabled_dynrule_num,NewRN),
+ flora_tdyn_hilog_user_module_predicate_symbol(Module,TWrapper),
+ TabledHead =.. [TWrapper,RN,Pred|Args],
+ TabledRule =.. [FL_IMPLYOP,NewHead,TabledHead],
+ assert(TabledRule),
+ NewRule =.. [FL_IMPLYOP,TabledHead,Body],
+ assert(flora_rule_signature(NewHead,BodySig,[TabledRule,NewRule],BridgeRule))
+ ;
+ flora_enter_not_tabled_registry(Module,Funct,Arity),
+ NewRule =.. [FL_IMPLYOP,NewHead,Body],
+ assert(flora_rule_signature(NewHead,BodySig,[NewRule],BridgeRule))
+ )
;
- flora_dynz_hilog_user_module_predicate_symbol(Module,Wrapper)
+ ( is_invalid_flogic_head(Pred) ->
+ flora_abort('invalid rule head')
+ ;
+ NewRule =.. [FL_IMPLYOP,InstHead,Body],
+ assert(flora_rule_signature(InstHead,BodySig,[NewRule],BridgeRule))
+ )
),
- NewHead =.. [Wrapper,Pred|Args],
+ assert(NewRule),
+ (Pred==WRAP_OBJEQL ->
+ (flora_trailer_registry(Module),!;
+ ( flloadtrailer(BASIC,Module) ->
+ assert(flora_trailer_registry(Module))
+ ;
+ flora_abort
+ ))
+ ;
+ true
+ ),
+ flora_define_predicate(InstHead)
+ ).
+
- runtime_get_fingerprint(Pred,Args,Funct,Arity),
- ( flora_check_tabled_registry(Module,Funct,Arity) ->
- conget(flora_global_tabled_dynrule_num,RN),
- NewRN is RN+1,
- conset(flora_global_tabled_dynrule_num,NewRN),
- flora_tdyn_hilog_user_module_predicate_symbol(Module,TWrapper),
- TabledHead =.. [TWrapper,RN,Pred|Args],
- TabledRule =.. [FL_IMPLYOP,NewHead,TabledHead],
- assert(TabledRule),
- NewRule =.. [FL_IMPLYOP,TabledHead,Body]
+/***********************************************************************
+ FLLIBDELETERULE_A(+RuleList)
+ FLLIBDELETERULE_Z(+RuleList)
+************************************************************************/
+FLLIBDELETERULE_A(RuleList) :- flora_delete_rules(FLLIBDELETERULE_A,RuleList).
+FLLIBDELETERULE_Z(RuleList) :- flora_delete_rules(FLLIBDELETERULE_Z,RuleList).
+
+/***********************************************************************
+ flora_delete_rules(+DelOp,+RuleList)
+ InsOp is FLLIBDELETERULE_A or FLLIBDELETERULE_Z
+ process each element ([HeadList] :- Body) in the rule list
+************************************************************************/
+flora_delete_rules(_DelOp,[]) :- !.
+flora_delete_rules(DelOp,[FLSYSRULEUPDATE(HeadList,Body,_HV,_BV)|L]) :-
+ flora_build_pred_signature(Body,BodySig),
+ flora_delete_rulelist(DelOp,HeadList,BodySig),
+ flora_delete_rules(DelOp,L).
+
+flora_delete_rulelist(_DelOp,[],_BodySig) :- !.
+flora_delete_rulelist(DelOp,[H|L],BodySig) :-
+ flora_delete_rule(DelOp,H,BodySig),
+ flora_delete_rulelist(DelOp,L,BodySig).
+
+flora_delete_rule(DelOp,Head,BodySig) :-
+ ( var(Head) ->
+ flora_abort(['uninstantiated rule head'])
+ ;
+ ( Head=FLLIBMODLIT(F,Args1,MName) ->
+ flora_storage_check_module_name(MName),
+ flora_module_predicate(F,Args1,MName,InstHead)
;
- flora_enter_not_tabled_registry(Module,Funct,Arity),
- NewRule =.. [FL_IMPLYOP,NewHead,Body]
+ InstHead=Head
+ ),
+ flora_decode_predicate(InstHead,Type,Module,_Prefix,Pred,Args),
+ (((Type==hilog);(Type==flora)) ->
+ true
+ ;
+ flora_abort(['invalid rule head'])
+ ),
+ flora_storage_check_module_name(Module),
+ ( (Type == hilog) ->
+ ( DelOp == FLLIBDELETERULE_A ->
+ flora_dyna_hilog_user_module_predicate_symbol(Module,Wrapper)
+ ;
+ flora_dynz_hilog_user_module_predicate_symbol(Module,Wrapper)
+ ),
+ NewHead =.. [Wrapper,Pred|Args],
+ flora_match_and_delete_rule(NewHead,BodySig)
+ ;
+ flora_match_and_delete_rule(InstHead,BodySig)
)
- ;
- NewRule =.. [FL_IMPLYOP,InstHead,Body]
- ),
- assert(NewRule),
- (Pred==WRAP_OBJEQL ->
- (flora_trailer_registry(Module),!;
- assert(flora_trailer_registry(Module)))
- ;
- true
- ),
- flora_define_predicate(InstHead).
+ ).
+
+flora_match_and_delete_rule(Head,BodySig) :-
+ flora_rule_signature(Head,BodySig,RuleList,BridgeRule),
+ !,
+ flora_retract_rulelist(RuleList),
+ retract(flora_rule_signature(Head,BodySig,RuleList,BridgeRule)),
+ ( BridgeRule==[] ->
+ true
+ ;
+ ( flora_rule_signature(_H,_BS,_RL,BridgeRule) ->
+ true
+ ;
+ flora_retract_rulelist(BridgeRule)
+ )
+ ).
+
+flora_retract_rulelist([]) :- !.
+flora_retract_rulelist([H|L]) :-
+ retract(H),
+ flora_retract_rulelist(L).
/***********************************************************************
inst_body(+Body,-InstBody)
get rid of fllibmodlit with module name already bound
************************************************************************/
inst_body(','(B1,B2),','(NB1,NB2)) :-
- %%Body=','(B1,B2),
!,
inst_body(B1,NB1),
inst_body(B2,NB2).
-inst_body(Body,';'(NB1,NB2)) :-
- Body=';'(B1,B2),
+inst_body(';'(B1,B2),';'(NB1,NB2)) :-
!,
inst_body(B1,NB1),
inst_body(B2,NB2).
-inst_body(Body,not(NB)) :-
- Body=not(B),
+inst_body(not(B),not(NB)) :-
!,
inst_body(B,NB).
-inst_body(Body,tnot(NB)) :-
- Body=tnot(B),
+inst_body(tnot(B),tnot(NB)) :-
!,
inst_body(B,NB).
@@ -255,6 +353,46 @@
inst_list(L,NL).
/***********************************************************************
+ flora_build_pred_signature(+Body,-BodySig)
+ translate into fllibmodlit canonical form
+************************************************************************/
+flora_build_pred_signature(B,B) :-
+ var(B),
+ !.
+
+flora_build_pred_signature(','(B1,B2),','(NB1,NB2)) :-
+ !,
+ flora_build_pred_signature(B1,NB1),
+ flora_build_pred_signature(B2,NB2).
+
+flora_build_pred_signature(';'(B1,B2),';'(NB1,NB2)) :-
+ !,
+ flora_build_pred_signature(B1,NB1),
+ flora_build_pred_signature(B2,NB2).
+
+flora_build_pred_signature(not(B),not(NB)) :-
+ !,
+ flora_build_pred_signature(B,NB).
+
+flora_build_pred_signature(tnot(B),tnot(NB)) :-
+ !,
+ flora_build_pred_signature(B,NB).
+
+flora_build_pred_signature(Body,NB) :-
+ is_control(Body,Ctl,Branches),
+ !,
+ build_list(Branches,InstBranches),
+ NB =.. [Ctl|InstBranches].
+
+flora_build_pred_signature(Body,BodySig) :-
+ get_canonical_form(Body,BodySig).
+
+build_list([],[]) :- !.
+build_list([H|L],[NH|NL]) :-
+ flora_build_pred_signature(H,NH),
+ build_list(L,NL).
+
+/***********************************************************************
new_predicate(-NewPred)
************************************************************************/
new_dynpredicate(NewPred) :-
@@ -316,3 +454,88 @@
length(Args,M),
runtime_get_fingerprint(Pred1,Args1,FL_SLASH(M,N),NewPred,Arity).
+/***********************************************************************
+ check_vars(+Head,+Body,+NamedHeadVars,+NamedBodyVars)
+************************************************************************/
+check_vars(Head,Body,NamedHVars,NamedBVars) :-
+ collect_vars(Head,HVars),
+ collect_vars(Body,BVars),
+ append(HVars,BVars,Vars),
+ singleton_vars(Vars,Vars,SingletonVars),
+ singleton_warning(SingletonVars,NamedHVars,NamedBVars),
+ subtract_vars(HVars,BVars,UnboundVars),
+ unbound_warning(UnboundVars,NamedHVars).
+
+singleton_vars(_AllVars,[],[]) :- !.
+singleton_vars(AllVars,[H|L], [H|SL]) :-
+ is_singleton(AllVars,H,0),
+ !,
+ singleton_vars(AllVars,L,SL).
+singleton_vars(AllVars,[_H|L],SL) :-
+ singleton_vars(AllVars,L,SL).
+
+is_singleton([],_V,_Cnt) :- !.
+is_singleton([H|L],V,Cnt) :-
+ (H==V ->
+ (Cnt==1 ->
+ fail
+ ;
+ is_singleton(L,V,1)
+ )
+ ;
+ is_singleton(L,V,Cnt)
+ ).
+
+singleton_warning([],_NamedHVars,_NamedBVars) :- !.
+singleton_warning([H|L],NamedHVars,NamedBVars) :-
+ ( get_var_name(H,NamedHVars,Name) ->
+ flora_warning_line("Singleton variable `~w'", [Name])
+ ;
+ ( get_var_name(H,NamedBVars,Name) ->
+ flora_warning_line("Singleton variable `~w'", [Name])
+ ;
+ true
+ )
+ ),
+ singleton_warning(L,NamedHVars,NamedBVars).
+
+get_var_name(H,[N=V|NVs],N) :-
+ ( H==V ->
+ true
+ ;
+ get_var_name(H,NVs,N)
+ ).
+
+subtract_vars([],_BVars,[]) :- !.
+subtract_vars([H|L],BVars,[H|LUV]) :-
+ in_list(H,BVars),
+ !,
+ subtract_vars(L,BVars,LUV).
+subtract_vars([_H|L],BVars,LUV) :-
+ subtract_vars(L,BVars,LUV).
+
+in_list(V,[H|L]) :-
+ ( H==v ->
+ true
+ ;
+ in_list(V,L)
+ ).
+
+unbound_warning([],_NamedHVars) :- !.
+unbound_warning([H|L],NamedHVars) :-
+ ( get_var_name(H,NamedHVars,Name) ->
+ flora_warning_line("Unbound variable `~w' in rule head", [Name])
+ ;
+ true
+ ),
+ unbound_warning(L,NamedHVars).
+
+/***********************************************************************
+ is_invalid_flogic_head(+Pred)
+************************************************************************/
+is_invalid_flogic_head(WRAP_MVDINC) :- !.
+is_invalid_flogic_head(WRAP_IMVDINC) :- !.
+is_invalid_flogic_head(WRAP_MVDTOLIST) :- !.
+is_invalid_flogic_head(WRAP_IMVDTOLIST) :- !.
+is_invalid_flogic_head(WRAP_FDDEF) :- !.
+is_invalid_flogic_head(WRAP_IFDDEF) :- !.
Index: flrmetaops.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrmetaops.P,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- flrmetaops.P 5 Sep 2002 03:35:40 -0000 1.4
+++ flrmetaops.P 26 Mar 2003 17:30:34 -0000 1.5
@@ -25,19 +25,14 @@
*/
-
:- compiler_options([xpp_on]).
-:- import
- flora_module_predicate/4,
- flora_decode_predicate/6
- from flrwrapper.
+:- import flora_module_predicate/4 from flrwrapper.
-:- import flora_concat_atoms/2 from flrporting.
+:- import get_canonical_form/2 from flrcanon.
#include "flora_terms.flh"
-
/******************************************************************************
FLLIBUNIVEQFORM(?X,?Y)
The meta predicate ~
@@ -99,41 +94,6 @@
-> Callable = FLLIBMODLIT(Wrap,Args,Mod)
; true
).
-
-%% get_canonical_form(+Term,-Module,-CallableForm)
-%% Term is either a Hilog/Prolog term or a reified statement
-%% Canonical form is (Func,Args,Module,CallableForm)
-get_canonical_form(Term,(_,_,_,Term)) :-
- var(Term),
- !.
-
-%% Case of Var@...
-get_canonical_form(FLLIBMODLIT(FL_LIBMOD,Term,Mod),(Wrap,Args,Module,Callable)) :-
- !,
- get_canonical_form(Term,Canon),
- Canon = (Wrap,Args,NewMod,Callable),
- (var(Term) -> Module = Mod
- ; var(NewMod) -> Module=Mod
- ; Module = NewMod
- ).
-
-%% Case of nonvar@Var
-get_canonical_form(FLLIBMODLIT(Wrap,Args,Mod), (Wrap,Args,Mod,Callable)) :-
- !,
- (var(Mod) -> true
- ; flora_module_predicate(Wrap,Args,Mod,Callable)
- ).
-
-get_canonical_form(Term, Canon) :-
- flora_decode_predicate(Term,Type,TermModuleName,Prefix,Wrapper,ArgL),
- (Type = (hilog) ->
- Canon = (WRAP_HILOG,[Wrapper|ArgL],TermModuleName,_)
- ; (atom(Prefix) -> flora_concat_atoms([Prefix,Wrapper],Wrapper1)
- ; Wrapper1 = Wrapper
- ),
- Canon = (Wrapper1,ArgL,TermModuleName,Term)
- ).
-
/******************************************************************************
Index: flrshdirect.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrshdirect.P,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- flrshdirect.P 10 Mar 2003 07:38:12 -0000 1.7
+++ flrshdirect.P 26 Mar 2003 17:30:34 -0000 1.8
@@ -39,8 +39,6 @@
:- import flora_storage_check_module_name/1 from flrstorage.
-:- import flora_module_registry/1 from flrregistry.
-
:- import
flora_dyna_hilog_user_module_predicate_symbol/2,
flora_dynz_hilog_user_module_predicate_symbol/2
@@ -78,12 +76,6 @@
fllibshdirect(FL_INDEX,Module,Arity,Position) :-
flora_storage_check_module_name(Module),
- ( flora_module_registry(Module) ->
- true
- ;
- flora_abort(['FL_INDEX ',Arity,'-',Position,': Module `',Module,
- ''' is not loaded'])
- ),
( integer(Arity), integer(Position), Position>0, Arity >= Position ->
A is Arity+1,
P is Position+1,
Index: flrstorage.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrstorage.P,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- flrstorage.P 24 Mar 2003 08:08:40 -0000 1.7
+++ flrstorage.P 26 Mar 2003 17:30:35 -0000 1.8
@@ -39,6 +39,8 @@
:- import flora_display_error/1 from flrdisplay.
+:- import flora_module_registry/1 from flrregistry.
+
:- import
flora_module_name/3,
flora_module_name_error/1,
@@ -51,6 +53,7 @@
:- import
FLSYSDBUPDATE/2,
+ FLSYSDBUPDATE/3,
FLLIBMODLIT/3,
FLLIBMODOBJ/4
from usermod.
@@ -61,6 +64,7 @@
:- export
flora_storage_check_module_name/1,
+ flora_storage_check_existence/1,
flora_storage_check_deletepredicate/2,
flora_storage_convertlist/3,
flora_storage_is_negation_symbol/1.
@@ -82,8 +86,24 @@
flora_abort(['Updates to system modules (',WS,') are not allowed'])
;
true
- ).
+ ),
+ ( flora_module_registry(WS) ->
+ true
+ ;
+ flora_abort(['Module ',WS,' does not exist'])
+ ).
+/*****************************************************************************
+ flora_storage_check_existence(+ModuleName)
+
+ The procedure is called to checks if a module is loaded.
+*****************************************************************************/
+flora_storage_check_existence(ModuleName) :-
+ ( flora_module_registry(ModuleName) ->
+ true
+ ;
+ flora_abort(['Module ',ModuleName,' does not exist'])
+ ).
/*****************************************************************************
flora_storage_check_deletepredicate(+P,-UpdateStruct)
@@ -151,10 +171,11 @@
%% This is a meta-programming feature.
flora_storage_convertlist(Fs,CL,FL).
-flora_storage_convertlist([FLSYSDBUPDATE(P,StorageName)|Fs],
+flora_storage_convertlist([FLSYSDBUPDATE(P,StorageName,Module)|Fs],
[flora_db_find_base(StorageName,P)|CL],
[FLSYSDBUPDATE(P,StorageName)|FL]) :-
!,
+ flora_storage_check_existence(Module),
flora_storage_convertlist(Fs,CL,FL).
flora_storage_convertlist([FLLIBMODLIT(F,Args,ModuleName)|Fs],
Index: flrtables.P
===================================================================
RCS file: /cvsroot/flora/flora2/syslib/flrtables.P,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- flrtables.P 21 Mar 2003 02:31:01 -0000 1.2
+++ flrtables.P 26 Mar 2003 17:30:36 -0000 1.3
@@ -28,6 +28,7 @@
%% modified from XSB's tables.P
:- compiler_options([xpp_on]).
+
#include "flora_terms.flh"
#include "flora_porting.flh"
#include "builtin.h"
|
|
From: <ch...@us...> - 2003-03-26 17:24:45
|
Update of /cvsroot/flora/flora-testsuite In directory sc8-pr-cvs1:/tmp/cvs-serv6034 Modified Files: test_dir.sh Log Message: add tests for rule deletion Index: test_dir.sh =================================================================== RCS file: /cvsroot/flora/flora-testsuite/test_dir.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- test_dir.sh 23 Feb 2003 08:27:52 -0000 1.4 +++ test_dir.sh 26 Mar 2003 17:24:37 -0000 1.5 @@ -15,7 +15,8 @@ # abp.flr does not work. Perhaps the program is wrong. # btupdates.flr is loaded using btupdates_load.flr -exclude_list="abp.flr btupdates.flr compile_control.flr tabledupdates.flr" +exclude_list="abp.flr btupdates.flr compile_control.flr tabledupdates.flr \ + ruleupdates.flr" flora_command="chatterbox(off). test. flEnd." |
|
From: <ch...@us...> - 2003-03-26 17:24:42
|
Update of /cvsroot/flora/flora-testsuite/general_tests
In directory sc8-pr-cvs1:/tmp/cvs-serv6034/general_tests
Added Files:
ruleupdates.flr ruleupdates_load.flr ruleupdates_load_old
Log Message:
add tests for rule deletion
--- NEW FILE: ruleupdates.flr ---
e(a,b). e(b,c). e(c,d).
?- M=mod1, insertrule_a{((tc(X,Y) :- e(X,Y)@_@)@M),
((tc(X,Y) :- tc(X,Z),e(Z,Y)@_@)@M)
}.
?- writeln('Query 1 begins')@prolog().
?- tc(X,Y)@mod1, fmt_write('tc(%S,%S)\n',arg(X,Y))@flora(io).
?- deleterule_a{(tc(X,Y) :- tc(X,Z),e(Z,Y)@_@)@mod1}.
?- refresh{tc(X,Y)}.
?- writeln('Query 2 begins')@prolog().
?- tc(X,Y)@mod1, fmt_write('tc(%S,%S)\n',arg(X,Y))@flora(io).
?- M=mod1, deleterule_a{(tc(X,Y) :- P@SomeModule)@M}.
?- refresh{tc(X,Y)}.
?- writeln('Query 3 begins')@prolog().
?- tc(X,Y)@mod1, fmt_write('tc(%S,%S)\n',arg(X,Y))@flora(io).
?- insertrule_z{X:student[register->>Term] :- enroll(X,Term)@mod1}.
?- insert{
enroll('John','F02')@mod1,
enroll('John','S03')@mod1,
enroll('Mary','S03')@mod1
}.
?- writeln('Query 4 begins')@prolog().
?- X:student, fmt_write('%S:student\n',arg(X))@flora(io).
?- writeln('Query 5 begins')@prolog().
?- X[register->>Term], fmt_write('%S[register->>%S]\n',arg(X,Term))@flora(io).
?- deleterule_z{X:student :- enroll(X,Y)@M}.
?- refresh{X:student[register->>Term]}.
?- writeln('Query 6 begins')@prolog().
?- X:student, fmt_write('%S:student\n',arg(X))@flora(io).
?- writeln('Query 7 begins')@prolog().
?- X[register->>Term], fmt_write('%S[register->>%S]\n',arg(X,Term))@flora(io).
?- deleterule_z{X[register->>Y] :- P@mod1}.
?- refresh{X:student[register->>Term]}.
?- writeln('Query 8 begins')@prolog().
?- X:student, fmt_write('%S:student\n',arg(X))@flora(io).
?- writeln('Query 9 begins')@prolog().
?- X[register->>Term], fmt_write('%S[register->>%S]\n',arg(X,Term))@flora(io).
--- NEW FILE: ruleupdates_load.flr ---
?- newmodule{mod1}.
?- table(mod1, tc/2).
test :- tell(temp)@prolog(),
[ruleupdates>>foo],
debug[#check_undefined(on)]@flora(sys),
[ruleupdates>>foo],
debug[#check_undefined(off)]@flora(sys),
told@prolog().
--- NEW FILE: ruleupdates_load_old ---
John[register->>F02]
John[register->>F02]
John[register->>F02]
John[register->>F02]
John[register->>S03]
John[register->>S03]
John[register->>S03]
John[register->>S03]
John:student
John:student
Mary[register->>S03]
Mary[register->>S03]
Mary[register->>S03]
Mary[register->>S03]
Mary:student
Mary:student
Query 1 begins
Query 1 begins
Query 2 begins
Query 2 begins
Query 3 begins
Query 3 begins
Query 4 begins
Query 4 begins
Query 5 begins
Query 5 begins
Query 6 begins
Query 6 begins
Query 7 begins
Query 7 begins
Query 8 begins
Query 8 begins
Query 9 begins
Query 9 begins
tc(a,b)
tc(a,b)
tc(a,b)
tc(a,b)
tc(a,c)
tc(a,c)
tc(a,d)
tc(a,d)
tc(b,c)
tc(b,c)
tc(b,c)
tc(b,c)
tc(b,d)
tc(b,d)
tc(c,d)
tc(c,d)
tc(c,d)
tc(c,d)
|
|
From: <ki...@us...> - 2003-03-25 04:02:00
|
Update of /cvsroot/flora/flora2/syslib In directory sc8-pr-cvs1:/tmp/cvs-serv29221/syslib Modified Files: flrstoragebase.P Log Message: 1. commented out use_variant_tabling for now. 2. cleanup: elimination of unnecessary macros in flrporting. Index: flrstoragebase.P =================================================================== RCS file: /cvsroot/flora/flora2/syslib/flrstoragebase.P,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- flrstoragebase.P 24 Mar 2003 08:08:40 -0000 1.1 +++ flrstoragebase.P 25 Mar 2003 04:01:23 -0000 1.2 @@ -31,16 +31,6 @@ #include "flora_terms.flh" #include "flora_porting.flh" -:- import - FLORA_DB_FIND_PREDICATE/2, - FLORA_DB_INSERT_PREDICATE/3, - FLORA_DB_DELETE_PREDICATE/3, - FLORA_DB_INSERT_BT_PREDICATE/3, - FLORA_DB_DELETE_BT_PREDICATE/3, - FLORA_DB_COMMIT_PREDICATE/1, - FLORA_DB_RECLAIM_SPACE_PREDICATE/1 - from storage. - :- export flora_db_insert_base/2, flora_db_delete_base/2, @@ -55,26 +45,36 @@ #ifdef FLORA_USE_TRIES +:- import + storage_find_fact/2, + storage_insert_fact/3, + storage_delete_fact/3, + storage_insert_fact_bt/3, + storage_delete_fact_bt/3, + storage_commit/1, + storage_reclaim_space/1 + from storage. + flora_db_insert_base(StorageName,Call) :- - FLORA_DB_INSERT_PREDICATE(StorageName,Call,_ResultFlag). + storage_insert_fact(StorageName,Call,_ResultFlag). flora_db_delete_base(StorageName,Call) :- - FLORA_DB_DELETE_PREDICATE(StorageName,Call,_ResultFlag). + storage_delete_fact(StorageName,Call,_ResultFlag). flora_db_insert_base_bt(StorageName,Call) :- - FLORA_DB_INSERT_BT_PREDICATE(StorageName,Call,_ResultFlag). + storage_insert_fact_bt(StorageName,Call,_ResultFlag). flora_db_delete_base_bt(StorageName,Call) :- - FLORA_DB_DELETE_BT_PREDICATE(StorageName,Call,_ResultFlag). + storage_delete_fact_bt(StorageName,Call,_ResultFlag). flora_db_find_base(StorageName,Call) :- - FLORA_DB_FIND_PREDICATE(StorageName,Call). + storage_find_fact(StorageName,Call). flora_db_commit(StorageName) :- - FLORA_DB_COMMIT_PREDICATE(StorageName). + storage_commit(StorageName). flora_db_reclaim_space(StorageName) :- - FLORA_DB_RECLAIM_SPACE_PREDICATE(StorageName). + storage_reclaim_space(StorageName). #else |
|
From: <ki...@us...> - 2003-03-25 04:01:28
|
Update of /cvsroot/flora/flora2
In directory sc8-pr-cvs1:/tmp/cvs-serv29221
Modified Files:
flrwraparound.P flrwraparound.H
Log Message:
1. commented out use_variant_tabling for now.
2. cleanup: elimination of unnecessary macros in flrporting.
Index: flrwraparound.P
===================================================================
RCS file: /cvsroot/flora/flora2/flrwraparound.P,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- flrwraparound.P 24 Mar 2003 08:08:42 -0000 1.7
+++ flrwraparound.P 25 Mar 2003 04:01:24 -0000 1.8
@@ -55,6 +55,7 @@
#include "flora_wrap.flh"
:- dynamic wrap_arguments_directive/1.
+:- dynamic flora_wraparound_info/2.
:- op(1100,fy,WRAP_WITH_WORKSPACE).
:- op(1100,fy,WRAP_DUMP).
@@ -151,7 +152,7 @@
%% tells how to wrap a predicate spec
wrapper(P/A, WrappedSpec, Changed) :- !,
(var(A) -> EncodedA = '$var' ; EncodedA = A),
- (FLORA_DB_FIND_KEYPAIR_PREDICATE(flora_compile_trie,P/EncodedA,EncodingType),
+ (flora_wraparound_info(P/EncodedA,EncodingType),
wrapper_macro(EncodingType,WrapperMacroName)
->
flora_concat_items([WrapperMacroName,'(',P,')'],WrappedP),
@@ -161,7 +162,7 @@
).
wrapper(Spec, WrappedSpec, Changed) :-
Spec =.. [P|Args],
- (FLORA_DB_FIND_KEYPAIR_PREDICATE(flora_compile_trie,Spec,EncodingType),
+ (flora_wraparound_info(Spec,EncodingType),
wrapper_macro(EncodingType,WrapperMacroName)
->
flora_concat_items([WrapperMacroName,'(',P,')'],WP),
@@ -195,19 +196,20 @@
intern_predicate_spec(P,EncodingType) :-
P = '/'(Name,Arity),
!,
- (var(Arity) -> FLORA_DB_INSERT_KEYPAIR_PREDICATE(flora_compile_trie,'/'(Name,'$var'),EncodingType,_)
- ; FLORA_DB_INSERT_KEYPAIR_PREDICATE(flora_compile_trie,P,EncodingType,_)
+ (var(Arity)
+ -> assert(flora_wraparound_info('/'(Name,'$var'),EncodingType))
+ ; assert(flora_wraparound_info(P,EncodingType))
),
(var(Arity) -> true
; functor(NewP,Name,Arity),
- FLORA_DB_INSERT_KEYPAIR_PREDICATE(flora_compile_trie,NewP,EncodingType,_)
+ assert(flora_wraparound_info(NewP,EncodingType))
).
%% Spec of the form of the form name(_,...,_)
intern_predicate_spec(P,EncodingType) :-
functor(P,Name,Arity), Arity >= 0,
!,
- FLORA_DB_INSERT_KEYPAIR_PREDICATE(flora_compile_trie,P,EncodingType,_),
- FLORA_DB_INSERT_KEYPAIR_PREDICATE(flora_compile_trie,Name/Arity,EncodingType,_).
+ assert(flora_wraparound_info(P,EncodingType)),
+ assert(flora_wraparound_info(Name/Arity,EncodingType)).
intern_predicate_spec(P,EncodingType) :-
flora_error_line('[flWrapAround] Invalid predicate specification in a %s directive: %S', arg(EncodingType,P)).
Index: flrwraparound.H
===================================================================
RCS file: /cvsroot/flora/flora2/flrwraparound.H,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- flrwraparound.H 24 Mar 2003 08:08:42 -0000 1.5
+++ flrwraparound.H 25 Mar 2003 04:01:25 -0000 1.6
@@ -53,11 +53,6 @@
flora_error_line/2
from flrprint.
-:- import
- FLORA_DB_INSERT_KEYPAIR_PREDICATE/4,
- FLORA_DB_FIND_KEYPAIR_PREDICATE/3
- from storage.
-
:- import process_control/2 from shell.
:- import xpp_process_file/3 from parse.
|
|
From: <ki...@us...> - 2003-03-25 04:01:27
|
Update of /cvsroot/flora/flora2/flrincludes In directory sc8-pr-cvs1:/tmp/cvs-serv29221/flrincludes Modified Files: flora_porting.flh Log Message: 1. commented out use_variant_tabling for now. 2. cleanup: elimination of unnecessary macros in flrporting. Index: flora_porting.flh =================================================================== RCS file: /cvsroot/flora/flora2/flrincludes/flora_porting.flh,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- flora_porting.flh 24 Mar 2003 08:08:41 -0000 1.6 +++ flora_porting.flh 25 Mar 2003 04:01:24 -0000 1.7 @@ -39,19 +39,3 @@ ******************************************************************************/ #define FLORA_TNOT_PREDICATE flora_tnot #define FLORA_TNOT(Goal) FLORA_TNOT_PREDICATE(#1) - -/****************************************************************************** - Database retrieval predicates -******************************************************************************/ -#define FLORA_DB_FIND_PREDICATE storage_find_fact -#define FLORA_DB_INSERT_PREDICATE storage_insert_fact -#define FLORA_DB_DELETE_PREDICATE storage_delete_fact -#define FLORA_DB_INSERT_BT_PREDICATE storage_insert_fact_bt -#define FLORA_DB_DELETE_BT_PREDICATE storage_delete_fact_bt -#define FLORA_DB_INSERT_KEYPAIR_PREDICATE storage_insert_keypair -#define FLORA_DB_DELETE_KEYPAIR_PREDICATE storage_delete_keypair -#define FLORA_DB_FIND_KEYPAIR_PREDICATE storage_find_keypair - - -#define FLORA_DB_COMMIT_PREDICATE storage_commit -#define FLORA_DB_RECLAIM_SPACE_PREDICATE storage_reclaim_space |
|
From: <ki...@us...> - 2003-03-25 04:01:27
|
Update of /cvsroot/flora/flora2/genincludes
In directory sc8-pr-cvs1:/tmp/cvs-serv29221/genincludes
Modified Files:
flrtable.fli
Log Message:
1. commented out use_variant_tabling for now.
2. cleanup: elimination of unnecessary macros in flrporting.
Index: flrtable.fli
===================================================================
RCS file: /cvsroot/flora/flora2/genincludes/flrtable.fli,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- flrtable.fli 14 Mar 2003 07:58:22 -0000 1.1
+++ flrtable.fli 25 Mar 2003 04:01:24 -0000 1.2
@@ -48,6 +48,7 @@
%% Subsumptive tabling doesn't support abolish_table_call, which Flora uses
%% for insert{...}, delete{...}, so we force tabling to be variant.
+/*
:- use_variant_tabling
WRAP_SUB/2,
WRAP_ISA/2,
@@ -71,3 +72,4 @@
WRAP_DIFFOBJEQL/2,
WRAP_FDDEF/2,
WRAP_IFDDEF/2.
+*/
|