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
(1) |
2
(6) |
3
|
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
|
18
|
19
(4) |
20
(3) |
21
|
22
|
23
|
24
|
|
25
|
26
|
27
|
28
|
29
|
30
|
|
|
From: Michael K. <ki...@us...> - 2006-06-20 16:27:57
|
Update of /cvsroot/flora/flora2/java In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv15048/java Added Files: .cvsignore Log Message: remove flora_settings.* - they are now generated --- NEW FILE: .cvsignore --- flora_settings.* |
|
From: Michael K. <ki...@us...> - 2006-06-20 16:26:22
|
Update of /cvsroot/flora/flora2 In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv14235 Modified Files: flrconfig.P Log Message: remove flora_settings.* - they are now generated Index: flrconfig.P =================================================================== RCS file: /cvsroot/flora/flora2/flrconfig.P,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- flrconfig.P 23 May 2006 17:19:23 -0000 1.18 +++ flrconfig.P 20 Jun 2006 16:26:14 -0000 1.19 @@ -128,7 +128,7 @@ -> tell('java\\flora_settings.bat'), writeln('@echo OFF'), write('@set FLORADIR='), writeln(FloraDir), - write('PROLOGDIR='), writeln(InstallDir) + write('@set PROLOGDIR='), writeln(ConfigBinDir) ; tell('java/flora_settings.sh'), write('FLORADIR='), (flora_running_under(cygwin) |
|
From: Michael K. <ki...@us...> - 2006-06-20 16:26:22
|
Update of /cvsroot/flora/flora2/java In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv14235/java Removed Files: flora_settings.sh flora_settings.bat Log Message: remove flora_settings.* - they are now generated --- flora_settings.sh DELETED --- --- flora_settings.bat DELETED --- |
|
From: Hui W. <hw...@us...> - 2006-06-19 21:38:36
|
Update of /cvsroot/flora/flora2 In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv32257 Modified Files: flrcoder.P flrcompiler.P flrdependency.H flrdependency.P flrlexer.P flrparser.P Log Message: Modification for URI syntax: 1. The Prefix#Suffix syntax now allow Suffix to be in the form of alphanumeric identifier or quoted_atom as well as string. 2. The :- prefix Prefix=Prefixbody syntax now allow PrefixBody to be in the form of alphanumeric identifier or quoted_atom as well as string. 3. Fix small bug in URI decoding. Index: flrdependency.H =================================================================== RCS file: /cvsroot/flora/flora2/flrdependency.H,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- flrdependency.H 17 Oct 2005 05:25:33 -0000 1.11 +++ flrdependency.H 19 Jun 2006 21:38:20 -0000 1.12 @@ -23,7 +23,6 @@ :- import is_prrule/3, is_pratom/3, - is_prstring/3, is_prdirective/2, is_prignoredep/2, is_prprefixdef/3, Index: flrcompiler.P =================================================================== RCS file: /cvsroot/flora/flora2/flrcompiler.P,v retrieving revision 1.90 retrieving revision 1.91 diff -u -d -r1.90 -r1.91 --- flrcompiler.P 4 May 2006 19:52:38 -0000 1.90 +++ flrcompiler.P 19 Jun 2006 21:38:20 -0000 1.91 @@ -367,6 +367,10 @@ atomobj_struct(Prefix,PrefixAtom), strobj_struct(Localname,LocalnameStr). +urisqobj_struct(FLURISQ(Prefix,Localname),PRURISQ(PrefixPR,LocalnamePR)) :- + atomobj_struct(Prefix,PrefixPR), + atomobj_struct(Localname,LocalnamePR). + newoid_struct(Oid,Index,PRNEWOID(Oid,Index)). cut_struct(Index,PRCUT(Index)). @@ -1578,10 +1582,11 @@ !. compile_direct(DirectTerm,Idx,CodeList,Status) :- - is_flprefixdef(DirectTerm,PrefixName,PrefixStr), - compile_pathexplist([PrefixName,PrefixStr],[NameCode,StrCode],_,_,S), + is_flprefixdef(DirectTerm,PrefixName,PrefixBody), + compile_pathexplist([PrefixName,PrefixBody],[NameCode,BodyCode1],_,_,S), + ( is_prstring(BodyCode1,String,_) -> atom_codes(BodyCode,String); BodyCode=BodyCode1), % the body of prefix definition is stored as atom ( S==[] -> - prefixdef_struct(NameCode,StrCode,Direct), + prefixdef_struct(NameCode,BodyCode,Direct), directive_struct(Direct,Code1), fldirective_struct([DirectTerm],Idx,Term), compile_query(Term,CodeList-[Code1],Status) @@ -5488,9 +5493,10 @@ (numobj_struct(P,PCode); is_flvar(P,PN,PI),varobj_struct(PN,PI,PCode)), florasyslib_struct(FLLIBSHDIRECT,4,[FL_INDEX,Mod,ACode,PCode],Code) - ; is_flprefixdef(DirectTerm,PrefixName,PrefixStr) -> - compile_pathexplist([PrefixName,PrefixStr],[NamePR,StrPR],_,_,_Status), - florasyslib_struct(FLLIBPREFIXDEF,3,[Mod,NamePR,StrPR],Code) + ; is_flprefixdef(DirectTerm,PrefixName,PrefixBody) -> + compile_pathexplist([PrefixName,PrefixBody],[NamePR,BodyPR],_,_,_Status), + ( is_prstring(BodyPR,String,_) -> atom_codes(BodyCode,String); BodyPR=BodyCode), % the body of prefix definition is stored as atom + florasyslib_struct(FLLIBPREFIXDEF,3,[Mod,NamePR,BodyCode],Code) ), !. Index: flrparser.P =================================================================== RCS file: /cvsroot/flora/flora2/flrparser.P,v retrieving revision 1.100 retrieving revision 1.101 diff -u -d -r1.100 -r1.101 --- flrparser.P 5 May 2006 19:52:11 -0000 1.100 +++ flrparser.P 19 Jun 2006 21:38:20 -0000 1.101 @@ -1847,13 +1847,15 @@ !, Args=[PrefixHead,PrefixBody], ( PrefixHead=OBJECT(IDENTIFIER(_Name),_Index_Head) -> % make sure that prefix name(the part before '=') is an atom - ( PrefixBody=OBJECT(ASCII_STRING(_Str),_Index_Body) -> % make sure that the part following '=' is a string - flora_pathexplist(Args,NULL,ArgsCode,Status), - ArgsCode=[NameCode,StrCode], - flprefixdef_struct(NameCode,StrCode,Code) + ( ( PrefixBody=OBJECT(ASCII_STRING(_Str),_Index_Body); + PrefixBody=OBJECT(IDENTIFIER(_Str),_Index_Body); + PrefixBody=OBJECT(QUOTED_ATOM(_Str),_Index_Body)) -> % make sure that the part following '=' is a string or a quoted atom or an identifier + flora_pathexplist(Args,NULL,ArgsCode,Status), + ArgsCode=[NameCode,BodyCode], + flprefixdef_struct(NameCode,BodyCode,Code) ; get_index(PrefixBody,Index_Body), - parsing_error(Index_Body,ERROR_PREFIX_BODY,Status) + parsing_error(Index_Body,ERROR_PREFIX_BODY,Status) % need to change the error message ) ; get_index(PrefixHead,Index_Head), @@ -3742,13 +3744,15 @@ !, Args=[Prefix,Localname], ( Prefix=OBJECT(IDENTIFIER(_Prefix),_Index_Prefix) -> % prefix (the part before '#') should be an atom - ( Localname=OBJECT(ASCII_STRING(_Localname),_Index_Localname) -> % localname (the part following '#') should be a string + ( (Localname=OBJECT(ASCII_STRING(_Localname),_Index_Localname); + Localname=OBJECT(IDENTIFIER(_Localname),_Index_Localname); + Localname=OBJECT(QUOTED_ATOM(_Localname),_Index_Localname))-> % localname (the part following '#') should be a string or a quoted atom or an identifier flora_pathexplist(Args,DWS,ArgsCode,Status), ArgsCode=[PrefixCode,LocalnameCode], flurisq_struct(PrefixCode,LocalnameCode,Code) ; get_index(Localname,Index_Localname), - parsing_error(Index_Localname,ERROR_SQNAME_LOCAL,Status) + parsing_error(Index_Localname,ERROR_SQNAME_LOCAL,Status) % need to change the error message ) ; get_index(Prefix,Index_Prefix), @@ -4364,7 +4368,9 @@ ; is_urisqop(F) -> Args=[Prefix,Localname], ( Prefix=OBJECT(IDENTIFIER(_Prefix),_Index_Prefix) -> % make sure that prefix (the part before '#') is an atom - ( Localname=OBJECT(ASCII_STRING(_Localname),_Index_Localname) -> % make sure that localname (the part following '#') is a string + ((Localname=OBJECT(ASCII_STRING(_Localname),_Index_Localname); + Localname=OBJECT(IDENTIFIER(_Localname),_Index_Localname); + Localname=OBJECT(QUOTED_ATOM(_Localname),_Index_Localname)) -> % localname (the part following '#') should be a string or quoted atom or an identifier flora_head_pathexplist(Args,DWS,ArgsCode,Status), ArgsCode=[PrefixCode,LocalnameCode], flurisq_struct(PrefixCode,LocalnameCode,Code) @@ -5053,7 +5059,9 @@ !, Args=[Prefix,Localname], ( Prefix=OBJECT(IDENTIFIER(_Prefix),_Index_Prefix) -> % prefix (the part before '#') should be an identifier - ( Localname=OBJECT(ASCII_STRING(_Localname),_Index_Localname) -> % localname (the part following '#') should be a string + ( (Localname=OBJECT(ASCII_STRING(_Localname),_Index_Localname); + Localname=OBJECT(IDENTIFIER(_Localname),_Index_Localname); + Localname=OBJECT(QUOTED_ATOM(_Localname),_Index_Localname)) -> % localname (the part following '#') should be a string or a quoted atom or an identifier flora_db_pathexplist(Mode,Args,DWS,ArgsCode,Status), ArgsCode=[PrefixCode,LocalnameCode], flurisq_struct(PrefixCode,LocalnameCode,Code) Index: flrlexer.P =================================================================== RCS file: /cvsroot/flora/flora2/flrlexer.P,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- flrlexer.P 20 May 2006 07:17:50 -0000 1.21 +++ flrlexer.P 19 Jun 2006 21:38:20 -0000 1.22 @@ -218,8 +218,9 @@ text_info(LN1,CN1,LN2,CN2,TextStr,Text), atom_codes(A,AtomStr). -flora_uri_struct(UriStr,TextStr,LN1,CN1,LN2,CN2,URI(UriStr,Text)) :- - text_info(LN1,CN1,LN2,CN2,TextStr,Text). +flora_uri_struct(UriStr,TextStr,LN1,CN1,LN2,CN2,URI(Uri,Text)) :- + text_info(LN1,CN1,LN2,CN2,TextStr,Text), + atom_codes(Uri,UriStr). flora_ascii_string_struct(ASCII,TextStr,LN1,CN1,LN2,CN2,ASCII_STRING(ASCII,Text)) :- text_info(LN1,CN1,LN2,CN2,TextStr,Text). Index: flrcoder.P =================================================================== RCS file: /cvsroot/flora/flora2/flrcoder.P,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- flrcoder.P 4 May 2006 19:52:38 -0000 1.48 +++ flrcoder.P 19 Jun 2006 21:38:20 -0000 1.49 @@ -457,7 +457,7 @@ !, flora_write_quoted_atom(FL_URI), put(0'(), - write(Uri), + flora_write_quoted_atom(Uri), put(0')). flora_write_struct(Term,_Prefix,[]) :- @@ -714,25 +714,29 @@ flora_write_struct(Term,_Prefix,[]) :- - is_prprefixdef(Term,PrefixName,PrefixStr), + is_prprefixdef(Term,PrefixName,PrefixBody), !, is_pratom(PrefixName,NameAtom,_Index1), - is_prstring(PrefixStr,String,_Index2), - flora_concat_atoms(['flora_prefix_',NameAtom],Special), - (flora_coder_prefixdef(Special,_)->retract(flora_coder_prefixdef(Special,_));true), - assert(flora_coder_prefixdef(Special,String)). + is_pratom(PrefixBody,BodyAtom,_Index2), + flora_concat_atoms(['flora_prefix_',NameAtom],PrefixCode), + (flora_coder_prefixdef(PrefixCode,_)->retract(flora_coder_prefixdef(PrefixCode,_));true), + assert(flora_coder_prefixdef(PrefixCode,BodyAtom)). flora_write_struct(Term,_Prefix,Status) :- is_prurisq(Term,Prefix,Localname), !, is_pratom(Prefix,PrefixAtom,Index), - is_prstring(Localname,LocalnameStr,_Index2), + (is_prstring(Localname,LocalnameStr,_Index2), + atom_codes(LocalAtom,LocalnameStr) + ; + is_pratom(Localname,LocalAtom,_Index2) + ), flora_concat_atoms(['flora_prefix_',PrefixAtom],PrefixCode), - (flora_coder_prefixdef(PrefixCode,PrefixStr)-> - append(PrefixStr,LocalnameStr,SQNameStr), + (flora_coder_prefixdef(PrefixCode,PrefixBody)-> flora_write_quoted_atom(FL_URI), put(0'(), - write(SQNameStr), + flora_concat_atoms([PrefixBody,LocalAtom],SQName), + flora_write_quoted_atom(SQName), put(0')), Status = [] @@ -815,13 +819,17 @@ ; is_prurisq(Term,PrefixName,Localname) -> is_pratom(PrefixName,PrefixAtom,Index), + (is_prstring(Localname,LocalnameStr,_Index2), + atom_codes(LocalAtom,LocalnameStr) + ; + is_pratom(Localname,LocalAtom,_Index2) + ), flora_concat_atoms(['flora_prefix_',PrefixAtom],PrefixCode), - is_prstring(Localname,LocalnameStr,_), - (flora_shell_prefixdef(WS,PrefixCode,PrefixStr)-> - append(PrefixStr,LocalnameStr,SQNameStr), + (flora_shell_prefixdef(WS,PrefixCode,PrefixBody)-> flora_write_quoted_atom(FL_URI), put(0'(), - write(SQNameStr), + flora_concat_atoms([PrefixBody,LocalAtom],SQName), + flora_write_quoted_atom(SQName), put(0')), Status = [] @@ -1335,11 +1343,15 @@ is_prurisq(Term,Prefix,Localname), !, is_pratom(Prefix,PrefixAtom,Index), + (is_prstring(Localname,LocalnameStr,_Index2), + atom_codes(LocalAtom,LocalnameStr) + ; + is_pratom(Localname,LocalAtom,_Index2) + ), flora_concat_atoms(['flora_prefix_',PrefixAtom],PrefixCode), - is_prstring(Localname,LocalnameStr,_), - ((flora_shell_prefixdef(DWS,PrefixCode,PrefixStr);flora_depchk_prefixdef(DWS,PrefixCode,PrefixStr))-> - append(PrefixStr,LocalnameStr,SQNameStr), - Code = FL_URI(SQNameStr), + ((flora_shell_prefixdef(DWS,PrefixCode,PrefixBody);flora_depchk_prefixdef(DWS,PrefixCode,PrefixBody))-> + flora_concat_atoms([PrefixBody,LocalAtom],SQName), + Code = FL_URI(SQName), Status = [] ; coding_error(Index,MOD_NODEFPREFIX,Error), @@ -1654,11 +1666,15 @@ ; is_prurisq(Term,PrefixName,Localname) -> is_pratom(PrefixName,PrefixAtom,Index), + (is_prstring(Localname,LocalnameStr,_Index2), + atom_codes(LocalAtom,LocalnameStr) + ; + is_pratom(Localname,LocalAtom,_Index2) + ), flora_concat_atoms(['flora_prefix_',PrefixAtom],PrefixCode), - is_prstring(Localname,LocalnameStr,_), - ((flora_shell_prefixdef(WS,PrefixCode,PrefixStr);flora_depchk_prefixdef(WS,PrefixCode,PrefixStr))-> - append(PrefixStr,LocalnameStr,SQNameStr), - Code = FL_URI(SQNameStr), + ((flora_shell_prefixdef(WS,PrefixCode,PrefixBody);flora_depchk_prefixdef(WS,PrefixCode,PrefixBody))-> + flora_concat_atoms([PrefixBody,LocalAtom],SQName), + Code = FL_URI(SQName), Status = [] ; coding_error(Index,MOD_NODEFPREFIX,Error), Index: flrdependency.P =================================================================== RCS file: /cvsroot/flora/flora2/flrdependency.P,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- flrdependency.P 9 Mar 2006 08:58:17 -0000 1.25 +++ flrdependency.P 19 Jun 2006 21:38:20 -0000 1.26 @@ -482,12 +482,12 @@ ( is_prignoredep(Direct,PList) -> assert_ignoredlist(PList) - ; is_prprefixdef(Direct,PrefixName,PrefixStr) -> + ; is_prprefixdef(Direct,PrefixName,PrefixBody) -> is_pratom(PrefixName,NameAtom,_Index), - is_prstring(PrefixStr,String,_Index2), + is_pratom(PrefixBody,BodyAtom,_Index2), flora_concat_atoms(['flora_prefix_',NameAtom],NameCode), (flora_depchk_prefixdef(DEFAULT_WORKSPACE,NameCode,_)->retract(flora_depchk_prefixdef(DEFAULT_WORKSPACE,NameCode,_));true), - assert(flora_depchk_prefixdef(DEFAULT_WORKSPACE,NameCode,String)) + assert(flora_depchk_prefixdef(DEFAULT_WORKSPACE,NameCode,BodyAtom)) ; true ) |
|
From: Hui W. <hw...@us...> - 2006-06-19 21:38:29
|
Update of /cvsroot/flora/flora2/syslib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv32257/syslib Modified Files: flrdecode.P flrprefixdef.P Log Message: Modification for URI syntax: 1. The Prefix#Suffix syntax now allow Suffix to be in the form of alphanumeric identifier or quoted_atom as well as string. 2. The :- prefix Prefix=Prefixbody syntax now allow PrefixBody to be in the form of alphanumeric identifier or quoted_atom as well as string. 3. Fix small bug in URI decoding. Index: flrprefixdef.P =================================================================== RCS file: /cvsroot/flora/flora2/syslib/flrprefixdef.P,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- flrprefixdef.P 17 Oct 2005 05:25:33 -0000 1.1 +++ flrprefixdef.P 19 Jun 2006 21:38:21 -0000 1.2 @@ -39,7 +39,7 @@ FLLIBPREFIXDEF/3. -FLLIBPREFIXDEF(Mod,NameCode,StrCode) :- +FLLIBPREFIXDEF(Mod,NameCode,BodyCode) :- flora_concat_atoms(['flora_prefix_',NameCode],PrefixCode), (flora_shell_prefixdef(Mod,PrefixCode,_)->retract(flora_shell_prefixdef(Mod,PrefixCode,_));true), - assert(flora_shell_prefixdef(Mod,PrefixCode,StrCode)). + assert(flora_shell_prefixdef(Mod,PrefixCode,BodyCode)). Index: flrdecode.P =================================================================== RCS file: /cvsroot/flora/flora2/syslib/flrdecode.P,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- flrdecode.P 17 May 2006 06:52:28 -0000 1.44 +++ flrdecode.P 19 Jun 2006 21:38:21 -0000 1.45 @@ -778,7 +778,7 @@ !, decode_literal_internal(Term,Code,Level,Depth). -decode_literal_internal(FL_URI(Term),['_',Code],Level,Depth) :- +decode_literal_internal(FL_URI(Term),['_','"',Code,'"'],Level,Depth) :- !, decode_literal_internal(Term,Code,Level,Depth). |
|
From: Hui W. <hw...@us...> - 2006-06-19 21:38:28
|
Update of /cvsroot/flora/flora2/java In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv32257/java Modified Files: flora_settings.sh Log Message: Modification for URI syntax: 1. The Prefix#Suffix syntax now allow Suffix to be in the form of alphanumeric identifier or quoted_atom as well as string. 2. The :- prefix Prefix=Prefixbody syntax now allow PrefixBody to be in the form of alphanumeric identifier or quoted_atom as well as string. 3. Fix small bug in URI decoding. Index: flora_settings.sh =================================================================== RCS file: /cvsroot/flora/flora2/java/flora_settings.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- flora_settings.sh 24 May 2006 20:33:56 -0000 1.1 +++ flora_settings.sh 19 Jun 2006 21:38:20 -0000 1.2 @@ -1,2 +1,2 @@ -FLORADIR=/home/users/kifer/FLORA/flora2-new -PROLOGDIR=/home/users/kifer/XSB/XSB/config/i686-pc-linux-gnu/bin +FLORADIR=/home/hwan/research/flora2-working +PROLOGDIR=/home/hwan/research/XSB/config/i686-pc-linux-gnu/bin |
|
From: Hui W. <hw...@us...> - 2006-06-19 21:38:28
|
Update of /cvsroot/flora/flora2/flrincludes In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv32257/flrincludes Modified Files: flora_errors.flh Log Message: Modification for URI syntax: 1. The Prefix#Suffix syntax now allow Suffix to be in the form of alphanumeric identifier or quoted_atom as well as string. 2. The :- prefix Prefix=Prefixbody syntax now allow PrefixBody to be in the form of alphanumeric identifier or quoted_atom as well as string. 3. Fix small bug in URI decoding. Index: flora_errors.flh =================================================================== RCS file: /cvsroot/flora/flora2/flrincludes/flora_errors.flh,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- flora_errors.flh 5 May 2006 19:52:12 -0000 1.40 +++ flora_errors.flh 19 Jun 2006 21:38:20 -0000 1.41 @@ -201,10 +201,10 @@ #define ERROR_PREFIX 'invalid prefix definition' #define ERROR_PREFIX_HEAD 'identifier is expected as the head of prefix definition' -#define ERROR_PREFIX_BODY 'string is expected as the body of prefix definition' +#define ERROR_PREFIX_BODY 'a string or an identifier or a quoted_atom is expected as the body of prefix definition' -#define ERROR_SQNAME_PREFIX 'identifier is expected as prefix of SQname' -#define ERROR_SQNAME_LOCAL 'string is expected as localname of SQname' +#define ERROR_SQNAME_PREFIX 'identifier is expected as the prefix of SQname' +#define ERROR_SQNAME_LOCAL 'a string or an identifier or a quoted_atom is expected as the localname of SQname' #mode save #mode nocomment "%" |
|
From: Michael K. <ki...@us...> - 2006-06-02 04:52:26
|
Update of /cvsroot/flora/flora2/java/API/examples/fooExample In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv30544/java/API/examples/fooExample Modified Files: fooExample.java foo.java Log Message: further improvements to the java API Index: foo.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/fooExample/foo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- foo.java 29 May 2006 05:00:49 -0000 1.3 +++ foo.java 2 Jun 2006 04:52:17 -0000 1.4 @@ -1,462 +1,909 @@ + import java.util.*; import com.declarativa.interprolog.TermModel; import net.sourceforge.flora.javaAPI.util.*; import net.sourceforge.flora.javaAPI.src.*; public class foo extends FloraConstants { + FloraObject sourceFloraObject; String moduleName; TermModel floraClassName = new TermModel("foo"); public foo(FloraObject sourceFloraObject,String moduleName) { [...1050 lines suppressed...] +{ +Vector pars = new Vector(); +pars.add(year); +pars.add(month); +return sourceFloraObject.deletevalue(moduleName,"bonus",NONINHERITABLE,SIGNATURE,pars,value); +} +public boolean deleteVSN_bonus(Object year, Object month,Object value) +{ +Vector pars = new Vector(); +pars.add(year); +pars.add(month); +return sourceFloraObject.deletevalue(moduleName,"bonus",NONINHERITABLE,SIGNATURE,pars,value); +} +public boolean deleteVSN_bonus(Object year, Object month){ +Vector pars = new Vector(); +pars.add(year); +pars.add(month); +return sourceFloraObject.deletevalue(moduleName,"bonus",NONINHERITABLE,SIGNATURE,pars); } } Index: fooExample.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/fooExample/fooExample.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- fooExample.java 29 May 2006 05:00:49 -0000 1.3 +++ fooExample.java 2 Jun 2006 04:52:16 -0000 1.4 @@ -41,9 +41,9 @@ System.out.println("Invalid path to example file"); System.exit(0); } - session.loadFile(fileName,"foo_mod"); + session.loadFile(fileName,"example"); - String command = "?Y : foo @ foo_mod."; + String command = "?Y : foo @ example."; Iterator fooObjs = session.ExecuteQuery(command); FloraObject johnSuper = null; @@ -56,37 +56,37 @@ } - foo objJohn = new foo(johnSuper,"foo_mod"); - boolean check = objJohn.getBN_boolean(); + foo objJohn = new foo(johnSuper,"example"); + boolean check = objJohn.getBDN_boolean(); if (check) System.out.println("boolean is true"); else System.out.println("boolean is false"); - check = objJohn.getBN_boolean2(); + check = objJohn.getBDN_boolean2(); if(check) System.out.println("boolean2 is true"); else System.out.println("boolean2 is false"); - check = objJohn.getPN_procedural(); + check = objJohn.getPDN_procedural(); if (check) System.out.println("procedural is true"); else System.out.println("procedural is false"); - check = objJohn.getPN_procedural2(); + check = objJohn.getPDN_procedural2(); if (check) System.out.println("procedural2 is true"); else System.out.println("procedural2 is false"); - objJohn.setDN_bonus("2004","Jan","5000"); + objJohn.setVDN_bonus("2004","Jan","5000"); System.out.println("Set John's bonus"); - objJohn.setDN_age("2004","50"); + objJohn.setVDN_age("2004","50"); System.out.println("Set John's age"); - Iterator ageValues = objJohn.getDN_age("2004"); + Iterator ageValues = objJohn.getVDN_age("2004"); while (ageValues.hasNext()) { System.out.println("John's age:"+ageValues.next()); } @@ -95,21 +95,21 @@ ancestors.add("mary"); ancestors.add("sally"); - objJohn.setDN_ancestors(ancestors); + objJohn.setVDN_ancestors(ancestors); System.out.println("John obj:"+objJohn); /* To show the use of ExecuteQuery/2 */ - objJohn.setDN_ancestors(ancestors); + objJohn.setVDN_ancestors(ancestors); System.out.println("John obj:"+objJohn); Vector vars = new Vector(); vars.add("?X"); vars.add("?Y"); - Iterator allmatches = session.ExecuteQuery("?X : ?Y @ foo_mod.",vars); + Iterator allmatches = session.ExecuteQuery("?X : ?Y @ example.",vars); HashMap firstmatch; - System.out.println("Query: ?X : ?Y @ foo_mod."); + System.out.println("Query: ?X : ?Y @ example."); while (allmatches.hasNext()) { firstmatch = (HashMap)allmatches.next(); Object Xobj = firstmatch.get("?X"); |
|
From: Michael K. <ki...@us...> - 2006-06-02 04:52:20
|
Update of /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv30544/java/API/net/sourceforge/flora/javaAPI/src Modified Files: PrologFlora.java FloraSession.java FloraObject.java FloraMethod.java FloraConstants.java Log Message: further improvements to the java API Index: FloraMethod.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/FloraMethod.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FloraMethod.java 29 May 2006 05:00:49 -0000 1.2 +++ FloraMethod.java 2 Jun 2006 04:52:16 -0000 1.3 @@ -40,7 +40,9 @@ public boolean inheritable; public int type; // DATA, BOOLEAN, PROCEDURAL - public FloraMethod(FloraObject methodName,Vector params, FloraObject returnType, boolean inheritable, int type) + public FloraMethod(FloraObject methodName, + Vector params, FloraObject returnType, + boolean inheritable, int type) { this.methodName = methodName; this.parameters = params; @@ -49,15 +51,22 @@ this.type = type; return; } + + public String toString() + { + return methodName.toString(); + } - public void PrintMethod() + // mainly for debugging + public String methodDetails() { - System.out.println("Method Name : " + methodName.toString()); - System.out.println("Parameters: " + parameters.toString()); - System.out.println("ReturnType: " + returnType.toString()); - System.out.print("Inheritability: " + printableInheritability(inheritable)); - System.out.println("MethodType: " + printableMethodType(type)); - return; + return + "Method name: " + methodName.toString() + + "\n parameters: " + parameters.toString() + + "\n return type: " + (returnType==null? + "*none*" : returnType.floraOID.toString()) + + "\n inheritability: " + printableInheritability(inheritable) + + "\n method type: " + printableMethodType(type); } } Index: FloraSession.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/FloraSession.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FloraSession.java 29 May 2006 05:00:49 -0000 1.2 +++ FloraSession.java 2 Jun 2006 04:52:16 -0000 1.3 @@ -48,17 +48,10 @@ System.out.println("FLORA-2 session started"); } - public FloraSession(boolean debug) - { - flora = new PrologFlora(); - if(debug) - System.out.println("FLORA-2 session started"); - - } - /* Execute a command at the FLORA-2 session ** True, if the command succeeds + ** ** command : the command to be executed */ public boolean ExecuteCommand(String command) Index: PrologFlora.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/PrologFlora.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PrologFlora.java 29 May 2006 05:00:49 -0000 1.2 +++ PrologFlora.java 2 Jun 2006 04:52:16 -0000 1.3 @@ -106,7 +106,7 @@ public Object[] FloraCommand(String cmd,Vector vars) { StringBuffer sb = new StringBuffer(); - String varsString = "["; + String varsString = ""; for (int i=0; i<vars.size(); i++) { String floravar = (String)vars.elementAt(i); if (!floravar.startsWith("?")) @@ -115,16 +115,10 @@ + ". Variables passed to ExecuteQuery " + "must be FLORA-2 variables and " + "start with a `?'"); - varsString = - varsString + "'" + (String)vars.elementAt(i) + "'=" - + "__Var" + i + ","; - } - if(vars.size()>0) { - int lastidx = varsString.length()-1; - varsString = varsString.substring(0,lastidx) + "]"; - } else { - varsString = "[]"; + if (i>0) varsString += ","; + varsString += "'" + (String)vars.elementAt(i) + "'=__Var" + i; } + varsString = "[" + varsString + "]"; String listString = "L_rnd="+varsString + ","; String queryString = "S_rnd='"+cmd + "',"; Index: FloraConstants.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/FloraConstants.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FloraConstants.java 29 May 2006 05:00:49 -0000 1.1 +++ FloraConstants.java 2 Jun 2006 04:52:16 -0000 1.2 @@ -51,22 +51,28 @@ public final static String AT_MODULE_SYMBOL = "@"; - public final static int DATA = 0; - public final static int BOOLEAN = 1; - public final static int PROCEDURAL = 2; + public final static boolean DATA = true; + public final static boolean SIGNATURE = false; + + public final static int VALUE = 1; + public final static int BOOLEAN = 2; + public final static int PROCEDURAL = 3; public final static boolean INHERITABLE = true; public final static boolean NONINHERITABLE = false; + public final static String WRAP_HILOG = "flapply"; + + public static String printableMethodType(int type) { - if (type == DATA) return "regular"; + if (type == VALUE) return "value"; else if (type == BOOLEAN) return "boolean"; else if (type == PROCEDURAL) return "procedural"; else throw new FlrException("j2flora2: Invalid method type, " + type); } public static void checkMethodType(int type) { - if (type != DATA && + if (type != VALUE && type != BOOLEAN && type != PROCEDURAL) throw new FlrException("j2flora2: Invalid method type, " + type); @@ -76,4 +82,9 @@ if (inherit) return "inheritable"; else return "noninheritable"; } + + public static String printableAtomType(boolean atomtype) { + if (atomtype==DATA) return "data"; + else return "signature"; + } } Index: FloraObject.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/FloraObject.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- FloraObject.java 29 May 2006 05:00:49 -0000 1.3 +++ FloraObject.java 2 Jun 2006 04:52:16 -0000 1.4 @@ -1,6 +1,6 @@ /* File: FloraObject.java ** -** Author(s): Aditi Pandit +** Author(s): Aditi Pandit, Michael Kifer ** ** Contact: flo...@li... ** @@ -46,10 +46,9 @@ public class FloraObject extends FloraConstants { FloraSession session; - // The next three are set by proxy object constructors within - // automatically generated files (by %write(?,?,?)) + // floraOID is set by proxy object constructors within + // the files automatically generated by %write(?,?,?) public TermModel floraOID; - public TermModel floraClassName; // = new TermModel(); public FloraObject(TermModel name,FloraSession sess) { @@ -59,13 +58,33 @@ public FloraObject(String name, FloraSession sess) { - floraOID = new TermModel(name); + String oid = name.trim(); session = sess; + + if (oid.endsWith(")")) { + // oid was a complex term - convert it into a TermModel object + String query = "buildTermModel(("+oid+"),Model)"; + floraOID = + (TermModel)sess.flora.engine.deterministicGoal(query,"[Model]")[0]; + } else + // oid was not a complex term + floraOID = new TermModel(oid); } + public String toString () { - return this.floraOID.toString(); + if (floraOID.isAtom() || floraOID.isVar() + || floraOID.isList() || floraOID.isNumber()) + return floraOID.toString(); + else { + // ensure that HiLog terms are printed without flapply + String query = + "flora_plg2hlg(PTerm, (" + this.floraOID + "), " + + WRAP_HILOG + ", 0), buildTermModel(PTerm,Model)"; + return + ((TermModel)session.flora.engine.deterministicGoal(query,"[Model]")[0]).toString(); + } } @@ -75,12 +94,22 @@ ** inherit: whether the method is inheritable or not ** parameters: parameters passed to the method */ - public boolean getboolean(String moduleName, Object methodName,boolean inherit,Vector parameters) + public boolean getboolean(String moduleName, Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) { String paramList = makeParameterListString(parameters); + String methodmodifier = ""; + if (isDataAtom) + methodmodifier = + (inherit ? + INHERITABLE_METHOD_SYMBOL : NONINHERITABLE_METHOD_SYMBOL); + else + methodmodifier = + (inherit ? + INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); + String floraQuery = floraOID + "[" - + (inherit ? INHERITABLE_METHOD_SYMBOL : NONINHERITABLE_METHOD_SYMBOL) + + methodmodifier + methodName.toString() + paramList + "]" + AT_MODULE_SYMBOL + moduleName + "."; @@ -102,7 +131,7 @@ ** inherit : whether the method is inheritable or not ** parameters : the parameters for the method */ - public Iterator getbooleanAll(String moduleName, Object methodName,boolean inherit,Vector parameters) + public Iterator getbooleanAll(String moduleName, Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) { String floraQuery = ""; String paramList = makeParameterListString(parameters); @@ -116,10 +145,14 @@ } String methodmodifier = ""; - if (inherit) - methodmodifier = INHERITABLE_METHOD_SYMBOL; + if (isDataAtom) + methodmodifier = + (inherit ? + INHERITABLE_METHOD_SYMBOL : NONINHERITABLE_METHOD_SYMBOL); else - methodmodifier = NONINHERITABLE_METHOD_SYMBOL; + methodmodifier = + (inherit ? + INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); floraQuery = floraOID + "[" + methodmodifier + methodName.toString() + paramList @@ -143,12 +176,22 @@ ** inherit: whether the method is inheritable or not ** parameters: parameters passed to the method */ - public boolean setboolean(String moduleName, Object methodName,boolean inherit,Vector parameters) + public boolean setboolean(String moduleName,Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) { String paramList = makeParameterListString(parameters); + String methodmodifier = ""; + if (isDataAtom) + methodmodifier = + (inherit ? + INHERITABLE_METHOD_SYMBOL : NONINHERITABLE_METHOD_SYMBOL); + else + methodmodifier = + (inherit ? + INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); + String floraQuery= "insert{" + floraOID + "[" - + (inherit ? INHERITABLE_METHOD_SYMBOL : NONINHERITABLE_METHOD_SYMBOL) + + methodmodifier + methodName.toString() + paramList + "]" + AT_MODULE_SYMBOL + moduleName + "}."; @@ -169,12 +212,23 @@ ** inherit: whether the method is inheritable or not ** parameters: parameters passed to the method */ - public boolean deleteboolean(String moduleName, Object methodName,boolean inherit,Vector parameters) + public boolean deleteboolean(String moduleName, Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) { String paramList = makeParameterListString(parameters); + + String methodmodifier = ""; + if (isDataAtom) + methodmodifier = + (inherit ? + INHERITABLE_METHOD_SYMBOL : NONINHERITABLE_METHOD_SYMBOL); + else + methodmodifier = + (inherit ? + INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); + String floraQuery = "deleteall{" + floraOID + "[" - + (inherit ? INHERITABLE_METHOD_SYMBOL : NONINHERITABLE_METHOD_SYMBOL) + + methodmodifier + methodName.toString() + paramList + "]" + AT_MODULE_SYMBOL + moduleName + "}."; @@ -196,11 +250,22 @@ ** inherit: ignored - for future use ** parameters: parameters passed to the method */ - public boolean getprocedural(String moduleName, Object methodName,boolean inherit,Vector parameters) + public boolean getprocedural(String moduleName,Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) { String paramList = makeParameterListString(parameters); + + String methodmodifier = ""; + if (isDataAtom) + methodmodifier = ""; + else + methodmodifier = + (inherit ? + INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); + String floraQuery = - floraOID + "[%" + methodName.toString() + floraOID + "[" + + methodmodifier + " " + + PROCEDURAL_METHOD_SYMBOL + methodName.toString() + paramList + "]" + AT_MODULE_SYMBOL + moduleName + "."; @@ -215,14 +280,14 @@ } - /* Get all values for a procedural method where the arguments might be unbound. + /* Get all values for a procedural method. The arguments might be unbound. ** For instance, obj[m(aaa,?Y)] or obj[*m(aaa,?Y)] ** ** methodName : name of method whose value is to be got ** inherit : whether the method is inheritable or not ** parameters : the parameters for the method */ - public Iterator getproceduralAll(String moduleName, Object methodName,boolean inherit,Vector parameters) + public Iterator getproceduralAll(String moduleName, Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) { String floraQuery = ""; String paramList = makeParameterListString(parameters); @@ -237,13 +302,17 @@ // inherit is ignored here String methodmodifier = ""; - if (inherit) - methodmodifier = PROCEDURAL_METHOD_SYMBOL; + if (isDataAtom) + methodmodifier = ""; else - methodmodifier = PROCEDURAL_METHOD_SYMBOL; + methodmodifier = + (inherit ? + INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); floraQuery = - floraOID + "[" + methodmodifier + methodName.toString() + paramList + floraOID + "[" + methodmodifier + " " + + PROCEDURAL_METHOD_SYMBOL + + methodName.toString() + paramList + "]" + AT_MODULE_SYMBOL + moduleName + "."; try { @@ -263,11 +332,22 @@ ** inherit: ignored - for future use ** parameters: parameters passed to the method */ - public boolean setprocedural(String moduleName, Object methodName,boolean inherit,Vector parameters) + public boolean setprocedural(String moduleName, Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) { String paramList = makeParameterListString(parameters); + + String methodmodifier = ""; + if (isDataAtom) + methodmodifier = ""; + else + methodmodifier = + (inherit ? + INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); + String floraQuery= - "insert{" + floraOID + "[%" + methodName.toString() + "insert{" + floraOID + "[" + methodmodifier + " " + + PROCEDURAL_METHOD_SYMBOL + + methodName.toString() + paramList + "]" + AT_MODULE_SYMBOL + moduleName + "}."; try { @@ -287,11 +367,22 @@ ** inherit: ignored - for future use ** parameters: parameters passed to the method */ - public boolean deleteprocedural(String moduleName, Object methodName,boolean inherit,Vector parameters) + public boolean deleteprocedural(String moduleName, Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) { String paramList = makeParameterListString(parameters); + + String methodmodifier = ""; + if (isDataAtom) + methodmodifier = ""; + else + methodmodifier = + (inherit ? + INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); + String floraQuery= - "deleteall{" + floraOID + "[%" + methodName.toString() + "deleteall{" + floraOID + "[" + methodmodifier + " " + + PROCEDURAL_METHOD_SYMBOL + + methodName.toString() + paramList + "]" + AT_MODULE_SYMBOL + moduleName + "}."; try { @@ -311,16 +402,18 @@ ** parameters : the parameters to the method ** value : the value of the method to be deleted */ - public boolean deletedata(String moduleName, Object methodName,boolean inherit,Vector parameters,Object value) + public boolean deletevalue(String moduleName, Object methodName,boolean inherit,boolean isDataAtom,Vector parameters,Object value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; - if (inherit) - operatorstring = INHERIT_DATA_ARROW; + if (isDataAtom) + operatorstring = + (inherit ? INHERIT_DATA_ARROW : NONINHERIT_DATA_ARROW); else - operatorstring = NONINHERIT_DATA_ARROW; + operatorstring = + (inherit ? INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); floraQuery = "deleteall{"+floraOID + "[" + methodName.toString() + paramList @@ -338,23 +431,108 @@ } + /* Get all values for a method where the arguments might be unbound. + ** For instance, obj[m(aaa,?Y) -> ?Z] or obj[m(aaa,?Y) *-> ?Z] + ** + ** methodName : name of method whose value is to be got + ** inherit : whether the method is inheritable or not + ** parameters : the parameters for the method + */ + public Iterator getvalueAll(String moduleName, Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) + { + String floraQuery = ""; + String paramList = makeParameterListString(parameters); + + // add variable arguments of method to get their bindings out + Vector argList = new Vector(); + int noOfPars = parameters.size(); + for (int i=0; i<noOfPars; i++) { + String param = parameters.elementAt(i).toString(); + if (param.startsWith("?")) argList.add(param); + } + + String operatorstring = ""; + if (isDataAtom) + operatorstring = + (inherit ? INHERIT_DATA_ARROW : NONINHERIT_DATA_ARROW); + else + operatorstring = + (inherit ? INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); + + // Use weird name Value___395792 to avoid clashes with argList vars + floraQuery = + floraOID + "[" + methodName.toString() + paramList + operatorstring + + "?Value___395792]" + AT_MODULE_SYMBOL + moduleName + "."; + argList.add("?Value___395792"); + + try { + return session.FindAllMatches(floraQuery,argList); + } + catch(Exception e) { + e.printStackTrace(); + throw new FlrException("j2flora2: Error in getvalueAll. Query was " + + floraQuery); + } + } + + + /* Get all values for a method, where all arguments are bound. + ** + ** methodName : name of method whose value is to be got + ** inherit : whether the method is inheritable or not + ** parameters : the parameters for the method + */ + public Iterator getvalue(String moduleName,Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) + { + String floraQuery = ""; + String paramList = makeParameterListString(parameters); + + String operatorstring = ""; + if (isDataAtom) + operatorstring = + (inherit ? INHERIT_DATA_ARROW : NONINHERIT_DATA_ARROW); + else + operatorstring = + (inherit ? INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); + + floraQuery = + floraOID + "[" + methodName.toString() + paramList + operatorstring + + "?Value]" + AT_MODULE_SYMBOL + moduleName + "."; + + if (debug) + System.out.println("In get/3, floraQuery: " + floraQuery); + + try { + return session.ExecuteQuery(floraQuery); + } + catch (Exception e) { + e.printStackTrace(); + throw new FlrException("j2flora2: Method " + methodName + + " failed on object " + floraOID + + " in module " + moduleName); + } + } + + /* Delete a set of values from a method's result ** methodName : method ** inherit : whether the method is inheritable or not ** parameters : the parameters to the method ** value : the values of the method to be deleted */ - public boolean deletedata(String moduleName, Object methodName,boolean inherit,Vector parameters,Vector value) + public boolean deletevalue(String moduleName, Object methodName,boolean inherit,boolean isDataAtom,Vector parameters,Vector value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String valuelist = makeValueListString(value); String operatorstring = ""; - if (inherit) - operatorstring += INHERIT_DATA_ARROW; + if (isDataAtom) + operatorstring = + (inherit ? INHERIT_DATA_ARROW : NONINHERIT_DATA_ARROW); else - operatorstring += NONINHERIT_DATA_ARROW; + operatorstring = + (inherit ? INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); floraQuery = "deleteall{" + floraOID + "[" + methodName.toString() @@ -371,23 +549,24 @@ } - /* Delete all bindings of a method + /* Delete all values for a method ** ** methodName : name of method ** inherit : whether the method is inheritable or not ** parameters : the parameters to the method */ - public boolean deletedata(String moduleName, Object methodName,boolean inherit,Vector parameters) + public boolean deletevalue(String moduleName, Object methodName,boolean inherit,boolean isDataAtom,Vector parameters) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; - if (inherit) { - operatorstring += INHERIT_DATA_ARROW; - } else { - operatorstring += NONINHERIT_DATA_ARROW; - } + if (isDataAtom) + operatorstring = + (inherit ? INHERIT_DATA_ARROW : NONINHERIT_DATA_ARROW); + else + operatorstring = + (inherit ? INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); floraQuery = "deleteall{" + floraOID + "[" + methodName.toString() @@ -412,16 +591,18 @@ ** parameters : parameters to the method ** value : value to be set to */ - public boolean setdata(String moduleName, Object methodName,boolean inherit,Vector parameters,Object value) + public boolean setvalue(String moduleName,Object methodName,boolean inherit,boolean isDataAtom,Vector parameters,Object value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; - if(inherit) - operatorstring += INHERIT_DATA_ARROW; + if (isDataAtom) + operatorstring = + (inherit ? INHERIT_DATA_ARROW : NONINHERIT_DATA_ARROW); else - operatorstring += NONINHERIT_DATA_ARROW; + operatorstring = + (inherit ? INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); floraQuery = "insert{"+floraOID + "[" + methodName + paramList @@ -445,17 +626,19 @@ ** parameters : parameters to the method ** value : vector of values to be set to */ - public boolean setdata(String moduleName,Object methodName,boolean inherit,Vector parameters,Vector value) + public boolean setvalue(String moduleName,Object methodName,boolean inherit,boolean isDataAtom,Vector parameters,Vector value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String valuelist = makeValueListString(value); String operatorstring = ""; - if (inherit) - operatorstring += INHERIT_DATA_ARROW; + if (isDataAtom) + operatorstring = + (inherit ? INHERIT_DATA_ARROW : NONINHERIT_DATA_ARROW); else - operatorstring += NONINHERIT_DATA_ARROW; + operatorstring = + (inherit ? INHERIT_SIGNATURE_ARROW : NONINHERIT_SIGNATURE_ARROW); floraQuery = "insert{"+floraOID + "[" + methodName.toString() + paramList @@ -472,11 +655,11 @@ } - /* Get all instances of the class of this object */ + /* Get all instances of of this object */ public Iterator getInstances(String moduleName) { String floraQuery = - "?Object" + ISA_SYMBOL + floraClassName.toString() + "?Object" + ISA_SYMBOL + this.toString() + AT_MODULE_SYMBOL + moduleName + "."; try { @@ -490,16 +673,16 @@ } - /* Get all instances of the current class that are it's + /* Get all instances of the object that are it's ** direct instances and not instances of any subclasses */ - public Iterator getOwnInstances(String moduleName) + public Iterator getDirectInstances(String moduleName) { // Construct a query of the form ?X:C, not ((?_S::C, ?X:?_S)). String floraQuery = - "( ?Object" + ISA_SYMBOL + floraClassName.toString() + "( ?Object" + ISA_SYMBOL + this.toString() + ", not ((?__Subcl" + SUBCLASS_SYMBOL - + floraClassName.toString() + ", ?Object" + + this.toString() + ", ?Object" + ISA_SYMBOL + "?__Subcl)) )" + AT_MODULE_SYMBOL + moduleName + "."; @@ -514,11 +697,11 @@ } - /* Get all SubClasses of the class of this object */ + /* Get all SubClasses of this object */ public Iterator getSubClasses(String moduleName) { String floraQuery = - "?Class" + SUBCLASS_SYMBOL + floraClassName.toString() + "?Class" + SUBCLASS_SYMBOL + this.toString() + AT_MODULE_SYMBOL + moduleName + "."; try { @@ -532,11 +715,32 @@ } - /* Get all SuperClasses of the class of this object */ + /* Get all direct SubClasses of this object */ + public Iterator getDirectSubClasses(String moduleName) + { + // construct query of the form ?S :: SC, not ((?S::?_Mid, ?_Mid::SC)). + String floraQuery = + "( ?Class " + SUBCLASS_SYMBOL + this.toString() + + ", not (( ?Class" + SUBCLASS_SYMBOL + + "?__Mid, ?__Mid" + SUBCLASS_SYMBOL + this.toString() + " )))" + + AT_MODULE_SYMBOL + moduleName + "."; + + try { + return session.ExecuteQuery(floraQuery); + } + catch (Exception e) { + e.printStackTrace(); + throw new FlrException("j2flora2: Error in getSuperClasses. Query was " + + floraQuery); + } + } + + + /* Get all SuperClasses of this object */ public Iterator getSuperClasses(String moduleName) { String floraQuery = - floraClassName.toString() + SUBCLASS_SYMBOL + this.toString() + SUBCLASS_SYMBOL + "?Class" + AT_MODULE_SYMBOL + moduleName + "."; try { @@ -550,13 +754,13 @@ } - /* Get all direct SuperClasses of the class of this object */ + /* Get all direct SuperClasses of this object */ public Iterator getDirectSuperClasses(String moduleName) { // construct query of the form SC::?S, not ((SC::?_Mid, ?_Mid::?S)). String floraQuery = - "( " + floraClassName + SUBCLASS_SYMBOL + "?Class, " - + "not ((" + floraClassName + SUBCLASS_SYMBOL + "( " + this.toString() + SUBCLASS_SYMBOL + "?Class, " + + "not ((" + this.toString() + SUBCLASS_SYMBOL + "?__Mid, ?__Mid" + SUBCLASS_SYMBOL + "?Class)))" + AT_MODULE_SYMBOL + moduleName + "."; @@ -571,30 +775,31 @@ } - /* Get all the methods of the class to which this object belongs - ** This doesn't return boolean or procedural methods. + /* Get all the declared methods of the class to which this object belongs + ** + ** moduleName - module in which the methods are defined */ - public Iterator getAllMethods(String moduleName) + public Iterator getMethods(String moduleName) { Vector allMethods = new Vector(); - Iterator methodIter = getMethods(moduleName,NONINHERITABLE,DATA); // noninh data + Iterator methodIter = getMethods(moduleName,NONINHERITABLE,VALUE); while(methodIter.hasNext()) allMethods.add((FloraMethod)(methodIter.next())); - methodIter = getMethods(moduleName,INHERITABLE,DATA); // inh data + methodIter = getMethods(moduleName,INHERITABLE,VALUE); while(methodIter.hasNext()) allMethods.add((FloraMethod)(methodIter.next())); - methodIter = getMethods(moduleName,INHERITABLE,BOOLEAN); // inh bool + methodIter = getMethods(moduleName,INHERITABLE,BOOLEAN); while(methodIter.hasNext()) allMethods.add((FloraMethod)(methodIter.next())); - methodIter = getMethods(moduleName,NONINHERITABLE,BOOLEAN); // noninh bool + methodIter = getMethods(moduleName,NONINHERITABLE,BOOLEAN); while(methodIter.hasNext()) allMethods.add((FloraMethod)(methodIter.next())); - methodIter = getMethods(moduleName,NONINHERITABLE,PROCEDURAL); // noninh proc + methodIter = getMethods(moduleName,NONINHERITABLE,PROCEDURAL); while(methodIter.hasNext()) allMethods.add((FloraMethod)(methodIter.next())); @@ -602,11 +807,11 @@ } - /* Get methods of a particular type (inheritable or noninheritable). - ** Returns only set-valued methods - not boolean or procedural + /* Get methods of a particular type (inheritable or + ** noninheritable, boolean, ptocedural, etc.). ** ** inherit : indicates if the method is inheritable - ** methType: DATA, BOOLEAN, PROCEDURAL + ** methType: VALUE, BOOLEAN, PROCEDURAL */ private Iterator getMethods(String moduleName, boolean inherit, int methType) { @@ -615,7 +820,7 @@ checkMethodType(methType); - if (methType == DATA) { + if (methType == VALUE) { if (inherit) valuePart = INHERIT_SIGNATURE_ARROW + "?Value"; else @@ -639,10 +844,11 @@ vars.add("?Arguments"); String floraQueryString = - "(" + floraClassName.toString() + "(" + this.toString() + "[" + callModifier + "?__Call" + valuePart + "]" - + ", ?__Call =.. [hilog(?Method) | ?Arguments]" - + ")" + AT_MODULE_SYMBOL + moduleName +"."; + + ", (?__Call =.. [hilog(?Method) | ?Arguments] " + + "or (?__Call =.. [?Method | ?Arguments], atom(?Method)))" + + ")" + AT_MODULE_SYMBOL + moduleName + "."; Iterator methodMatches; Vector returnMethodVec = new Vector(); @@ -652,9 +858,12 @@ while (methodMatches.hasNext()) { firstmatch = (HashMap)methodMatches.next(); FloraObject methodObj = (FloraObject)firstmatch.get("?Method"); + FloraObject returnTypeObj = - // should be null, if ?Value isn't used for procedural/bool + // unbound, if ?Value isn't used for procedural/bool (FloraObject)firstmatch.get("?Value"); + if (returnTypeObj.floraOID.isVar()) returnTypeObj = null; + TermModel methodArgs = ((FloraObject)firstmatch.get("?Arguments")).floraOID; @@ -676,85 +885,6 @@ } - /* Get all values for a method, where all arguments are bound. - ** - ** methodName : name of method whose value is to be got - ** inherit : whether the method is inheritable or not - ** parameters : the parameters for the method - */ - public Iterator getdata(String moduleName, Object methodName,boolean inherit,Vector parameters) - { - String floraQuery = ""; - String paramList = makeParameterListString(parameters); - - String operatorstring = ""; - if (inherit) - operatorstring += INHERIT_DATA_ARROW; - else - operatorstring += NONINHERIT_DATA_ARROW; - - floraQuery = - floraOID + "[" + methodName.toString() + paramList + operatorstring - + "?Value]" + AT_MODULE_SYMBOL + moduleName + "."; - - if (debug) - System.out.println("In get/3, floraQuery: " + floraQuery); - - try { - return session.ExecuteQuery(floraQuery); - } - catch (Exception e) { - e.printStackTrace(); - throw new FlrException("j2flora2: Method " + methodName - + " failed on object " + floraOID - + " in module " + moduleName); - } - } - - - /* Get all values for a method where the arguments might be unbound. - ** For instance, obj[m(aaa,?Y) -> ?Z] or obj[m(aaa,?Y) *-> ?Z] - ** - ** methodName : name of method whose value is to be got - ** inherit : whether the method is inheritable or not - ** parameters : the parameters for the method - */ - public Iterator getdataAll(String moduleName, Object methodName,boolean inherit,Vector parameters) - { - String floraQuery = ""; - String paramList = makeParameterListString(parameters); - - // add variable arguments of method to get their bindings out - Vector argList = new Vector(); - int noOfPars = parameters.size(); - for (int i=0; i<noOfPars; i++) { - String param = parameters.elementAt(i).toString(); - if (param.startsWith("?")) argList.add(param); - } - - String operatorstring = ""; - if (inherit) - operatorstring += INHERIT_DATA_ARROW; - else - operatorstring += NONINHERIT_DATA_ARROW; - - // Use weird name Value___395792 to avoid clashes with argList vars - floraQuery = - floraOID + "[" + methodName.toString() + paramList + operatorstring - + "?Value___395792]" + AT_MODULE_SYMBOL + moduleName + "."; - argList.add("?Value___395792"); - - try { - return session.FindAllMatches(floraQuery,argList); - } - catch(Exception e) { - e.printStackTrace(); - throw new FlrException("j2flora2: Error in getdataAll. Query was " - + floraQuery); - } - } - - private String makeParameterListString(Vector parameters) { String paramList = "("; |
|
From: Michael K. <ki...@us...> - 2006-06-02 04:52:20
|
Update of /cvsroot/flora/flora2/docs In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv30544/docs Modified Files: flora-flrjava.tex Log Message: further improvements to the java API Index: flora-flrjava.tex =================================================================== RCS file: /cvsroot/flora/flora2/docs/flora-flrjava.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- flora-flrjava.tex 29 May 2006 05:00:49 -0000 1.8 +++ flora-flrjava.tex 2 Jun 2006 04:52:17 -0000 1.9 @@ -181,7 +181,7 @@ System.out.println("Person name:"+personObj); person currPerson =new person(personObj,"basic_mod"); - Iterator kidsItr = currPerson.getDN_kids(); + Iterator kidsItr = currPerson.getVDN_kids(); while(kidsItr.hasNext()) { Object kidObj = kidsItr.next(); @@ -190,7 +190,7 @@ person kidPerson = null; kidPerson = new person(kidObj,"basic_mod"); - Iterator hobbiesItr = kidPerson.getDN_hobbies(); + Iterator hobbiesItr = kidPerson.getVDN_hobbies(); while(hobbiesItr.hasNext()) { Object hobbyObj = hobbiesItr.next(); System.out.println("Kid:"+kidObj + " has hobby: " + hobbyObj); @@ -239,47 +239,73 @@ example. \paragraph{Stage 2: Generating Java classes that serve as proxies for \FLORA classes.} -The \FLORA side of the Java-to-\FLORA high level API provides a predicate to -generate Java proxy classes for each \fl -class of interest. Each proxy class gets methods to manipulate -the declared attributes and methods of the corresponding \fl class. -If an \fl class has a declared attribute {\tt foobar} then the proxy class -will have the following methods: +The \FLORA side of the Java-to-\FLORA high level API provides a predicate +to generate Java proxy classes for each \fl class of interest. Each proxy +class gets methods to manipulate the declared attributes and methods of the +corresponding \fl class. If an \fl class has a declared value-returning +attribute {\tt foobar} then the proxy class will have the following +methods. Each method name has the form \emph{action}$S_1S_2S_3$\_{\tt + foobar}, where \emph{action} is either {\tt get}, {\tt set}, or {\tt + delete}. The specifier $S_1$ indicates the type of the method --- {\tt V} +for value-returning, {\tt B} for Boolean, and {\tt P} for procedural. The +specifier $S_2$ tells whether the operation applies to the signature if the +method ({\tt S}), e.g., {\tt person[foobar=>string]}, or to the actual data +({\tt D}), for example, {\tt john[foobar->3]}. Finally, the specifier +$S_3$ tells if the operation applies to the inheritable variant of the +method or its non-inheritable variant. %% \begin{enumerate} -\item {\tt public Iterator getDI\_foobar()}\\ - {\tt public Iterator getDN\_foobar()} +\item {\tt public Iterator getVDI\_foobar()}\\ + {\tt public Iterator getVDN\_foobar()} + \\ + {\tt public Iterator getVSI\_foobar()}\\ + {\tt public Iterator getVSN\_foobar()} \\ Queries the knowledge base and gets all answers for the attribute {\tt foobar}. Returns an iterator through which these answers can be obtained. Each object returned by the iterator in of type {\tt FloraObject}. - The {\tt getDN} form queries non-inheritable data methods and {\tt getDI} - inheritable. -\item {\tt public boolean setDI\_foobar(Vector value)}\\ - {\tt public boolean setDN\_foobar(Vector value)} + The {\tt getVDN} form queries non-inheritable data methods and {\tt getVDI} + the inheritable ones. The {\tt getVSI} and {\tt getVSN} query + the signatures of those methods. +\item {\tt public boolean setVDI\_foobar(Vector value)}\\ + {\tt public boolean setVDN\_foobar(Vector value)} + \\ + {\tt public boolean setVSI\_foobar(Vector value)}\\ + {\tt public boolean setVSN\_foobar(Vector value)} \\ Adds values to the set of values for the attribute {\tt foobar}. The values must be placed in the vector parameter of the method. - Again, {\tt setDN} sets non-inheritable methods and {\tt setDI} - inheritable. -\item {\tt public boolean setDI\_foobar(Object value)}\\ - {\tt public boolean setDN\_foobar(Object value)} + Again, {\tt setVDN} sets data for non-inheritable methods and {\tt setVDI} + inheritable and {\tt setVSI}, {\tt setVSN} sets signatures. +\item {\tt public boolean setVDI\_foobar(Object value)}\\ + {\tt public boolean setVDN\_foobar(Object value)} \\ + {\tt public boolean setVSI\_foobar(Object value)}\\ + {\tt public boolean setVSN\_foobar(Object value)}\\ This method provides a simplified interface when only one value needs to be added. It works like the above, except that only one given value is added. -\item {\tt public boolean deleteDI\_foobar(Vector value)}\\ - {\tt public boolean deleteDN\_foobar(Vector value)} +\item {\tt public boolean deleteVDI\_foobar(Vector value)}\\ + {\tt public boolean deleteVDN\_foobar(Vector value)} + \\ + {\tt public boolean deleteVSI\_foobar(Vector value)}\\ + {\tt public boolean deleteVSN\_foobar(Vector value)} \\ Delete a set of values of the attribute {\tt foobar} as specified in the vector argument. -\item {\tt public boolean deleteDI\_foobar(Object value)}\\ - {\tt public boolean deleteDN\_foobar(Object value)} +\item {\tt public boolean deleteVDI\_foobar(Object value)}\\ + {\tt public boolean deleteVDN\_foobar(Object value)} + \\ + {\tt public boolean deleteVSI\_foobar(Object value)}\\ + {\tt public boolean deleteVSN\_foobar(Object value)} \\ Like the above, but provides a simplified interface for the case when only one value needs to be deleted. -\item {\tt public boolean deleteDI\_foobar()}\\ - {\tt public boolean deleteDN\_foobar()} +\item {\tt public boolean deleteVDI\_foobar()}\\ + {\tt public boolean deleteVDN\_foobar()} + \\ + {\tt public boolean deleteVSI\_foobar()}\\ + {\tt public boolean deleteVSN\_foobar()} \\ Delete all values of the attribute {\tt foobar}. \end{enumerate} @@ -287,61 +313,61 @@ For \fl methods with arguments, the high-level API provides Java methods as above, but they take more arguments to accommodate parameters. Let us assume that the \fl method is called {\tt foobar2} and takes parameters -{\tt arg1} and {\tt arg2}. As before the {\tt getDI\_*}, {\tt setDI\_*}, +{\tt arg1} and {\tt arg2}. As before the {\tt getVDI\_*}, {\tt setVDI\_*}, etc., forms of the Java methods are for dealing with inheritable \FLORA -methods and the {\tt getDN\_*}, {\tt setDN\_*}, +methods and the {\tt getVDN\_*}, {\tt setVDN\_*}, etc., forms are for dealing with non-inheritable \FLORA methods. %% \begin{enumerate} -\item {\tt public Iterator getDI\_foobar2(Object arg1, Object arg2)}\\ - {\tt public Iterator getDN\_foobar2(Object arg1, Object arg2)} +\item {\tt public Iterator getVDI\_foobar2(Object arg1, Object arg2)}\\ + {\tt public Iterator getVDN\_foobar2(Object arg1, Object arg2)} \\ Obtain all values for the \fl method invocation {\tt foobar2(arg1,arg2)}. -\item {\tt public boolean setDI\_foobar2(Object arg1, Object arg2, Vector value)}\\ - {\tt public boolean setDN\_foobar2(Object arg1, Object arg2, Vector value)} +\item {\tt public boolean setVDI\_foobar2(Object arg1, Object arg2, Vector value)}\\ + {\tt public boolean setVDN\_foobar2(Object arg1, Object arg2, Vector value)} \\ Add a set of methods specified in {\tt value} for the method invocation {\tt foobar2(arg1,arg2)}. -\item {\tt public boolean setDI\_foobar2(Object arg1, Object arg2, Object value)}\\ - {\tt public boolean setDN\_foobar2(Object arg1, Object arg2, Object value)} +\item {\tt public boolean setVDI\_foobar2(Object arg1, Object arg2, Object value)}\\ + {\tt public boolean setVDN\_foobar2(Object arg1, Object arg2, Object value)} \\ A simplified interface when only one value is to be added. -\item {\tt public boolean deleteDI\_foobar2(Object arg1, Object arg2, Vector value)}\\ - {\tt public boolean deleteDN\_foobar2(Object arg1, Object arg2, Vector value)} +\item {\tt public boolean deleteVDI\_foobar2(Object arg1, Object arg2, Vector value)}\\ + {\tt public boolean deleteVDN\_foobar2(Object arg1, Object arg2, Vector value)} \\ Delete a set of values from {\tt foobar2(arg1,arg2)}. The set is given by the vector parameter {\tt value}. -\item {\tt public boolean deleteDI\_foobar2(Object arg1, Object arg2, Object value)}\\ - {\tt public boolean deleteDN\_foobar2(Object arg1, Object arg2, Object value)} +\item {\tt public boolean deleteVDI\_foobar2(Object arg1, Object arg2, Object value)}\\ + {\tt public boolean deleteVDN\_foobar2(Object arg1, Object arg2, Object value)} \\ A simplified interface for deleting a single value. -\item {\tt public boolean deleteDI\_foobar2(Object arg1, Object arg2)}\\ - {\tt public boolean deleteDN\_foobar2(Object arg1, Object arg2)} +\item {\tt public boolean deleteVDI\_foobar2(Object arg1, Object arg2)}\\ + {\tt public boolean deleteVDN\_foobar2(Object arg1, Object arg2)} \\ Delete all values for the method invocation {\tt foobar2(arg1,arg2)}. \end{enumerate} %% For Boolean and procedural methods, the generated methods are similar except that there is only one set and delete method. In addition, Boolean -inheritable methods use the {\tt getBI\_*}, {\tt setBI\_*}, etc., form, -while non-inheritable methods use the {\tt getBN\_*}, etc., form. -Procedural methods use the {\tt getPI\_*}, {\tt getPN\_*}, etc., forms. +inheritable methods use the {\tt getBDI\_*}, {\tt setBDI\_*}, etc., form, +while non-inheritable methods use the {\tt getBDN\_*}, etc., form. +Procedural methods use the {\tt getPDI\_*}, {\tt getPDN\_*}, etc., forms. For instance, %% \begin{enumerate} -\item {\tt public boolean getBI\_foobar3()} \\ - {\tt public boolean getBN\_foobar3()} \\ - {\tt public boolean getPI\_foobar3()} \\ - {\tt public boolean getPN\_foobar3()} -\item {\tt public boolean setBI\_foobar3()} \\ - {\tt public boolean setBN\_foobar3()} \\ - {\tt public boolean setPI\_foobar3()} \\ - {\tt public boolean setPN\_foobar3()} -\item {\tt public boolean deleteBI\_foobar3()} \\ - {\tt public boolean deleteBN\_foobar3()} \\ - {\tt public boolean deletePI\_foobar3()} \\ - {\tt public boolean deletePN\_foobar3()} +\item {\tt public boolean getBDI\_foobar3()} \\ + {\tt public boolean getBDN\_foobar3()} \\ + {\tt public boolean getPDI\_foobar3()} \\ + {\tt public boolean getPDN\_foobar3()} +\item {\tt public boolean setBDI\_foobar3()} \\ + {\tt public boolean setBDN\_foobar3()} \\ + {\tt public boolean setPDI\_foobar3()} \\ + {\tt public boolean setPDN\_foobar3()} +\item {\tt public boolean deleteBDI\_foobar3()} \\ + {\tt public boolean deleteBDN\_foobar3()} \\ + {\tt public boolean deletePDI\_foobar3()} \\ + {\tt public boolean deletePDN\_foobar3()} \end{enumerate} %% All these methods are generated automatically by executing the following @@ -349,7 +375,7 @@ %% \begin{verbatim} // Arguments: %write(?Class,?Module,?ProxyFileName). - ?- %write(foo,foo_mod,'myproject/foo.java'). + ?- %write(foo,example,'myproject/foo.java'). \end{verbatim} %% The class argument specifies the class for which to generate the methods, @@ -403,54 +429,54 @@ public FloraObject sourceFloraObject; public person(FloraObject sourceFloraObject,String moduleName) { ... } - public boolean setDI_age(Object value) { ... } - public boolean setDN_age(Object value) { ... } - public Iterator getDI_age(){ ... } - public Iterator getDN_age(){ ... } - public boolean deleteDI_age(Object value) { ... } - public boolean deleteDN_age(Object value) { ... } - public boolean deleteDI_age() { ... } - public boolean deleteDN_age() { ... } - public boolean setDI_salary(Object year,Object value) { ... } - public boolean setDN_salary(Object year,Object value) { ... } - public Iterator getDI_salary(Object year) { ... } - public Iterator getDN_salary(Object year) { ... } - public boolean deleteDI_salary(Object year,Object value) { ... } - public boolean deleteDN_salary(Object year,Object value) { ... } - public boolean deleteDI_salary(Object year) { ... } - public boolean deleteDN_salary(Object year) { ... } - public boolean setDI_hobbies(Vector value) { ... } - public boolean setDN_hobbies(Vector value) { ... } - public Iterator getDI_hobbies(){ ... } - public Iterator getDN_hobbies(){ ... } - public boolean deleteDI_hobbies(Vector value) { ... } - public boolean deleteDN_hobbies(Vector value) { ... } - public boolean deleteDI_hobbies(){ ... } - public boolean deleteDN_hobbies(){ ... } - public boolean setDI_instances(Vector value) { ... } - public boolean setDN_instances(Vector value) { ... } - public Iterator getDI_instances(){ ... } - public Iterator getDN_instances(){ ... } - public boolean deleteDI_instances(Vector value) { ... } - public boolean deleteDN_instances(Vector value) { ... } - public boolean deleteDI_instances(){ ... } - public boolean deleteDN_instances(){ ... } - public boolean setDI_kids(Vector value) { ... } - public boolean setDN_kids(Vector value) { ... } - public Iterator getDI_kids(){ ... } - public Iterator getDN_kids(){ ... } - public boolean deleteDI_kids(Vector value) { ... } - public boolean deleteDN_kids(Vector value) { ... } - public boolean deleteDI_kids(){ ... } - public boolean deleteDN_kids(){ ... } - public boolean setDI_believes_in(Vector value) { ... } - public boolean setDN_believes_in(Vector value) { ... } - public Iterator getDI_believes_in(){ ... } - public Iterator getDN_believes_in(){ ... } - public boolean deleteDI_believes_in(Vector value) { ... } - public boolean deleteDN_believes_in(Vector value) { ... } - public boolean deleteDI_believes_in(){ ... } - public boolean deleteDN_believes_in(){ ... } + public boolean setVDI_age(Object value) { ... } + public boolean setVDN_age(Object value) { ... } + public Iterator getVDI_age(){ ... } + public Iterator getVDN_age(){ ... } + public boolean deleteVDI_age(Object value) { ... } + public boolean deleteVDN_age(Object value) { ... } + public boolean deleteVDI_age() { ... } + public boolean deleteVDN_age() { ... } + public boolean setVDI_salary(Object year,Object value) { ... } + public boolean setVDN_salary(Object year,Object value) { ... } + public Iterator getVDI_salary(Object year) { ... } + public Iterator getVDN_salary(Object year) { ... } + public boolean deleteVDI_salary(Object year,Object value) { ... } + public boolean deleteVDN_salary(Object year,Object value) { ... } + public boolean deleteVDI_salary(Object year) { ... } + public boolean deleteVDN_salary(Object year) { ... } + public boolean setVDI_hobbies(Vector value) { ... } + public boolean setVDN_hobbies(Vector value) { ... } + public Iterator getVDI_hobbies(){ ... } + public Iterator getVDN_hobbies(){ ... } + public boolean deleteVDI_hobbies(Vector value) { ... } + public boolean deleteVDN_hobbies(Vector value) { ... } + public boolean deleteVDI_hobbies(){ ... } + public boolean deleteVDN_hobbies(){ ... } + public boolean setVDI_instances(Vector value) { ... } + public boolean setVDN_instances(Vector value) { ... } + public Iterator getVDI_instances(){ ... } + public Iterator getVDN_instances(){ ... } + public boolean deleteVDI_instances(Vector value) { ... } + public boolean deleteVDN_instances(Vector value) { ... } + public boolean deleteVDI_instances(){ ... } + public boolean deleteVDN_instances(){ ... } + public boolean setVDI_kids(Vector value) { ... } + public boolean setVDN_kids(Vector value) { ... } + public Iterator getVDI_kids(){ ... } + public Iterator getVDN_kids(){ ... } + public boolean deleteVDI_kids(Vector value) { ... } + public boolean deleteVDN_kids(Vector value) { ... } + public boolean deleteVDI_kids(){ ... } + public boolean deleteVDN_kids(){ ... } + public boolean setVDI_believes_in(Vector value) { ... } + public boolean setVDN_believes_in(Vector value) { ... } + public Iterator getVDI_believes_in(){ ... } + public Iterator getVDN_believes_in(){ ... } + public boolean deleteVDI_believes_in(Vector value) { ... } + public boolean deleteVDN_believes_in(Vector value) { ... } + public boolean deleteVDI_believes_in(){ ... } + public boolean deleteVDN_believes_in(){ ... } } \end{verbatim} \end{quote} @@ -500,10 +526,10 @@ currPerson =new person(personObj,"basic_mod"); /* Set that person's age to 50 */ - currPerson.setDN_age("50"); + currPerson.setVDN_age("50"); /* Get this person's kids */ - Iterator kidsItr = currPerson.getDN_kids(); + Iterator kidsItr = currPerson.getVDN_kids(); while (kidsItr.hasNext()) { FloraObject kidObj = (FloraObject)(kidsItr.next()); System.out.println("Person: " + personObj + " has kid: " +kidObj); @@ -513,7 +539,7 @@ kidPerson = new person(kidObj,"basic_mod"); /* Get kidPerson's hobbies */ - Iterator hobbiesItr = kidPerson.getDN_hobbies(); + Iterator hobbiesItr = kidPerson.getVDN_hobbies(); while(hobbiesItr.hasNext()) { FloraObject hobbyObj = (FloraObject)(hobbiesItr.next()); System.out.println("Kid:"+kidObj + " has hobby:" +hobbyObj); |
|
From: Michael K. <ki...@us...> - 2006-06-02 04:52:20
|
Update of /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv30544/java/API/examples/flogicbasicsExample Modified Files: person.java flogicbasicsExample.java flogic_basics.flr Log Message: further improvements to the java API Index: person.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample/person.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- person.java 29 May 2006 05:00:49 -0000 1.3 +++ person.java 2 Jun 2006 04:52:17 -0000 1.4 @@ -1,388 +1,897 @@ + import java.util.*; import com.declarativa.interprolog.TermModel; import net.sourceforge.flora.javaAPI.util.*; import net.sourceforge.flora.javaAPI.src.*; public class person extends FloraConstants { + FloraObject sourceFloraObject; String moduleName; TermModel floraClassName = new TermModel("person"); public person(FloraObject sourceFloraObject,String moduleName) { [...1022 lines suppressed...] +return sourceFloraObject.setvalue(moduleName,"salary",NONINHERITABLE,SIGNATURE,pars,value); +} +public boolean deleteVSN_salary(Object year,Vector value) +{ +Vector pars = new Vector(); +pars.add(year); +return sourceFloraObject.deletevalue(moduleName,"salary",NONINHERITABLE,SIGNATURE,pars,value); +} +public boolean deleteVSN_salary(Object year,Object value) +{ +Vector pars = new Vector(); +pars.add(year); +return sourceFloraObject.deletevalue(moduleName,"salary",NONINHERITABLE,SIGNATURE,pars,value); +} +public boolean deleteVSN_salary(Object year){ +Vector pars = new Vector(); +pars.add(year); +return sourceFloraObject.deletevalue(moduleName,"salary",NONINHERITABLE,SIGNATURE,pars); } } Index: flogicbasicsExample.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample/flogicbasicsExample.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- flogicbasicsExample.java 29 May 2006 05:00:49 -0000 1.3 +++ flogicbasicsExample.java 2 Jun 2006 04:52:17 -0000 1.4 @@ -41,12 +41,12 @@ System.out.println("Invalid path to example file!"); System.exit(0); } - session.loadFile(fileName,"foo_mod"); + session.loadFile(fileName,"example"); /* Running queries from flogic_basics */ /* Query for persons */ - String command = "?X:person@foo_mod."; + String command = "?X:person@example."; System.out.println("Query:"+command); Iterator personObjs = session.ExecuteQuery(command); @@ -56,8 +56,8 @@ FloraObject personObj = (FloraObject)(personObjs.next()); System.out.println("Person name:"+personObj); - currPerson =new person(personObj,"foo_mod"); - Iterator kidsItr = currPerson.getDN_kids(); + currPerson =new person(personObj,"example"); + Iterator kidsItr = currPerson.getVDN_kids(); while(kidsItr.hasNext()) { FloraObject kidObj = (FloraObject)(kidsItr.next()); @@ -65,9 +65,9 @@ + " has kid: " + kidObj); person kidPerson = null; - kidPerson = new person(kidObj,"foo_mod"); + kidPerson = new person(kidObj,"example"); - Iterator hobbiesItr = kidPerson.getDN_hobbies(); + Iterator hobbiesItr = kidPerson.getVDN_hobbies(); while(hobbiesItr.hasNext()) { FloraObject hobbyObj = null; @@ -77,12 +77,23 @@ } } } - - command = "person[instances -> ?X]@foo_mod."; + + FloraObject age; + currPerson = new person("father(mary)", "example", session); + Iterator maryfatherItr = currPerson.getVDN_age(); + age = (FloraObject)maryfatherItr.next(); + System.out.println("Mary's father is " + age + " years old"); + + currPerson = new person("mary", "example", session); + Iterator maryItr = currPerson.getVDN_age(); + age = (FloraObject)maryItr.next(); + System.out.println("Mary is " + age + " years old"); + + command = "person[instances -> ?X]@example."; System.out.println("Query:"+command); personObjs = session.ExecuteQuery(command); - /* Prining out the person names */ + /* Printing out the person names */ while (personObjs.hasNext()) { Object personObj = personObjs.next(); System.out.println("Person Id: "+personObj); @@ -94,17 +105,54 @@ vars.add("?Y"); Iterator allmatches = - session.ExecuteQuery("?X[believes_in -> ?Y]@foo_mod.",vars); - System.out.println("Query:?X[believes_in -> ?Y]@foo_mod."); + session.ExecuteQuery("?X[believes_in -> ?Y]@example.",vars); + System.out.println("Query:?X[believes_in -> ?Y]@example."); HashMap firstmatch; - while(allmatches.hasNext()) { + while (allmatches.hasNext()) { firstmatch = (HashMap)allmatches.next(); FloraObject Xobj = (FloraObject)firstmatch.get("?X"); FloraObject Yobj = (FloraObject)firstmatch.get("?Y"); System.out.println(Xobj+" believes in: "+Yobj); } + FloraObject personObj = new FloraObject("person",session); + Iterator methIter = personObj.getMethods("example"); + while (methIter.hasNext()) { + System.out.println(((FloraMethod)methIter.next()).methodDetails()); + } + + Iterator instanceIter = personObj.getInstances("example"); + System.out.println("Person instances:"); + while (instanceIter.hasNext()) + System.out.println(" " + (FloraObject)instanceIter.next()); + + instanceIter = personObj.getDirectInstances("example"); + System.out.println("Person direct instances:"); + while (instanceIter.hasNext()) + System.out.println(" " + (FloraObject)instanceIter.next()); + + Iterator subIter = personObj.getSubClasses("example"); + System.out.println("Person subclasses:"); + while (subIter.hasNext()) + System.out.println(" " + (FloraObject)subIter.next()); + + subIter = personObj.getDirectSubClasses("example"); + System.out.println("Person direct subclasses:"); + while (subIter.hasNext()) + System.out.println(" " + (FloraObject)subIter.next()); + + Iterator supIter = personObj.getSuperClasses("example"); + System.out.println("Person superclasses:"); + while (supIter.hasNext()) + System.out.println(" " + (FloraObject)supIter.next()); + + supIter = personObj.getDirectSuperClasses("example"); + System.out.println("Person direct superclasses:"); + while (supIter.hasNext()) + System.out.println(" " + (FloraObject)supIter.next()); + + session.close(); System.exit(0); } Index: flogic_basics.flr =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample/flogic_basics.flr,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- flogic_basics.flr 24 May 2006 20:33:55 -0000 1.1 +++ flogic_basics.flr 2 Jun 2006 04:52:17 -0000 1.2 @@ -38,21 +38,27 @@ tc(?X,?Y) :- %e(?X,?Y). // a RULE and ... tc(?X,?Y) :- tc(?X,?Z), tc(?Z,?Y). // ... a (doubly) RECURSIVE RULE -person :: object. +person :: animal. +animal::object. +superman :: person. dangerous_hobby :: object. john:employee. // INSTANCE : CLASS employee::person. // SUBCLASS :: SUPERCLASS +secretary::employee. bob:person. tim:person. betty:employee. +sally:secretary. person[age*=>integer, kids*=>person, - salary(year)*=>value, + salary(year)*=>integer, hobbies*=>hobby, believes_in*=>something, - instances => person -]. // some (optional) SIGNATURE information + instances => person, + *=> married(year), + => %testmethod +]. mary:employee[ // a more complex MOLECULE involving age->29, // ... a SINGLE-VALUED method @@ -60,6 +66,8 @@ salary(1998) -> a_lot // ... a PARAMETERIZED method ]. +father(mary):person[age->66]. + tim[hobbies -> {stamps, snowboard}]. // somebodies hobbies betty[hobbies ->{fishing,diving}]. |
|
From: Michael K. <ki...@us...> - 2006-06-02 04:52:20
|
Update of /cvsroot/flora/flora2/pkgs In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv30544/pkgs Modified Files: javaAPI.flr Log Message: further improvements to the java API Index: javaAPI.flr =================================================================== RCS file: /cvsroot/flora/flora2/pkgs/javaAPI.flr,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- javaAPI.flr 29 May 2006 05:00:49 -0000 1.5 +++ javaAPI.flr 2 Jun 2006 04:52:16 -0000 1.6 @@ -1,6 +1,6 @@ /* File: javaAPI.flr ** -** Author: Aditi Pandit +** Author: Aditi Pandit, Michael Kifer ** ** Contact: flo...@li... ** @@ -49,13 +49,19 @@ %openFile(?FileName), %writeImports, %writeStartClass(?Obj), - %writeBoolean(?Obj,?Module,booleanMethodInh), - %writeBoolean(?Obj,?Module,booleanMethodNoninh), - %writeProcedural(?Obj,?Module,proceduralMethodNoninh), + %writeBooleanMethods(?Obj,?Module,booleanMethodInh,DATA), + %writeBooleanMethods(?Obj,?Module,booleanMethodNoninh,DATA), + %writeBooleanMethods(?Obj,?Module,booleanMethodInh,SIGNATURE), + %writeBooleanMethods(?Obj,?Module,booleanMethodNoninh,SIGNATURE), + %writeProceduralMethods(?Obj,?Module,proceduralMethodNoninh,DATA), + %writeProceduralMethods(?Obj,?Module,proceduralMethodNoninh,SIGNATURE), // proceduralMethodInh not implemented - //%writeProcedural(?Obj,?Module,proceduralMethodInh), - %writeData(?Obj,?Module,dataMethodInh), - %writeData(?Obj,?Module,dataMethodNoninh), + //%writeProceduralMethods(?Obj,?Module,proceduralMethodInh,DATA), + //%writeProceduralMethods(?Obj,?Module,proceduralMethodInh,SIGNATURE), + %writeValueMethods(?Obj,?Module,valueMethodInh,DATA), + %writeValueMethods(?Obj,?Module,valueMethodNoninh,DATA), + %writeValueMethods(?Obj,?Module,valueMethodInh,SIGNATURE), + %writeValueMethods(?Obj,?Module,valueMethodNoninh,SIGNATURE), %closeFile. %openFile(?FileName) :- @@ -63,42 +69,54 @@ /* Writing the first import statement */ %writeImports :- - writeln('import java.util.*;')@prolog(), - writeln('import com.declarativa.interprolog.TermModel;')@prolog(), - writeln('import net.sourceforge.flora.javaAPI.util.*;')@prolog(), - writeln('import net.sourceforge.flora.javaAPI.src.*;')@prolog(). + writeln(' +import java.util.*; +import com.declarativa.interprolog.TermModel; +import net.sourceforge.flora.javaAPI.util.*; +import net.sourceforge.flora.javaAPI.src.*;')@prolog(). /* Writing the class statement */ %writeStartClass(?Obj) :- write('public class ')@prolog(), - %write(?Obj)@flora(io), + write(?Obj)@prolog(), writeln(' extends FloraConstants {')@prolog(), %writeConstructor(?Obj), %writeToStringMethod(). %writeConstructor(?Obj) :- - writeln('FloraObject sourceFloraObject;')@prolog(), - writeln('String moduleName;')@prolog(), + writeln(' +FloraObject sourceFloraObject; +String moduleName;')@prolog(), write('TermModel floraClassName = new TermModel("')@prolog(), %write(?Obj)@flora(io), writeln('");')@prolog(), + write('public ')@prolog(), - %write(?Obj)@flora(io), + write(?Obj)@prolog(), writeln('(FloraObject sourceFloraObject,String moduleName) {')@prolog(), - writeln('this.sourceFloraObject = sourceFloraObject;')@prolog(), - writeln('if (sourceFloraObject == null) + writeln(' +this.sourceFloraObject = sourceFloraObject; +if (sourceFloraObject == null) throw new FlrException("Cannot create Java class " + floraClassName + ". Null sourceFloraObject object passed to " - + floraClassName + "(sourceFloraObject,moduleName)");')@prolog(), - writeln('this.moduleName = moduleName;')@prolog(), - writeln('sourceFloraObject.floraClassName = floraClassName;')@prolog(), - writeln('return;')@prolog(), - writeln('}')@prolog(). + + floraClassName + "(sourceFloraObject,moduleName)"); +this.moduleName = moduleName; +}')@prolog(), + + write('public ')@prolog(), + write(?Obj)@prolog(), + writeln('(String floraOID,String moduleName,FloraSession session) {')@prolog(), + writeln(' +this.sourceFloraObject = new FloraObject(floraOID,session); +this.moduleName = moduleName; +}')@prolog(). + %writeToStringMethod() :- - writeln('public String toString() {')@prolog(), - writeln('return sourceFloraObject.toString();')@prolog(), - writeln('}')@prolog(). + writeln(' +public String toString() { +return sourceFloraObject.toString(); +}')@prolog(). %closeFile :- writeln('}')@prolog(), @@ -106,325 +124,335 @@ /* Find all the methods of the object and write them to the java file */ -%writeBoolean(?Obj,?Module,?Inherit) :- +%writeBooleanMethods(?Obj,?Module,?Inherit,?DataOrSign) :- if ?Inherit == booleanMethodInh then ?MethodList=collectset{?M|?Obj[*=>?M]@?Module} else ?MethodList=collectset{?M|?Obj[=>?M; *=>?M]@?Module}, - %callXOnList(?MethodList,?Inherit). + %callXOnList(?Inherit,?MethodList,?DataOrSign). -%writeProcedural(?Obj,?Module,?Inherit) :- +%writeProceduralMethods(?Obj,?Module,?Inherit,?DataOrSign) :- if ?Inherit == proceduralMethodInh then %abort('Inheritable procedural methods are not yet supported') else ?MethodList=collectset{?M|?Obj[=>%?M]@?Module}, - %callXOnList(?MethodList,?Inherit). + %callXOnList(?Inherit,?MethodList,?DataOrSign). -%writeData(?Obj,?Module,?Inherit) :- - if ?Inherit == dataMethodInh +%writeValueMethods(?Obj,?Module,?Inherit,?DataOrSign) :- + if ?Inherit == valueMethodInh then ?MethodList=collectset{?M|?Obj[?M*=>?_X]@?Module} else ?MethodList=collectset{?M|?Obj[?M=>?_X; ?M*=>?_X]@?Module}, - %callXOnList(?MethodList,?Inherit). + %callXOnList(?Inherit,?MethodList,?DataOrSign). /* Predicate to call the X function on each term in the list */ -%callXOnList([],?_X). +%callXOnList(?_Op,[],?_DataOrSign). -%callXOnList([?First|?Rest],?X) :- - %?X(?First), - %callXOnList(?Rest,?X). +%callXOnList(?Op,[?First|?Rest],?DataOrSign) :- + %?Op(?First,?DataOrSign), + %callXOnList(?Op,?Rest,?DataOrSign). /* Calling the same functions for inheritable/non-inheritable versions of the method */ -%booleanMethodInh(?Method) :- - %booleanMethodAny(?Method,INHERITABLE). -%booleanMethodNoninh(?Method) :- - %booleanMethodAny(?Method,NONINHERITABLE). +%booleanMethodInh(?Method,?DataOrSign) :- + %booleanMethodAny(?Method,INHERITABLE,?DataOrSign). +%booleanMethodNoninh(?Method,?DataOrSign) :- + %booleanMethodAny(?Method,NONINHERITABLE,?DataOrSign). -%booleanMethodAny(?Method,?Inherit) :- - %writeGetBool(?Method,?Inherit), - %writeGetBoolAll(?Method,?Inherit), - %writeSetBool(?Method,?Inherit), - %writeDeleteBool(?Method,?Inherit). +%booleanMethodAny(?Method,?Inherit,?DataOrSign) :- + %boolMethodGet(?Method,?Inherit,?DataOrSign), + %boolMethodGetAll(?Method,?Inherit,?DataOrSign), + %boolMethodSet(?Method,?Inherit,?DataOrSign), + %boolMethodDelete(?Method,?Inherit,?DataOrSign). -%proceduralMethodInh(?Method) :- // not yet implemented in FLORA-2 - %proceduralMethodAny(?Method,INHERITABLE). -%proceduralMethodNoninh(?Method) :- - %proceduralMethodAny(?Method,NONINHERITABLE). +%proceduralMethodInh(?Method,?DataOrSign) :- // not yet implemented in FLORA-2 + %proceduralMethodAny(?Method,INHERITABLE,?DataOrSign). +%proceduralMethodNoninh(?Method,?DataOrSign) :- + %proceduralMethodAny(?Method,NONINHERITABLE,?DataOrSign). -%proceduralMethodAny(?Method,?Inherit) :- - %writeGetProc(?Method,?Inherit), - %writeGetProcAll(?Method,?Inherit), - %writeSetProc(?Method,?Inherit), - %writeDeleteProc(?Method,?Inherit). +%proceduralMethodAny(?Method,?Inherit,?DataOrSign) :- + %procMethodGet(?Method,?Inherit,?DataOrSign), + %procMethodGetAll(?Method,?Inherit,?DataOrSign), + %procMethodSet(?Method,?Inherit,?DataOrSign), + %procMethodDelete(?Method,?Inherit,?DataOrSign). -%dataMethodInh(?Method) :- - %dataMethodAny(?Method,INHERITABLE). -%dataMethodNoninh(?Method) :- - %dataMethodAny(?Method,NONINHERITABLE). +%valueMethodInh(?Method,?DataOrSign) :- + %valueMethodAny(?Method,INHERITABLE,?DataOrSign). +%valueMethodNoninh(?Method,?DataOrSign) :- + %valueMethodAny(?Method,NONINHERITABLE,?DataOrSign). -%dataMethodAny(?Method,?Inherit) :- - %writeGetData(?Method,?Inherit), - %writeGetDataAll(?Method,?Inherit), - %writeSetData(?Method,?Inherit), - %writeDeleteData(?Method,?Inherit), - %writeDeleteDataAll(?Method,?Inherit). +%valueMethodAny(?Method,?Inherit,?DataOrSign) :- + %valueMethodGet(?Method,?Inherit,?DataOrSign), + %valueMethodGetAll(?Method,?Inherit,?DataOrSign), + %valueMethodSet(?Method,?Inherit,?DataOrSign), + %valueMethodDelete(?Method,?Inherit,?DataOrSign), + %valueMethodDeleteAll(?Method,?Inherit,?DataOrSign). // Boolean -%writeGetBool(?Method,?Inherit) :- - %writeGetBoolProto(?Method,?Inherit), - %writeGetBoolBody(?Method,?Inherit). +%boolMethodGet(?Method,?Inherit,?DataOrSign) :- + %boolMethodGetProto(?Method,?Inherit,?DataOrSign), + %boolMethodGetBody(?Method,?Inherit,?DataOrSign). -%writeGetBoolAll(?Method,?Inherit) :- - %writeGetBoolAllProto(?Method,?Inherit), - %writeGetBoolAllBody(?Method,?Inherit). +%boolMethodGetAll(?Method,?Inherit,?DataOrSign) :- + %boolMethodGetAllProto(?Method,?Inherit,?DataOrSign), + %boolMethodGetAllBody(?Method,?Inherit,?DataOrSign). -%writeSetBool(?Method,?Inherit) :- - %writeSetBoolProto(?Method,?Inherit), - %writeSetBoolBody(?Method,?Inherit). +%boolMethodSet(?Method,?Inherit,?DataOrSign) :- + %boolMethodSetProto(?Method,?Inherit,?DataOrSign), + %boolMethodSetBody(?Method,?Inherit,?DataOrSign). -%writeDeleteBool(?Method,?Inherit) :- - %writeDeleteBoolProto(?Method,?Inherit), - %writeDeleteBoolBody(?Method,?Inherit). +%boolMethodDelete(?Method,?Inherit,?DataOrSign) :- + %boolMethodDeleteProto(?Method,?Inherit,?DataOrSign), + %boolMethodDeleteBody(?Method,?Inherit,?DataOrSign). -%writeGetBoolProto(?Method,?Inherit) :- +%boolMethodGetProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, write('public boolean getBI_')@prolog() - ; write('public boolean getBN_')@prolog() - ), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean getB~w~w_',[?Modifier1,?Modifier2])@prolog(), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeGetBoolAllProto(?Method,?Inherit) :- +%boolMethodGetAllProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), - format('public Iterator getB~wall_',[?Modifier])@prolog(format), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public Iterator getB~w~wall_',[?Modifier1,?Modifier2])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeGetBoolBody(?Method,?Inherit) :- +%boolMethodGetBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallGetBody(?Method,?Inherit,getboolean), + %parentCallGetBody(?Method,?Inherit,getboolean,?DataOrSign), writeln('}')@prolog(). -%writeGetBoolAllBody(?Method,?Inherit) :- +%boolMethodGetAllBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallGetBody(?Method,?Inherit,getbooleanAll), + %parentCallGetBody(?Method,?Inherit,getbooleanAll,?DataOrSign), writeln('}')@prolog(). -%writeSetBoolProto(?Method,?Inherit) :- +%boolMethodSetProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, write('public boolean setBI_')@prolog() - ; write('public boolean setBN_')@prolog() - ), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean setB~w~w_',[?Modifier1,?Modifier2])@prolog(), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeSetBoolBody(?Method,?Inherit) :- +%boolMethodSetBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallSetBody(?Method,?Inherit,setboolean), + %parentCallSetBody(?Method,?Inherit,setboolean,?DataOrSign), writeln('}')@prolog(). -%writeDeleteBoolProto(?Method,?Inherit) :- +%boolMethodDeleteProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, write('public boolean deleteBI_')@prolog() - ; write('public boolean deleteBN_')@prolog() - ), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean deleteB~w~w_',[?Modifier1,?Modifier2])@prolog(), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeDeleteBoolBody(?Method,?Inherit) :- +%boolMethodDeleteBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallDeleteBody(?Method,?Inherit,deleteboolean), + %parentCallDeleteBody(?Method,?Inherit,deleteboolean,?DataOrSign), writeln('}')@prolog(). // Procedural -%writeGetProc(?Method,?Inherit) :- - %writeGetProcProto(?Method,?Inherit), - %writeGetProcBody(?Method,?Inherit). +%procMethodGet(?Method,?Inherit,?DataOrSign) :- + %procMethodGetProto(?Method,?Inherit,?DataOrSign), + %procMethodGetBody(?Method,?Inherit,?DataOrSign). -%writeGetProcAll(?Method,?Inherit) :- - %writeGetProcAllProto(?Method,?Inherit), - %writeGetProcAllBody(?Method,?Inherit). +%procMethodGetAll(?Method,?Inherit,?DataOrSign) :- + %procMethodGetAllProto(?Method,?Inherit,?DataOrSign), + %procMethodGetAllBody(?Method,?Inherit,?DataOrSign). -%writeSetProc(?Method,?Inherit) :- - %writeSetProcProto(?Method,?Inherit), - %writeSetProcBody(?Method,?Inherit). +%procMethodSet(?Method,?Inherit,?DataOrSign) :- + %procMethodSetProto(?Method,?Inherit,?DataOrSign), + %procMethodSetBody(?Method,?Inherit,?DataOrSign). -%writeDeleteProc(?Method,?Inherit) :- - %writeDeleteProcProto(?Method,?Inherit), - %writeDeleteProcBody(?Method,?Inherit). +%procMethodDelete(?Method,?Inherit,?DataOrSign) :- + %procMethodDeleteProto(?Method,?Inherit,?DataOrSign), + %procMethodDeleteBody(?Method,?Inherit,?DataOrSign). -%writeGetProcProto(?Method,?Inherit) :- +%procMethodGetProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), - format('public boolean getP~w_',[?Modifier])@prolog(format), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean getP~w~w_',[?Modifier1,?Modifier2])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeGetProcAllProto(?Method,?Inherit) :- +%procMethodGetAllProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), - format('public Iterator getP~wall_',[?Modifier])@prolog(format), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public Iterator getallP~w~w_',[?Modifier1,?Modifier2])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeGetProcBody(?Method,?Inherit) :- +%procMethodGetBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallGetBody(?Method,?Inherit,getprocedural), + %parentCallGetBody(?Method,?Inherit,getprocedural,?DataOrSign), writeln('}')@prolog(). -%writeGetProcAllBody(?Method,?Inherit) :- +%procMethodGetAllBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallGetBody(?Method,?Inherit,getproceduralAll), + %parentCallGetBody(?Method,?Inherit,getproceduralAll,?DataOrSign), writeln('}')@prolog(). -%writeSetProcProto(?Method,?Inherit) :- +%procMethodSetProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, write('public boolean setPI_')@prolog() - ; write('public boolean setPN_')@prolog() - ), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean setP~w~w_',[?Modifier1,?Modifier2])@prolog(), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeSetProcBody(?Method,?Inherit) :- +%procMethodSetBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallSetBody(?Method,?Inherit,setprocedural), + %parentCallSetBody(?Method,?Inherit,setprocedural,?DataOrSign), writeln('}')@prolog(). -%writeDeleteProcProto(?Method,?Inherit) :- +%procMethodDeleteProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, write('public boolean deletePI_')@prolog() - ; write('public boolean deletePN_')@prolog() - ), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean deleteP~w~w_',[?Modifier1,?Modifier2])@prolog(), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeDeleteProcBody(?Method,?Inherit) :- +%procMethodDeleteBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallDeleteBody(?Method,?Inherit,deleteprocedural), + %parentCallDeleteBody(?Method,?Inherit,deleteprocedural,?DataOrSign), writeln('}')@prolog(). /* The set and the get functions involve writing the prototype and the body of the function */ -%writeSetData(?Method,?Inherit) :- - %writeSetDataProto(?Method,?Inherit), - %writeSetDataBody(?Method,?Inherit), - %writeSetDataProtoOneVal(?Method,?Inherit), - %writeSetDataBody(?Method,?Inherit). +%valueMethodSet(?Method,?Inherit,?DataOrSign) :- + %valueMethodSetProto(?Method,?Inherit,?DataOrSign), + %valueMethodSetBody(?Method,?Inherit,?DataOrSign), + %valueMethodSetProtoOneVal(?Method,?Inherit,?DataOrSign), + %valueMethodSetBody(?Method,?Inherit,?DataOrSign). -%writeGetData(?Method,?Inherit) :- - %writeGetDataProto(?Method,?Inherit), - %writeGetDataBody(?Method,?Inherit). +%valueMethodGet(?Method,?Inherit,?DataOrSign) :- + %valueMethodGetProto(?Method,?Inherit,?DataOrSign), + %valueMethodGetBody(?Method,?Inherit,?DataOrSign). -%writeGetDataAll(?Method,?Inherit) :- - %writeGetDataAllProto(?Method,?Inherit), - %writeGetDataAllBody(?Method,?Inherit). +%valueMethodGetAll(?Method,?Inherit,?DataOrSign) :- + %valueMethodGetAllProto(?Method,?Inherit,?DataOrSign), + %valueMethodGetAllBody(?Method,?Inherit,?DataOrSign). -%writeDeleteData(?Method,?Inherit) :- - %writeDeleteDataProto(?Method,?Inherit), - %writeDeleteDataBody(?Method,?Inherit), - %writeDeleteDataProtoOneVal(?Method,?Inherit), - %writeDeleteDataBody(?Method,?Inherit). +%valueMethodDelete(?Method,?Inherit,?DataOrSign) :- + %valueMethodDeleteProto(?Method,?Inherit,?DataOrSign), + %valueMethodDeleteBody(?Method,?Inherit,?DataOrSign), + %valueMethodDeleteProtoOneVal(?Method,?Inherit,?DataOrSign), + %valueMethodDeleteBody(?Method,?Inherit,?DataOrSign). -%writeDeleteDataAll(?Method,?Inherit) :- - %writeDeleteDataAllProto(?Method,?Inherit), - %writeDeleteDataAllBody(?Method,?Inherit). +%valueMethodDeleteAll(?Method,?Inherit,?DataOrSign) :- + %valueMethodDeleteAllProto(?Method,?Inherit,?DataOrSign), + %valueMethodDeleteAllBody(?Method,?Inherit,?DataOrSign). /* Writing the prototype */ -%writeSetDataProtoOneVal(?Method,?Inherit):- +%valueMethodSetProtoOneVal(?Method,?Inherit,?DataOrSign):- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Object value)' else (?H = ?FnName, ?Msg = 'Object value)'), - (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), - format('public boolean setD~w_',[?Modifier])@prolog(format), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean setV~w~w_',[?Modifier1,?Modifier2])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%writeSetDataProto(?Method,?Inherit) :- +%valueMethodSetProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Vector value)' else (?H = ?FnName, ?Msg = 'Vector value)'), - (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), - format('public boolean setD~w_',[?Modifier])@prolog(format), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean setV~w~w_',[?Modifier1,?Modifier2])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%writeGetDataProto(?Method,?Inherit) :- +%valueMethodGetProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), - format('public Iterator getD~w_',[?Modifier])@prolog(format), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public Iterator getV~w~w_',[?Modifier1,?Modifier2])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), write(')')@prolog(). -%writeGetDataAllProto(?Method,?Inherit) :- +%valueMethodGetAllProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), - format('public Iterator getD~wall_',[?Modifier])@prolog(format), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public Iterator getallV~w~w_',[?Modifier1,?Modifier2])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), write(')')@prolog(). -%writeDeleteDataProtoOneVal(?Method,?Inherit):- +%valueMethodDeleteProtoOneVal(?Method,?Inherit,?DataOrSign):- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Object value)' else (?H = ?FnName, ?Msg = 'Object value)'), - (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), - format('public boolean deleteD~w_',[?Modifier])@prolog(format), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean deleteV~w~w_',[?Modifier1,?Modifier2])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%writeDeleteDataProto(?Method,?Inherit) :- +%valueMethodDeleteProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Vector value)' else (?H = ?FnName, ?Msg = 'Vector value)'), - (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), - format('public boolean deleteD~w_',[?Modifier])@prolog(format), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean deleteV~w~w_',[?Modifier1,?Modifier2])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%writeDeleteDataAllProto(?Method,?Inherit) :- +%valueMethodDeleteAllProto(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), - format('public boolean deleteD~w_',[?Modifier])@prolog(format), + (?DataOrSign==DATA, !, ?Modifier1=D ; ?Modifier1=S), + (?Inherit==INHERITABLE, !, ?Modifier2=I ; ?Modifier2=N), + format('public boolean deleteV~w~w_',[?Modifier1,?Modifier2])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), @@ -432,102 +460,110 @@ /* Writing the body */ -%writeSetDataBody(?Method,?Inherit) :- +%valueMethodSetBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallSetBody(?Method,?Inherit,setdata), + %parentCallSetBody(?Method,?Inherit,setvalue,?DataOrSign), writeln('}')@prolog(). -%writeGetDataBody(?Method,?Inherit) :- +%valueMethodGetBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallGetBody(?Method,?Inherit,getdata), + %parentCallGetBody(?Method,?Inherit,getvalue,?DataOrSign), writeln('}')@prolog(). -%writeGetDataAllBody(?Method,?Inherit) :- +%valueMethodGetAllBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallGetBody(?Method,?Inherit,getdataAll), + %parentCallGetBody(?Method,?Inherit,getvalueAll,?DataOrSign), writeln('}')@prolog(). -%writeDeleteDataBody(?Method,?Inherit) :- +%valueMethodDeleteBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallDeleteBody(?Method,?Inherit,deletedata), + %parentCallDeleteBody(?Method,?Inherit,deletevalue,?DataOrSign), writeln('}')@prolog(). -%writeDeleteDataAllBody(?Method,?Inherit) :- +%valueMethodDeleteAllBody(?Method,?Inherit,?DataOrSign) :- writeln('{')@prolog(), - %parentCallDeleteAllBody(?Method,?Inherit), + %parentCallDeleteAllBody(?Method,?Inherit,?DataOrSign), writeln('}')@prolog(). -%parentCallSetBody(?Method,?Inherit,?Type) :- +%parentCallSetBody(?Method,?Inherit,?Type,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), %writeVectorParsInit, %writeBodyList(?FnArgs), - %writeProxySetCall(?FnName,?Inherit,?Type). + %writeProxySetCall(?FnName,?Inherit,?Type,?DataOrSign). %writeVectorParsInit:- writeln('Vector pars = new Vector();')@prolog(). -%writeProxySetCall(?FnName,?Inherit,?Type) :- +%writeProxySetCall(?FnName,?Inherit,?Type,?DataOrSign) :- (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), format('return sourceFloraObject.~w(moduleName,"',[?Type])@prolog(format), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), - (?Type==setdata, !, writeln(',pars,value);')@prolog() + write(',')@prolog(), + %write(?DataOrSign)@flora(io), + (?Type==setvalue, !, writeln(',pars,value);')@prolog() ; writeln(',pars);')@prolog() ). -%parentCallGetBody(?Method,?Inherit,?Type) :- +%parentCallGetBody(?Method,?Inherit,?Type,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), %writeVectorParsInit, %writeBodyList(?FnArgs), - %writeProxyGetCall(?FnName,?Inherit,?Type). + %writeProxyGetCall(?FnName,?Inherit,?Type,?DataOrSign). -%writeProxyGetCall(?FnName,?Inherit,?Type) :- +%writeProxyGetCall(?FnName,?Inherit,?Type,?DataOrSign) :- format('return sourceFloraObject.~w(moduleName,"',[?Type])@prolog(format), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), + write(',')@prolog(), + %write(?DataOrSign)@flora(io), writeln(',pars);')@prolog(). -%parentCallGetAllBody(?Method,?Inherit,?Type) :- +%parentCallGetAllBody(?Method,?Inherit,?Type,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), %writeVectorParsInit, %writeGetAllBodyList(?FnArgs), - %writeProxyGetCall(?FnName,?Inherit,?Type). + %writeProxyGetCall(?FnName,?Inherit,?Type,?DataOrSign). -%parentCallDeleteBody(?Method,?Inherit,?Type) :- +%parentCallDeleteBody(?Method,?Inherit,?Type,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), %writeVectorParsInit, %writeBodyList(?FnArgs), - %writeProxyDeleteBody(?FnName,?Inherit,?Type). + %writeProxyDeleteBody(?FnName,?Inherit,?Type,?DataOrSign). -%writeProxyDeleteBody(?FnName,?Inherit,?Type) :- +%writeProxyDeleteBody(?FnName,?Inherit,?Type,?DataOrSign) :- format('return sourceFloraObject.~w(moduleName,"',[?Type])@prolog(format), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), - (?Type == deletedata, !, writeln(',pars,value);')@prolog() + write(',')@prolog(), + %write(?DataOrSign)@flora(io), + (?Type == deletevalue, !, writeln(',pars,value);')@prolog() ; writeln(',pars);')@prolog() ). -%parentCallDeleteAllBody(?Method,?Inherit) :- +%parentCallDeleteAllBody(?Method,?Inherit,?DataOrSign) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), %writeVectorParsInit, %writeBodyList(?FnArgs), - %writeProxyDeleteAllBody(?FnName,?Inherit). + %writeProxyDeleteAllBody(?FnName,?Inherit,?DataOrSign). -%writeProxyDeleteAllBody(?FnName,?Inherit) :- - write('return sourceFloraObject.deletedata(moduleName,"')@prolog(), +%writeProxyDeleteAllBody(?FnName,?Inherit,?DataOrSign) :- + write('return sourceFloraObject.deletevalue(moduleName,"')@prolog(), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), + write(',')@prolog(), + %write(?DataOrSign)@flora(io), writeln(',pars);')@prolog(). /* Predicates to write parameter lists */ |
|
From: Michael K. <ki...@us...> - 2006-06-02 04:52:20
|
Update of /cvsroot/flora/flora2/java/API/examples In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv30544/java/API/examples Modified Files: buildExample.sh buildExample.bat Log Message: further improvements to the java API Index: buildExample.bat =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/buildExample.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- buildExample.bat 24 May 2006 20:33:55 -0000 1.1 +++ buildExample.bat 2 Jun 2006 04:52:17 -0000 1.2 @@ -34,7 +34,7 @@ CALL %1%\floraVariables.bat -..\..\..\runflora -e "flLoad('%FLORA_FILE%'>>foo_mod),flLoad(javaAPI),%write(%FLORA_CLASS%,foo_mod,'%JAVA_FILE%'),flHalt." +..\..\..\runflora -e "flLoad('%FLORA_FILE%'>>example),flLoad(javaAPI),%write(%FLORA_CLASS%,example,'%JAVA_FILE%'),flHalt." echo Compiling files %JAVA_BIN%\javac -classpath ..;..\..\interprolog.jar %1%\*.java Index: buildExample.sh =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/buildExample.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- buildExample.sh 24 May 2006 20:33:55 -0000 1.1 +++ buildExample.sh 2 Jun 2006 04:52:17 -0000 1.2 @@ -1,3 +1,4 @@ +#! /bin/sh # File: buildExample.sh # # Author(s): Aditi Pandit @@ -22,13 +23,18 @@ # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # -#! /bin/sh +if test ! -d "${1}" -o "$1" = "" ; then + echo + echo "**** Argument 1 must be a directory containing the example to build" + echo + exit 1 +fi . ../../unixVariables.sh . ../../flora_settings.sh . ${1}/floraVariables.sh -../../../runflora -e "flLoad('${FLORA_FILE}'>>foo_mod),flLoad(javaAPI),%write(${FLORA_CLASS},foo_mod,'${JAVA_FILE}'),flHalt." +../../../runflora -e "flLoad('${FLORA_FILE}'>>example),flLoad(javaAPI),%write(${FLORA_CLASS},example,'${JAVA_FILE}'),flHalt." ${JAVA_BIN}/javac -classpath ..:../../interprolog.jar ${1}/*.java |
|
From: Michael K. <ki...@us...> - 2006-06-01 19:16:44
|
Update of /cvsroot/flora/flora2/p2h In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv12806/p2h Modified Files: prolog2hilog.c Log Message: fixed the problem with xsb_abort Index: prolog2hilog.c =================================================================== RCS file: /cvsroot/flora/flora2/p2h/prolog2hilog.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- prolog2hilog.c 27 May 2003 04:49:46 -0000 1.6 +++ prolog2hilog.c 1 Jun 2006 19:16:35 -0000 1.7 @@ -63,6 +63,7 @@ static prolog_term map_special_form(prolog_term (*func)(), prolog_term term, char *apply, int unify_vars); static prolog_term map_list(prolog_term func(), prolog_term term, char *apply, int unify_vars); +static char errormessage[300]; /* When called from Prolog, takes 3 args: @@ -118,9 +119,14 @@ xsb_dbgmsg("flora_plg2hlg: Arg3=%s", pterm2string(apply_t)); #endif - if (!is_atom(apply_t)) - xsb_abort("PLG2HLG: Arg 3 = `%s' (the `apply' functor) isn't an atom.", - pterm2string(apply_t)); +#ifdef P2HDEBUG + if (!is_atom(apply_t)) { + sprintf(errormessage, + "p2h{?Plg,?Hlg}: The apply functor=%s is not an atom.", + pterm2string(apply_t)); + abort_xsb(errormessage); + } +#endif apply = string_val(apply_t); @@ -173,9 +179,12 @@ return map_special_form(hilog2prolog,hterm,apply,unify_vars); #ifdef P2HDEBUG - if (!is_functor(hterm)) - xsb_abort("PLG2HLG: Arg 2 =`%s' is not a HiLog term.", - pterm2string(hterm)); + if (!is_functor(hterm)) { + sprintf(errormessage, + "p2h{?Plg,?Hlg}: ?Hlg=%s must be a HiLog term.", + pterm2string(hterm)); + abort_xsb(errormessage); + } #endif /* Don't convert if already Prolog */ @@ -186,9 +195,12 @@ arity=p2c_arity(hterm); pfunctor = p2p_arg(hterm,1); - if (!is_atom(pfunctor)) - xsb_abort("PLG2HLG: HiLog term `%s' not convertible to Prolog.", - pterm2string(hterm)); + if (!is_atom(pfunctor)) { + sprintf(errormessage, + "p2h{?Plg,?Hlg}: ?Hlg=%s is not convertible to Prolog.", + pterm2string(hterm)); + abort_xsb(errormessage); + } if (arity > 1) c2p_functor(string_val(pfunctor), arity-1, pterm); else @@ -229,9 +241,12 @@ else if (is_special_form(pterm)) return map_special_form(prolog2hilog,pterm,apply, unify_vars); - if (!is_functor(pterm)) - xsb_abort("PLG2HLG: Arg 1 = `%s' (the Prolog term) must be a var, a const, or a functor.", - pterm2string(pterm)); + if (!is_functor(pterm)) { + sprintf(errormessage, + "p2h{?Plg,?Hlg}: ?Plg=%s must be a Prolog term.", + pterm2string(pterm)); + abort_xsb(errormessage); + } /* Don't convert if already HiLog */ if (is_hilog(pterm,apply)) return pterm; |