flora-commits Mailing List for Flora-2
Brought to you by:
kifer
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(59) |
Jun
(43) |
Jul
(4) |
Aug
(4) |
Sep
(102) |
Oct
(20) |
Nov
(47) |
Dec
(32) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(24) |
Feb
(34) |
Mar
(72) |
Apr
(36) |
May
(10) |
Jun
(46) |
Jul
(36) |
Aug
(24) |
Sep
(37) |
Oct
(27) |
Nov
(43) |
Dec
(40) |
| 2004 |
Jan
(35) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(30) |
Aug
(83) |
Sep
(68) |
Oct
(38) |
Nov
(3) |
Dec
(7) |
| 2005 |
Jan
(9) |
Feb
(31) |
Mar
(46) |
Apr
(73) |
May
(21) |
Jun
(1) |
Jul
(32) |
Aug
(33) |
Sep
(3) |
Oct
(28) |
Nov
(4) |
Dec
(23) |
| 2006 |
Jan
(22) |
Feb
(2) |
Mar
(12) |
Apr
(23) |
May
(73) |
Jun
(14) |
Jul
|
Aug
(20) |
Sep
(14) |
Oct
(5) |
Nov
|
Dec
(14) |
| 2007 |
Jan
(54) |
Feb
(81) |
Mar
(286) |
Apr
(313) |
May
(154) |
Jun
(85) |
Jul
(8) |
Aug
(11) |
Sep
(12) |
Oct
(14) |
Nov
(6) |
Dec
(6) |
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(12) |
May
(4) |
Jun
|
Jul
(13) |
Aug
(22) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(46) |
Jun
(43) |
Jul
(46) |
Aug
(9) |
Sep
(13) |
Oct
(31) |
Nov
(42) |
Dec
(18) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(11) |
Apr
(13) |
May
(16) |
Jun
(6) |
Jul
(17) |
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
|
Feb
(17) |
Mar
(4) |
Apr
(3) |
May
(2) |
Jun
(3) |
Jul
(2) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
|
2
|
3
(2) |
4
(6) |
5
(6) |
6
(2) |
|
7
|
8
(3) |
9
|
10
|
11
|
12
|
13
|
|
14
|
15
|
16
|
17
(9) |
18
(1) |
19
|
20
(5) |
|
21
|
22
|
23
(6) |
24
(21) |
25
(5) |
26
|
27
|
|
28
|
29
(7) |
30
|
31
|
|
|
|
|
From: Michael K. <ki...@us...> - 2006-05-29 05:15:24
|
Update of /cvsroot/flora/flora2/syslib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv15151 Modified Files: flrtruthvalue.P Log Message: further improvements Index: flrtruthvalue.P =================================================================== RCS file: /cvsroot/flora/flora2/syslib/flrtruthvalue.P,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- flrtruthvalue.P 29 May 2006 04:59:28 -0000 1.5 +++ flrtruthvalue.P 29 May 2006 05:15:22 -0000 1.6 @@ -45,22 +45,27 @@ FLLIBTRUTHVALUE(Goal,FL_TRUE) :- (flora_truthvalue_tabled_call(Goal), fail ; - convert_to_head_literal(Goal,HGoal), - get_residual(HGoal,[]) + %% Using HGoal doesn't work with non-tabled predicates, + %% so we wrap everything in flora_truthvalue_tabled_call/1 + %%convert_to_head_literal(Goal,HGoal), + %%get_residual(HGoal,[]) + get_residual(flora_truthvalue_tabled_call(Goal),[]) ), flora_abolish_table_call(flora_truthvalue_tabled_call(_)). FLLIBTRUTHVALUE(Goal,FL_UNKNOWN) :- (flora_truthvalue_tabled_call(Goal), fail ; - convert_to_head_literal(Goal,HGoal), - get_residual(HGoal,[_|_]) + %%convert_to_head_literal(Goal,HGoal), + %%get_residual(HGoal,[_|_]) + get_residual(flora_truthvalue_tabled_call(Goal),[_|_]) ), flora_abolish_table_call(flora_truthvalue_tabled_call(_)). FLLIBTRUTHVALUE(Goal,FL_FALSE) :- (flora_truthvalue_tabled_call(Goal), fail ; - convert_to_head_literal(Goal,HGoal), - (get_residual(HGoal,[_|_]) -> fail + %%convert_to_head_literal(Goal,HGoal), + %%(get_residual(HGoal,[_|_]) -> fail + (get_residual(flora_truthvalue_tabled_call(Goal),[_|_]) -> fail ; flora_tnot(Goal) ) |
|
From: Michael K. <ki...@us...> - 2006-05-29 05:00:58
|
Update of /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv8039/java/API/net/sourceforge/flora/javaAPI/src Modified Files: PrologFlora.java FloraSession.java FloraObject.java FloraMethod.java Added Files: FloraConstants.java Log Message: nup of the java interface Index: FloraMethod.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/FloraMethod.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FloraMethod.java 24 May 2006 20:33:55 -0000 1.1 +++ FloraMethod.java 29 May 2006 05:00:49 -0000 1.2 @@ -31,31 +31,32 @@ import com.declarativa.interprolog.TermModel; /* Class to encapsulate a Flora method */ -public class FloraMethod{ +public class FloraMethod extends FloraConstants +{ - public FloraObject MethodName; + public FloraObject methodName; public Vector parameters; // of FloraObject - public FloraObject ReturnType; + public FloraObject returnType; public boolean inheritable; + public int type; // DATA, BOOLEAN, PROCEDURAL - public FloraMethod(FloraObject ConsMethodName,Vector Conspars, FloraObject ConsReturnType, boolean Consinheritable) + public FloraMethod(FloraObject methodName,Vector params, FloraObject returnType, boolean inheritable, int type) { - MethodName = ConsMethodName; - parameters = Conspars; - ReturnType = ConsReturnType; - inheritable = Consinheritable; + this.methodName = methodName; + this.parameters = params; + this.returnType = returnType; + this.inheritable = inheritable; + this.type = type; return; } public void PrintMethod() { - System.out.println("Method Name : " + MethodName.toString()); + System.out.println("Method Name : " + methodName.toString()); System.out.println("Parameters: " + parameters.toString()); - System.out.println("ReturnType:" + ReturnType.toString()); - if(inheritable) - System.out.println("Inheritable"); - else - System.out.println("Non-Inheritable"); + System.out.println("ReturnType: " + returnType.toString()); + System.out.print("Inheritability: " + printableInheritability(inheritable)); + System.out.println("MethodType: " + printableMethodType(type)); return; } Index: FloraSession.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/FloraSession.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FloraSession.java 24 May 2006 20:33:55 -0000 1.1 +++ FloraSession.java 29 May 2006 05:00:49 -0000 1.2 @@ -36,22 +36,10 @@ /** This class is a higher level wrapper to call the lower level functions of the PrologFlora class */ -public class FloraSession{ - +public class FloraSession extends FloraConstants +{ PrologFlora flora; - boolean debug = false; - - public String isASign = ":"; - public String isASubClassOfSign = "::"; - - public String inheritDataAtom = "*->"; - public String noninheritDataAtom = "->"; - - public String inheritSignatureAtom = "*=>"; - public String noninheritSignatureAtom = "=>"; - public String moduleStr = "@"; - /* Constructor function. */ public FloraSession() { Index: PrologFlora.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/PrologFlora.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PrologFlora.java 24 May 2006 20:33:55 -0000 1.1 +++ PrologFlora.java 29 May 2006 05:00:49 -0000 1.2 @@ -40,10 +40,14 @@ /** This class is used to call FLORA-2 commands at a low level from JAVA using Interprolog libraries */ -public class PrologFlora { - - static boolean debug = false; +public class PrologFlora extends FloraConstants +{ + public static String sFloraRootDir = null; + PrologEngine engine; + boolean isNative = false; + String commands[]; + /* Function for setting Initialization commands */ void initCommandStrings(String FloraRootDir) { @@ -266,24 +270,12 @@ /* Shut down the Prolog Engine */ public void close() { - /* The native engine does not have a shutdown function */ - /* Change this whenever it becomes available */ - + // don't exit: let the Java program continue after the shutdown if(isNative) { - engine.shutdown(); // shutdown isn't implemented in Native engine - // don't exit: let the Java program continue after the shutdown - //System.exit(0); + // shutdown isn't implemented in Native engine, but this is harmless + engine.shutdown(); } else { - //engine.interrupt(); engine.shutdown(); - // don't exit: let the Java program continue after the shutdown - //System.exit(0); } } - - - public static String sFloraRootDir = null; - PrologEngine engine; - boolean isNative = false; - String commands[]; } --- NEW FILE: FloraConstants.java --- /* File: FloraSession.java ** ** Author(s): Michael Kifer ** ** Contact: flo...@li... ** ** Copyright (C) The Research Foundation of SUNY, 2006 ** ** FLORA-2 is free software; you can redistribute it and/or modify it under the ** terms of the GNU Library General Public License as published by the Free ** Software Foundation; either version 2 of the License, or (at your option) ** any later version. ** ** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for ** more details. ** ** ** You should have received a copy of the GNU Library General Public License ** along with FLORA-2; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** ** */ package net.sourceforge.flora.javaAPI.src; import net.sourceforge.flora.javaAPI.util.*; /** Constants used in other places */ public class FloraConstants { public final static boolean debug = false; public final static String ISA_SYMBOL = ":"; public final static String SUBCLASS_SYMBOL = "::"; public final static String INHERIT_DATA_ARROW = "*->"; public final static String NONINHERIT_DATA_ARROW = "->"; public final static String INHERIT_SIGNATURE_ARROW = "*=>"; public final static String NONINHERIT_SIGNATURE_ARROW = "=>"; public final static String PROCEDURAL_METHOD_SYMBOL = "%"; public final static String INHERITABLE_METHOD_SYMBOL = "*"; public final static String NONINHERITABLE_METHOD_SYMBOL = ""; 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 INHERITABLE = true; public final static boolean NONINHERITABLE = false; public static String printableMethodType(int type) { if (type == DATA) return "regular"; 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 && type != BOOLEAN && type != PROCEDURAL) throw new FlrException("j2flora2: Invalid method type, " + type); } public static String printableInheritability(boolean inherit) { if (inherit) return "inheritable"; else return "noninheritable"; } } Index: FloraObject.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/FloraObject.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FloraObject.java 25 May 2006 02:49:48 -0000 1.2 +++ FloraObject.java 29 May 2006 05:00:49 -0000 1.3 @@ -43,16 +43,13 @@ to be called using the lower-level interface */ -public class FloraObject{ - - boolean debug = false; - +public class FloraObject extends FloraConstants +{ FloraSession session; // The next three are set by proxy object constructors within // automatically generated files (by %write(?,?,?)) public TermModel floraOID; public TermModel floraClassName; // = new TermModel(); - public String moduleName; // = "main"; public FloraObject(TermModel name,FloraSession sess) { @@ -78,15 +75,15 @@ ** inherit: whether the method is inheritable or not ** parameters: parameters passed to the method */ - public boolean getboolean(Object methodName,boolean inherit,Vector parameters) + public boolean getboolean(String moduleName, Object methodName,boolean inherit,Vector parameters) { String paramList = makeParameterListString(parameters); String floraQuery = floraOID + "[" - + (inherit ? "*" : "") + + (inherit ? INHERITABLE_METHOD_SYMBOL : NONINHERITABLE_METHOD_SYMBOL) + methodName.toString() + paramList - + "]" + session.moduleStr + moduleName + "."; + + "]" + AT_MODULE_SYMBOL + moduleName + "."; try { return session.ExecuteCommand(floraQuery); @@ -98,21 +95,63 @@ } + /* Get all values for a Boolean method where 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 getbooleanAll(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 methodmodifier = ""; + if (inherit) + methodmodifier = INHERITABLE_METHOD_SYMBOL; + else + methodmodifier = NONINHERITABLE_METHOD_SYMBOL; + + floraQuery = + floraOID + "[" + methodmodifier + methodName.toString() + paramList + + "]" + AT_MODULE_SYMBOL + moduleName + "."; + + try { + return session.FindAllMatches(floraQuery,argList); + } + catch(Exception e) { + e.printStackTrace(); + throw new FlrException("j2flora2: Error in getbooleanAll. Query was " + + floraQuery); + } + } + + + /* Set a boolean property of the object ** ** methodName : name of the boolean method ** inherit: whether the method is inheritable or not ** parameters: parameters passed to the method */ - public boolean setboolean(Object methodName,boolean inherit,Vector parameters) + public boolean setboolean(String moduleName, Object methodName,boolean inherit,Vector parameters) { String paramList = makeParameterListString(parameters); String floraQuery= "insert{" + floraOID + "[" - + (inherit ? "*" : "") + + (inherit ? INHERITABLE_METHOD_SYMBOL : NONINHERITABLE_METHOD_SYMBOL) + methodName.toString() + paramList - + "]" + session.moduleStr + moduleName + "}."; + + "]" + AT_MODULE_SYMBOL + moduleName + "}."; try { return session.ExecuteCommand(floraQuery); @@ -130,15 +169,15 @@ ** inherit: whether the method is inheritable or not ** parameters: parameters passed to the method */ - public boolean deleteboolean(Object methodName,boolean inherit,Vector parameters) + public boolean deleteboolean(String moduleName, Object methodName,boolean inherit,Vector parameters) { String paramList = makeParameterListString(parameters); String floraQuery = "deleteall{" + floraOID + "[" - + (inherit ? "*" : "") + + (inherit ? INHERITABLE_METHOD_SYMBOL : NONINHERITABLE_METHOD_SYMBOL) + methodName.toString() + paramList - + "]" + session.moduleStr + moduleName + "}."; + + "]" + AT_MODULE_SYMBOL + moduleName + "}."; try { return session.ExecuteCommand(floraQuery); @@ -157,13 +196,13 @@ ** inherit: ignored - for future use ** parameters: parameters passed to the method */ - public boolean getprocedural(Object methodName,boolean inherit,Vector parameters) + public boolean getprocedural(String moduleName, Object methodName,boolean inherit,Vector parameters) { String paramList = makeParameterListString(parameters); String floraQuery = floraOID + "[%" + methodName.toString() + paramList - + "]" + session.moduleStr + moduleName + "."; + + "]" + AT_MODULE_SYMBOL + moduleName + "."; try { return session.ExecuteCommand(floraQuery); @@ -176,19 +215,61 @@ } + /* Get all values for a procedural method where 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) + { + 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); + } + + // inherit is ignored here + String methodmodifier = ""; + if (inherit) + methodmodifier = PROCEDURAL_METHOD_SYMBOL; + else + methodmodifier = PROCEDURAL_METHOD_SYMBOL; + + floraQuery = + floraOID + "[" + methodmodifier + methodName.toString() + paramList + + "]" + AT_MODULE_SYMBOL + moduleName + "."; + + try { + return session.FindAllMatches(floraQuery,argList); + } + catch(Exception e) { + e.printStackTrace(); + throw new FlrException("j2flora2: Error in getproceduralAll. Query was " + + floraQuery); + } + } + + /* Set a procedural property of the object ** ** methodName : boolean method ** inherit: ignored - for future use ** parameters: parameters passed to the method */ - public boolean setprocedural(Object methodName,boolean inherit,Vector parameters) + public boolean setprocedural(String moduleName, Object methodName,boolean inherit,Vector parameters) { String paramList = makeParameterListString(parameters); String floraQuery= "insert{" + floraOID + "[%" + methodName.toString() + paramList - + "]" + session.moduleStr + moduleName + "}."; + + "]" + AT_MODULE_SYMBOL + moduleName + "}."; try { return session.ExecuteCommand(floraQuery); } @@ -206,13 +287,13 @@ ** inherit: ignored - for future use ** parameters: parameters passed to the method */ - public boolean deleteprocedural(Object methodName,boolean inherit,Vector parameters) + public boolean deleteprocedural(String moduleName, Object methodName,boolean inherit,Vector parameters) { String paramList = makeParameterListString(parameters); String floraQuery= "deleteall{" + floraOID + "[%" + methodName.toString() + paramList - + "]" + session.moduleStr + moduleName + "}."; + + "]" + AT_MODULE_SYMBOL + moduleName + "}."; try { return session.ExecuteCommand(floraQuery); } @@ -230,21 +311,21 @@ ** parameters : the parameters to the method ** value : the value of the method to be deleted */ - public boolean delete(Object methodName,boolean inherit,Vector parameters,Object value) + public boolean deletedata(String moduleName, Object methodName,boolean inherit,Vector parameters,Object value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; if (inherit) - operatorstring += session.inheritDataAtom; + operatorstring = INHERIT_DATA_ARROW; else - operatorstring += session.noninheritDataAtom; + operatorstring = NONINHERIT_DATA_ARROW; floraQuery = "deleteall{"+floraOID + "[" + methodName.toString() + paramList + operatorstring + value + "]" - + session.moduleStr + this.moduleName + "}."; + + AT_MODULE_SYMBOL + moduleName + "}."; try { return session.ExecuteCommand(floraQuery); @@ -263,7 +344,7 @@ ** parameters : the parameters to the method ** value : the values of the method to be deleted */ - public boolean delete(Object methodName,boolean inherit,Vector parameters,Vector value) + public boolean deletedata(String moduleName, Object methodName,boolean inherit,Vector parameters,Vector value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); @@ -271,14 +352,14 @@ String operatorstring = ""; if (inherit) - operatorstring += session.inheritDataAtom; + operatorstring += INHERIT_DATA_ARROW; else - operatorstring += session.noninheritDataAtom; + operatorstring += NONINHERIT_DATA_ARROW; floraQuery = "deleteall{" + floraOID + "[" + methodName.toString() + paramList + operatorstring+valuelist + "]" - + session.moduleStr + this.moduleName + "}."; + + AT_MODULE_SYMBOL + moduleName + "}."; try { return session.ExecuteCommand(floraQuery); } @@ -296,22 +377,22 @@ ** inherit : whether the method is inheritable or not ** parameters : the parameters to the method */ - public boolean delete(Object methodName,boolean inherit,Vector parameters) + public boolean deletedata(String moduleName, Object methodName,boolean inherit,Vector parameters) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; if (inherit) { - operatorstring += session.inheritDataAtom; + operatorstring += INHERIT_DATA_ARROW; } else { - operatorstring += session.noninheritDataAtom; + operatorstring += NONINHERIT_DATA_ARROW; } floraQuery = "deleteall{" + floraOID + "[" + methodName.toString() + paramList + operatorstring + "?Value___395792" + "]" - + session.moduleStr + this.moduleName + "}."; + + AT_MODULE_SYMBOL + moduleName + "}."; try { return session.ExecuteCommand(floraQuery); @@ -331,21 +412,21 @@ ** parameters : parameters to the method ** value : value to be set to */ - public boolean set(Object methodName,boolean inherit,Vector parameters,Object value) + public boolean setdata(String moduleName, Object methodName,boolean inherit,Vector parameters,Object value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; if(inherit) - operatorstring += session.inheritDataAtom; + operatorstring += INHERIT_DATA_ARROW; else - operatorstring += session.noninheritDataAtom; + operatorstring += NONINHERIT_DATA_ARROW; floraQuery = "insert{"+floraOID + "[" + methodName + paramList + operatorstring + value.toString() + "]" - + session.moduleStr + this.moduleName + "}."; + + AT_MODULE_SYMBOL + moduleName + "}."; try { return session.ExecuteCommand(floraQuery); @@ -364,7 +445,7 @@ ** parameters : parameters to the method ** value : vector of values to be set to */ - public boolean set(Object methodName,boolean inherit,Vector parameters,Vector value) + public boolean setdata(String moduleName,Object methodName,boolean inherit,Vector parameters,Vector value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); @@ -372,14 +453,14 @@ String operatorstring = ""; if (inherit) - operatorstring += session.inheritDataAtom; + operatorstring += INHERIT_DATA_ARROW; else - operatorstring += session.noninheritDataAtom; + operatorstring += NONINHERIT_DATA_ARROW; floraQuery = "insert{"+floraOID + "[" + methodName.toString() + paramList + operatorstring + valuelist + "]" - + session.moduleStr + this.moduleName +"}."; + + AT_MODULE_SYMBOL + moduleName +"}."; try { return session.ExecuteCommand(floraQuery); } @@ -392,11 +473,11 @@ /* Get all instances of the class of this object */ - public Iterator getInstances() + public Iterator getInstances(String moduleName) { String floraQuery = - "?Object" + session.isASign + floraClassName.toString() - + session.moduleStr + moduleName + "."; + "?Object" + ISA_SYMBOL + floraClassName.toString() + + AT_MODULE_SYMBOL + moduleName + "."; try { return session.ExecuteQuery(floraQuery); @@ -412,15 +493,15 @@ /* Get all instances of the current class that are it's ** direct instances and not instances of any subclasses */ - public Iterator getOwnInstances() + public Iterator getOwnInstances(String moduleName) { // Construct a query of the form ?X:C, not ((?_S::C, ?X:?_S)). String floraQuery = - "( ?Object" + session.isASign + floraClassName.toString() - + ", not ((?__Subcl" + session.isASubClassOfSign + "( ?Object" + ISA_SYMBOL + floraClassName.toString() + + ", not ((?__Subcl" + SUBCLASS_SYMBOL + floraClassName.toString() + ", ?Object" - + session.isASign + "?__Subcl)) )" - + session.moduleStr + moduleName + "."; + + ISA_SYMBOL + "?__Subcl)) )" + + AT_MODULE_SYMBOL + moduleName + "."; try { return session.ExecuteQuery(floraQuery); @@ -434,11 +515,11 @@ /* Get all SubClasses of the class of this object */ - public Iterator getSubClasses() + public Iterator getSubClasses(String moduleName) { String floraQuery = - "?Class" + session.isASubClassOfSign + floraClassName.toString() - + session.moduleStr + moduleName + "."; + "?Class" + SUBCLASS_SYMBOL + floraClassName.toString() + + AT_MODULE_SYMBOL + moduleName + "."; try { return session.ExecuteQuery(floraQuery); @@ -452,11 +533,11 @@ /* Get all SuperClasses of the class of this object */ - public Iterator getSuperClasses() + public Iterator getSuperClasses(String moduleName) { String floraQuery = - floraClassName.toString() + session.isASubClassOfSign - + "?Class" + session.moduleStr+moduleName+"."; + floraClassName.toString() + SUBCLASS_SYMBOL + + "?Class" + AT_MODULE_SYMBOL + moduleName + "."; try { return session.ExecuteQuery(floraQuery); @@ -470,14 +551,14 @@ /* Get all direct SuperClasses of the class of this object */ - public Iterator getDirectSuperClasses() + public Iterator getDirectSuperClasses(String moduleName) { // construct query of the form SC::?S, not ((SC::?_Mid, ?_Mid::?S)). String floraQuery = - "( " + floraClassName + session.isASubClassOfSign + "?Class, " - + "not ((" + floraClassName + session.isASubClassOfSign - + "?__Mid, ?__Mid" + session.isASubClassOfSign + "?Class)))" - + session.moduleStr+moduleName+"."; + "( " + floraClassName + SUBCLASS_SYMBOL + "?Class, " + + "not ((" + floraClassName + SUBCLASS_SYMBOL + + "?__Mid, ?__Mid" + SUBCLASS_SYMBOL + "?Class)))" + + AT_MODULE_SYMBOL + moduleName + "."; try { return session.ExecuteQuery(floraQuery); @@ -490,38 +571,32 @@ } - /* Get all non-inheritable methods of the - ** class to which this object belongs - */ - public Iterator getNonInheritValuedMethods() - { - return getMethods(false); - } - - - /* Get all inheritable methods of the class - ** to which this object belongs - */ - public Iterator getInheritValuedMethods() - { - return getMethods(true); - } - - /* Get all the methods of the class to which this object belongs ** This doesn't return boolean or procedural methods. */ - public Iterator getAllMethods() + public Iterator getAllMethods(String moduleName) { Vector allMethods = new Vector(); - Iterator allNonInherit = getNonInheritValuedMethods(); - while(allNonInherit.hasNext()) - allMethods.add((FloraMethod)(allNonInherit.next())); + Iterator methodIter = getMethods(moduleName,NONINHERITABLE,DATA); // noninh data + while(methodIter.hasNext()) + allMethods.add((FloraMethod)(methodIter.next())); - Iterator allInherit = getInheritValuedMethods(); - while(allInherit.hasNext()) - allMethods.add((FloraMethod)(allInherit.next())); + methodIter = getMethods(moduleName,INHERITABLE,DATA); // inh data + while(methodIter.hasNext()) + allMethods.add((FloraMethod)(methodIter.next())); + + methodIter = getMethods(moduleName,INHERITABLE,BOOLEAN); // inh bool + while(methodIter.hasNext()) + allMethods.add((FloraMethod)(methodIter.next())); + + methodIter = getMethods(moduleName,NONINHERITABLE,BOOLEAN); // noninh bool + while(methodIter.hasNext()) + allMethods.add((FloraMethod)(methodIter.next())); + + methodIter = getMethods(moduleName,NONINHERITABLE,PROCEDURAL); // noninh proc + while(methodIter.hasNext()) + allMethods.add((FloraMethod)(methodIter.next())); return allMethods.iterator(); } @@ -531,25 +606,43 @@ ** Returns only set-valued methods - not boolean or procedural ** ** inherit : indicates if the method is inheritable + ** methType: DATA, BOOLEAN, PROCEDURAL */ - private Iterator getMethods(boolean inherit) + private Iterator getMethods(String moduleName, boolean inherit, int methType) { - String floraQuerytype = ""; - if(inherit) - floraQuerytype = session.inheritSignatureAtom; - else - floraQuerytype = session.noninheritSignatureAtom; + String callModifier = ""; // *, %, or nothing + String valuePart = ""; // => ?Val or *=> ?Val for data symbols + + checkMethodType(methType); + + if (methType == DATA) { + if (inherit) + valuePart = INHERIT_SIGNATURE_ARROW + "?Value"; + else + valuePart = NONINHERIT_SIGNATURE_ARROW + "?Value"; + } else if (methType == BOOLEAN) { + if (inherit) + callModifier = INHERIT_SIGNATURE_ARROW; + else + callModifier = NONINHERIT_SIGNATURE_ARROW; + } else if (methType == PROCEDURAL) { + if (inherit) + throw new FlrException("j2flora2: Invalid method type -- procedural+inheritable methods are not supported"); + else + callModifier = + NONINHERIT_SIGNATURE_ARROW + PROCEDURAL_METHOD_SYMBOL; + } Vector vars = new Vector(); vars.add("?Method"); - vars.add("?Value"); + vars.add("?Value"); // shouldn't matter if ?Value is not used vars.add("?Arguments"); String floraQueryString = "(" + floraClassName.toString() - + "[?__Call" + floraQuerytype + "?Value]" + + "[" + callModifier + "?__Call" + valuePart + "]" + ", ?__Call =.. [hilog(?Method) | ?Arguments]" - + ")" +session.moduleStr + moduleName +"."; + + ")" + AT_MODULE_SYMBOL + moduleName +"."; Iterator methodMatches; Vector returnMethodVec = new Vector(); @@ -560,6 +653,7 @@ firstmatch = (HashMap)methodMatches.next(); FloraObject methodObj = (FloraObject)firstmatch.get("?Method"); FloraObject returnTypeObj = + // should be null, if ?Value isn't used for procedural/bool (FloraObject)firstmatch.get("?Value"); TermModel methodArgs = ((FloraObject)firstmatch.get("?Arguments")).floraOID; @@ -570,7 +664,7 @@ methodArgs = (TermModel) methodArgs.getChild(1); } returnMethodVec.add(new FloraMethod(methodObj,methodPars, - returnTypeObj,inherit)); + returnTypeObj,inherit,methType)); } } catch (Exception e) { @@ -585,23 +679,23 @@ /* Get all values for a method, where all arguments are bound. ** ** methodName : name of method whose value is to be got - ** inherit : if the method is inheritable or not + ** inherit : whether the method is inheritable or not ** parameters : the parameters for the method */ - public Iterator get(Object methodName,boolean inherit,Vector parameters) + public Iterator getdata(String moduleName, Object methodName,boolean inherit,Vector parameters) { String floraQuery = ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; if (inherit) - operatorstring += session.inheritDataAtom; + operatorstring += INHERIT_DATA_ARROW; else - operatorstring += session.noninheritDataAtom; + operatorstring += NONINHERIT_DATA_ARROW; floraQuery = floraOID + "[" + methodName.toString() + paramList + operatorstring - + "?Value]" + session.moduleStr + this.moduleName + "."; + + "?Value]" + AT_MODULE_SYMBOL + moduleName + "."; if (debug) System.out.println("In get/3, floraQuery: " + floraQuery); @@ -613,19 +707,19 @@ e.printStackTrace(); throw new FlrException("j2flora2: Method " + methodName + " failed on object " + floraOID - + " in module " + this.moduleName); + + " in module " + moduleName); } } /* Get all values for a method where the arguments might be unbound. - ** For instance, obj[m(aaa,?Y) -> ?Z] + ** For instance, obj[m(aaa,?Y) -> ?Z] or obj[m(aaa,?Y) *-> ?Z] ** ** methodName : name of method whose value is to be got - ** inherit : if the method is inheritable or not + ** inherit : whether the method is inheritable or not ** parameters : the parameters for the method */ - public Iterator getAll(Object methodName,boolean inherit,Vector parameters) + public Iterator getdataAll(String moduleName, Object methodName,boolean inherit,Vector parameters) { String floraQuery = ""; String paramList = makeParameterListString(parameters); @@ -640,14 +734,14 @@ String operatorstring = ""; if (inherit) - operatorstring += session.inheritDataAtom; + operatorstring += INHERIT_DATA_ARROW; else - operatorstring += session.noninheritDataAtom; + operatorstring += NONINHERIT_DATA_ARROW; // Use weird name Value___395792 to avoid clashes with argList vars floraQuery = floraOID + "[" + methodName.toString() + paramList + operatorstring - + "?Value___395792]" + session.moduleStr + this.moduleName + "."; + + "?Value___395792]" + AT_MODULE_SYMBOL + moduleName + "."; argList.add("?Value___395792"); try { @@ -655,7 +749,7 @@ } catch(Exception e) { e.printStackTrace(); - throw new FlrException("j2flora2: Error in getAll. Query was " + throw new FlrException("j2flora2: Error in getdataAll. Query was " + floraQuery); } } |
|
From: Michael K. <ki...@us...> - 2006-05-29 05:00:58
|
Update of /cvsroot/flora/flora2/docs In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv8039/docs Modified Files: flora-flrjava.tex Log Message: nup of the java interface Index: flora-flrjava.tex =================================================================== RCS file: /cvsroot/flora/flora2/docs/flora-flrjava.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- flora-flrjava.tex 25 May 2006 02:49:48 -0000 1.7 +++ flora-flrjava.tex 29 May 2006 05:00:49 -0000 1.8 @@ -181,7 +181,7 @@ System.out.println("Person name:"+personObj); person currPerson =new person(personObj,"basic_mod"); - Iterator kidsItr = currPerson.getN_kids(); + Iterator kidsItr = currPerson.getDN_kids(); while(kidsItr.hasNext()) { Object kidObj = kidsItr.next(); @@ -190,7 +190,7 @@ person kidPerson = null; kidPerson = new person(kidObj,"basic_mod"); - Iterator hobbiesItr = kidPerson.getN_hobbies(); + Iterator hobbiesItr = kidPerson.getDN_hobbies(); while(hobbiesItr.hasNext()) { Object hobbyObj = hobbiesItr.next(); System.out.println("Kid:"+kidObj + " has hobby: " + hobbyObj); @@ -247,39 +247,39 @@ will have the following methods: %% \begin{enumerate} -\item {\tt public Iterator getI\_foobar()}\\ - {\tt public Iterator getN\_foobar()} +\item {\tt public Iterator getDI\_foobar()}\\ + {\tt public Iterator getDN\_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 getN} form queries non-inheritable methods and {\tt getI} + The {\tt getDN} form queries non-inheritable data methods and {\tt getDI} inheritable. -\item {\tt public boolean setI\_foobar(Vector value)}\\ - {\tt public boolean setN\_foobar(Vector value)} +\item {\tt public boolean setDI\_foobar(Vector value)}\\ + {\tt public boolean setDN\_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 setN} sets non-inheritable methods and {\tt setI} + Again, {\tt setDN} sets non-inheritable methods and {\tt setDI} inheritable. -\item {\tt public boolean setI\_foobar(Object value)}\\ - {\tt public boolean setN\_foobar(Object value)} +\item {\tt public boolean setDI\_foobar(Object value)}\\ + {\tt public boolean setDN\_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 deleteI\_foobar(Vector value)}\\ - {\tt public boolean deleteN\_foobar(Vector value)} +\item {\tt public boolean deleteDI\_foobar(Vector value)}\\ + {\tt public boolean deleteDN\_foobar(Vector value)} \\ Delete a set of values of the attribute {\tt foobar} as specified in the vector argument. -\item {\tt public boolean deleteI\_foobar(Object value)}\\ - {\tt public boolean deleteN\_foobar(Object value)} +\item {\tt public boolean deleteDI\_foobar(Object value)}\\ + {\tt public boolean deleteDN\_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 deleteI\_foobar()}\\ - {\tt public boolean deleteN\_foobar()} +\item {\tt public boolean deleteDI\_foobar()}\\ + {\tt public boolean deleteDN\_foobar()} \\ Delete all values of the attribute {\tt foobar}. \end{enumerate} @@ -287,37 +287,37 @@ 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 getI\_*}, {\tt setI\_*}, +{\tt arg1} and {\tt arg2}. As before the {\tt getDI\_*}, {\tt setDI\_*}, etc., forms of the Java methods are for dealing with inheritable \FLORA -methods and the {\tt getN\_*}, {\tt setN\_*}, +methods and the {\tt getDN\_*}, {\tt setDN\_*}, etc., forms are for dealing with non-inheritable \FLORA methods. %% \begin{enumerate} -\item {\tt public Iterator getI\_foobar2(Object arg1, Object arg2)}\\ - {\tt public Iterator getN\_foobar2(Object arg1, Object arg2)} +\item {\tt public Iterator getDI\_foobar2(Object arg1, Object arg2)}\\ + {\tt public Iterator getDN\_foobar2(Object arg1, Object arg2)} \\ Obtain all values for the \fl method invocation {\tt foobar2(arg1,arg2)}. -\item {\tt public boolean setI\_foobar2(Object arg1, Object arg2, Vector value)}\\ - {\tt public boolean setN\_foobar2(Object arg1, Object arg2, Vector value)} +\item {\tt public boolean setDI\_foobar2(Object arg1, Object arg2, Vector value)}\\ + {\tt public boolean setDN\_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 setI\_foobar2(Object arg1, Object arg2, Object value)}\\ - {\tt public boolean setN\_foobar2(Object arg1, Object arg2, Object value)} +\item {\tt public boolean setDI\_foobar2(Object arg1, Object arg2, Object value)}\\ + {\tt public boolean setDN\_foobar2(Object arg1, Object arg2, Object value)} \\ A simplified interface when only one value is to be added. -\item {\tt public boolean deleteI\_foobar2(Object arg1, Object arg2, Vector value)}\\ - {\tt public boolean deleteN\_foobar2(Object arg1, Object arg2, Vector value)} +\item {\tt public boolean deleteDI\_foobar2(Object arg1, Object arg2, Vector value)}\\ + {\tt public boolean deleteDN\_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 deleteI\_foobar2(Object arg1, Object arg2, Object value)}\\ - {\tt public boolean deleteN\_foobar2(Object arg1, Object arg2, Object value)} +\item {\tt public boolean deleteDI\_foobar2(Object arg1, Object arg2, Object value)}\\ + {\tt public boolean deleteDN\_foobar2(Object arg1, Object arg2, Object value)} \\ A simplified interface for deleting a single value. -\item {\tt public boolean deleteI\_foobar2(Object arg1, Object arg2)}\\ - {\tt public boolean deleteN\_foobar2(Object arg1, Object arg2)} +\item {\tt public boolean deleteDI\_foobar2(Object arg1, Object arg2)}\\ + {\tt public boolean deleteDN\_foobar2(Object arg1, Object arg2)} \\ Delete all values for the method invocation {\tt foobar2(arg1,arg2)}. \end{enumerate} @@ -400,57 +400,57 @@ import net.sourceforge.flora.javaAPI.src.*; public class person { - public FloraObject proxyFlora; + public FloraObject sourceFloraObject; - public person(FloraObject proxy,String moduleName) { ... } - public boolean setI_age(Object value) { ... } - public boolean setN_age(Object value) { ... } - public Iterator getI_age(){ ... } - public Iterator getN_age(){ ... } - public boolean deleteI_age(Object value) { ... } - public boolean deleteN_age(Object value) { ... } - public boolean deleteI_age() { ... } - public boolean deleteN_age() { ... } - public boolean setI_salary(Object year,Object value) { ... } - public boolean setN_salary(Object year,Object value) { ... } - public Iterator getI_salary(Object year) { ... } - public Iterator getN_salary(Object year) { ... } - public boolean deleteI_salary(Object year,Object value) { ... } - public boolean deleteN_salary(Object year,Object value) { ... } - public boolean deleteI_salary(Object year) { ... } - public boolean deleteN_salary(Object year) { ... } - public boolean setI_hobbies(Vector value) { ... } - public boolean setN_hobbies(Vector value) { ... } - public Iterator getI_hobbies(){ ... } - public Iterator getN_hobbies(){ ... } - public boolean deleteI_hobbies(Vector value) { ... } - public boolean deleteN_hobbies(Vector value) { ... } - public boolean deleteI_hobbies(){ ... } - public boolean deleteN_hobbies(){ ... } - public boolean setI_instances(Vector value) { ... } - public boolean setN_instances(Vector value) { ... } - public Iterator getI_instances(){ ... } - public Iterator getN_instances(){ ... } - public boolean deleteI_instances(Vector value) { ... } - public boolean deleteN_instances(Vector value) { ... } - public boolean deleteI_instances(){ ... } - public boolean deleteN_instances(){ ... } - public boolean setI_kids(Vector value) { ... } - public boolean setN_kids(Vector value) { ... } - public Iterator getI_kids(){ ... } - public Iterator getN_kids(){ ... } - public boolean deleteI_kids(Vector value) { ... } - public boolean deleteN_kids(Vector value) { ... } - public boolean deleteI_kids(){ ... } - public boolean deleteN_kids(){ ... } - public boolean setI_believes_in(Vector value) { ... } - public boolean setN_believes_in(Vector value) { ... } - public Iterator getI_believes_in(){ ... } - public Iterator getN_believes_in(){ ... } - public boolean deleteI_believes_in(Vector value) { ... } - public boolean deleteN_believes_in(Vector value) { ... } - public boolean deleteI_believes_in(){ ... } - public boolean deleteN_believes_in(){ ... } + 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(){ ... } } \end{verbatim} \end{quote} @@ -500,10 +500,10 @@ currPerson =new person(personObj,"basic_mod"); /* Set that person's age to 50 */ - currPerson.setN_age("50"); + currPerson.setDN_age("50"); /* Get this person's kids */ - Iterator kidsItr = currPerson.getN_kids(); + Iterator kidsItr = currPerson.getDN_kids(); while (kidsItr.hasNext()) { FloraObject kidObj = (FloraObject)(kidsItr.next()); System.out.println("Person: " + personObj + " has kid: " +kidObj); @@ -513,7 +513,7 @@ kidPerson = new person(kidObj,"basic_mod"); /* Get kidPerson's hobbies */ - Iterator hobbiesItr = kidPerson.getN_hobbies(); + Iterator hobbiesItr = kidPerson.getDN_hobbies(); while(hobbiesItr.hasNext()) { FloraObject hobbyObj = (FloraObject)(hobbiesItr.next()); System.out.println("Kid:"+kidObj + " has hobby:" +hobbyObj); |
|
From: Michael K. <ki...@us...> - 2006-05-29 05:00:58
|
Update of /cvsroot/flora/flora2/pkgs In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv8039/pkgs Modified Files: javaAPI.flr Log Message: nup of the java interface Index: javaAPI.flr =================================================================== RCS file: /cvsroot/flora/flora2/pkgs/javaAPI.flr,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- javaAPI.flr 25 May 2006 02:49:47 -0000 1.4 +++ javaAPI.flr 29 May 2006 05:00:49 -0000 1.5 @@ -54,8 +54,8 @@ %writeProcedural(?Obj,?Module,proceduralMethodNoninh), // proceduralMethodInh not implemented //%writeProcedural(?Obj,?Module,proceduralMethodInh), - %writeRegular(?Obj,?Module,regularMethodInh), - %writeRegular(?Obj,?Module,regularMethodNoninh), + %writeData(?Obj,?Module,dataMethodInh), + %writeData(?Obj,?Module,dataMethodNoninh), %closeFile. %openFile(?FileName) :- @@ -71,32 +71,33 @@ /* Writing the class statement */ %writeStartClass(?Obj) :- write('public class ')@prolog(), - %writeln(?Obj)@flora(io), - writeln('{')@prolog(), + %write(?Obj)@flora(io), + writeln(' extends FloraConstants {')@prolog(), %writeConstructor(?Obj), %writeToStringMethod(). %writeConstructor(?Obj) :- - writeln('public FloraObject proxyFlora;')@prolog(), - write('public TermModel floraClassName = new TermModel("')@prolog(), + writeln('FloraObject sourceFloraObject;')@prolog(), + writeln('String moduleName;')@prolog(), + write('TermModel floraClassName = new TermModel("')@prolog(), %write(?Obj)@flora(io), writeln('");')@prolog(), write('public ')@prolog(), %write(?Obj)@flora(io), - writeln('(FloraObject proxy,String moduleName) {')@prolog(), - writeln('proxyFlora = proxy;')@prolog(), - writeln('if (proxy == null) + writeln('(FloraObject sourceFloraObject,String moduleName) {')@prolog(), + writeln('this.sourceFloraObject = sourceFloraObject;')@prolog(), + writeln('if (sourceFloraObject == null) throw new FlrException("Cannot create Java class " + floraClassName - + ". Null proxy object passed to " - + floraClassName + "(proxy,modulename)");')@prolog(), - writeln('proxyFlora.moduleName = moduleName;')@prolog(), - writeln('proxyFlora.floraClassName = floraClassName;')@prolog(), + + ". Null sourceFloraObject object passed to " + + floraClassName + "(sourceFloraObject,moduleName)");')@prolog(), + writeln('this.moduleName = moduleName;')@prolog(), + writeln('sourceFloraObject.floraClassName = floraClassName;')@prolog(), writeln('return;')@prolog(), writeln('}')@prolog(). %writeToStringMethod() :- writeln('public String toString() {')@prolog(), - writeln('return proxyFlora.toString();')@prolog(), + writeln('return sourceFloraObject.toString();')@prolog(), writeln('}')@prolog(). %closeFile :- @@ -117,8 +118,8 @@ else ?MethodList=collectset{?M|?Obj[=>%?M]@?Module}, %callXOnList(?MethodList,?Inherit). -%writeRegular(?Obj,?Module,?Inherit) :- - if ?Inherit == regularMethodInh +%writeData(?Obj,?Module,?Inherit) :- + if ?Inherit == dataMethodInh then ?MethodList=collectset{?M|?Obj[?M*=>?_X]@?Module} else ?MethodList=collectset{?M|?Obj[?M=>?_X; ?M*=>?_X]@?Module}, %callXOnList(?MethodList,?Inherit). @@ -133,36 +134,38 @@ /* Calling the same functions for inheritable/non-inheritable versions of the method */ %booleanMethodInh(?Method) :- - %booleanMethodAny(?Method,true). + %booleanMethodAny(?Method,INHERITABLE). %booleanMethodNoninh(?Method) :- - %booleanMethodAny(?Method,false). + %booleanMethodAny(?Method,NONINHERITABLE). %booleanMethodAny(?Method,?Inherit) :- %writeGetBool(?Method,?Inherit), + %writeGetBoolAll(?Method,?Inherit), %writeSetBool(?Method,?Inherit), %writeDeleteBool(?Method,?Inherit). %proceduralMethodInh(?Method) :- // not yet implemented in FLORA-2 - %proceduralMethodAny(?Method,true). + %proceduralMethodAny(?Method,INHERITABLE). %proceduralMethodNoninh(?Method) :- - %proceduralMethodAny(?Method,false). + %proceduralMethodAny(?Method,NONINHERITABLE). %proceduralMethodAny(?Method,?Inherit) :- %writeGetProc(?Method,?Inherit), + %writeGetProcAll(?Method,?Inherit), %writeSetProc(?Method,?Inherit), %writeDeleteProc(?Method,?Inherit). -%regularMethodInh(?Method) :- - %regularMethodAny(?Method,true). -%regularMethodNoninh(?Method) :- - %regularMethodAny(?Method,false). +%dataMethodInh(?Method) :- + %dataMethodAny(?Method,INHERITABLE). +%dataMethodNoninh(?Method) :- + %dataMethodAny(?Method,NONINHERITABLE). -%regularMethodAny(?Method,?Inherit) :- - %regularSet(?Method,?Inherit), - %regularGet(?Method,?Inherit), - %regularGetAll(?Method,?Inherit), - %regularDelete(?Method,?Inherit), - %regularDeleteAll(?Method,?Inherit). +%dataMethodAny(?Method,?Inherit) :- + %writeGetData(?Method,?Inherit), + %writeGetDataAll(?Method,?Inherit), + %writeSetData(?Method,?Inherit), + %writeDeleteData(?Method,?Inherit), + %writeDeleteDataAll(?Method,?Inherit). // Boolean @@ -170,6 +173,10 @@ %writeGetBoolProto(?Method,?Inherit), %writeGetBoolBody(?Method,?Inherit). +%writeGetBoolAll(?Method,?Inherit) :- + %writeGetBoolAllProto(?Method,?Inherit), + %writeGetBoolAllBody(?Method,?Inherit). + %writeSetBool(?Method,?Inherit) :- %writeSetBoolProto(?Method,?Inherit), %writeSetBoolBody(?Method,?Inherit). @@ -181,7 +188,7 @@ %writeGetBoolProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==true, !, write('public boolean getBI_')@prolog() + (?Inherit==INHERITABLE, !, write('public boolean getBI_')@prolog() ; write('public boolean getBN_')@prolog() ), %write(?FnName)@flora(io), @@ -189,15 +196,30 @@ %writeParlist(?FnArgs), writeln(')')@prolog(). +%writeGetBoolAllProto(?Method,?Inherit) :- + ?Method =.. [?H|?FnArgs], + (?H = hilog(?FnName), ! ; ?H = ?FnName), + (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), + format('public Iterator getB~wall_',[?Modifier])@prolog(format), + %write(?FnName)@flora(io), + write('(')@prolog(), + %writeParlist(?FnArgs), + writeln(')')@prolog(). + %writeGetBoolBody(?Method,?Inherit) :- writeln('{')@prolog(), %parentCallGetBody(?Method,?Inherit,getboolean), writeln('}')@prolog(). +%writeGetBoolAllBody(?Method,?Inherit) :- + writeln('{')@prolog(), + %parentCallGetBody(?Method,?Inherit,getbooleanAll), + writeln('}')@prolog(). + %writeSetBoolProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==true, !, write('public boolean setBI_')@prolog() + (?Inherit==INHERITABLE, !, write('public boolean setBI_')@prolog() ; write('public boolean setBN_')@prolog() ), %write(?FnName)@flora(io), @@ -213,7 +235,7 @@ %writeDeleteBoolProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==true, !, write('public boolean deleteBI_')@prolog() + (?Inherit==INHERITABLE, !, write('public boolean deleteBI_')@prolog() ; write('public boolean deleteBN_')@prolog() ), %write(?FnName)@flora(io), @@ -231,6 +253,10 @@ %writeGetProcProto(?Method,?Inherit), %writeGetProcBody(?Method,?Inherit). +%writeGetProcAll(?Method,?Inherit) :- + %writeGetProcAllProto(?Method,?Inherit), + %writeGetProcAllBody(?Method,?Inherit). + %writeSetProc(?Method,?Inherit) :- %writeSetProcProto(?Method,?Inherit), %writeSetProcBody(?Method,?Inherit). @@ -242,23 +268,37 @@ %writeGetProcProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==true, !, write('public boolean getPI_')@prolog() - ; write('public boolean getPN_')@prolog() - ), + (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), + format('public boolean getP~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(')')@prolog(). +%writeGetProcAllProto(?Method,?Inherit) :- + ?Method =.. [?H|?FnArgs], + (?H = hilog(?FnName), ! ; ?H = ?FnName), + (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), + format('public Iterator getP~wall_',[?Modifier])@prolog(format), + %write(?FnName)@flora(io), + write('(')@prolog(), + %writeParlist(?FnArgs), + writeln(')')@prolog(). + %writeGetProcBody(?Method,?Inherit) :- writeln('{')@prolog(), %parentCallGetBody(?Method,?Inherit,getprocedural), writeln('}')@prolog(). +%writeGetProcAllBody(?Method,?Inherit) :- + writeln('{')@prolog(), + %parentCallGetBody(?Method,?Inherit,getproceduralAll), + writeln('}')@prolog(). + %writeSetProcProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==true, !, write('public boolean setPI_')@prolog() + (?Inherit==INHERITABLE, !, write('public boolean setPI_')@prolog() ; write('public boolean setPN_')@prolog() ), %write(?FnName)@flora(io), @@ -274,7 +314,7 @@ %writeDeleteProcProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==true, !, write('public boolean deletePI_')@prolog() + (?Inherit==INHERITABLE, !, write('public boolean deletePI_')@prolog() ; write('public boolean deletePN_')@prolog() ), %write(?FnName)@flora(io), @@ -291,98 +331,100 @@ /* The set and the get functions involve writing the prototype and the body of the function */ -%regularSet(?Method,?Inherit) :- - %regularSetProto(?Method,?Inherit), - %regularSetBody(?Method,?Inherit), - %regularSetProtoOneVal(?Method,?Inherit), - %regularSetBody(?Method,?Inherit). +%writeSetData(?Method,?Inherit) :- + %writeSetDataProto(?Method,?Inherit), + %writeSetDataBody(?Method,?Inherit), + %writeSetDataProtoOneVal(?Method,?Inherit), + %writeSetDataBody(?Method,?Inherit). -%regularGet(?Method,?Inherit) :- - %regularGetProto(?Method,?Inherit), - %regularGetBody(?Method,?Inherit). +%writeGetData(?Method,?Inherit) :- + %writeGetDataProto(?Method,?Inherit), + %writeGetDataBody(?Method,?Inherit). -%regularGetAll(?Method,?Inherit) :- - %regularGetAllProto(?Method,?Inherit), - %regularGetAllBody(?Method,?Inherit). +%writeGetDataAll(?Method,?Inherit) :- + %writeGetDataAllProto(?Method,?Inherit), + %writeGetDataAllBody(?Method,?Inherit). -%regularDelete(?Method,?Inherit) :- - %regularDeleteProto(?Method,?Inherit), - %regularDeleteBody(?Method,?Inherit), - %regularDeleteProtoOneVal(?Method,?Inherit), - %regularDeleteBody(?Method,?Inherit). +%writeDeleteData(?Method,?Inherit) :- + %writeDeleteDataProto(?Method,?Inherit), + %writeDeleteDataBody(?Method,?Inherit), + %writeDeleteDataProtoOneVal(?Method,?Inherit), + %writeDeleteDataBody(?Method,?Inherit). -%regularDeleteAll(?Method,?Inherit) :- - %regularDeleteAllProto(?Method,?Inherit), - %regularDeleteAllBody(?Method,?Inherit). +%writeDeleteDataAll(?Method,?Inherit) :- + %writeDeleteDataAllProto(?Method,?Inherit), + %writeDeleteDataAllBody(?Method,?Inherit). /* Writing the prototype */ -%regularSetProtoOneVal(?Method,?Inherit):- +%writeSetDataProtoOneVal(?Method,?Inherit):- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Object value)' else (?H = ?FnName, ?Msg = 'Object value)'), - (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), - format('public boolean set~w_',[?Modifier])@prolog(format), + (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), + format('public boolean setD~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%regularSetProto(?Method,?Inherit) :- +%writeSetDataProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Vector value)' else (?H = ?FnName, ?Msg = 'Vector value)'), - (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), - format('public boolean set~w_',[?Modifier])@prolog(format), + (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), + format('public boolean setD~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%regularGetProto(?Method,?Inherit) :- +%writeGetDataProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), - format('public Iterator get~w_',[?Modifier])@prolog(format), + (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), + format('public Iterator getD~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), write(')')@prolog(). -%regularGetAllProto(?Method,?Inherit) :- - ?Method =.. [?H|?_FnArgs], +%writeGetDataAllProto(?Method,?Inherit) :- + ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), - format('public Iterator getAll~w_',[?Modifier])@prolog(format), + (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), + format('public Iterator getD~wall_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), - write('()')@prolog(). + write('(')@prolog(), + %writeParlist(?FnArgs), + write(')')@prolog(). -%regularDeleteProtoOneVal(?Method,?Inherit):- +%writeDeleteDataProtoOneVal(?Method,?Inherit):- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Object value)' else (?H = ?FnName, ?Msg = 'Object value)'), - (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), - format('public boolean delete~w_',[?Modifier])@prolog(format), + (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), + format('public boolean deleteD~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%regularDeleteProto(?Method,?Inherit) :- +%writeDeleteDataProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Vector value)' else (?H = ?FnName, ?Msg = 'Vector value)'), - (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), - format('public boolean delete~w_',[?Modifier])@prolog(format), + (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), + format('public boolean deleteD~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%regularDeleteAllProto(?Method,?Inherit) :- +%writeDeleteDataAllProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), - format('public boolean delete~w_',[?Modifier])@prolog(format), + (?Inherit==INHERITABLE, !, ?Modifier=I ; ?Modifier=N), + format('public boolean deleteD~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), %writeParlist(?FnArgs), @@ -390,27 +432,27 @@ /* Writing the body */ -%regularSetBody(?Method,?Inherit) :- +%writeSetDataBody(?Method,?Inherit) :- writeln('{')@prolog(), - %parentCallSetBody(?Method,?Inherit,set), + %parentCallSetBody(?Method,?Inherit,setdata), writeln('}')@prolog(). -%regularGetBody(?Method,?Inherit) :- +%writeGetDataBody(?Method,?Inherit) :- writeln('{')@prolog(), - %parentCallGetBody(?Method,?Inherit,get), + %parentCallGetBody(?Method,?Inherit,getdata), writeln('}')@prolog(). -%regularGetAllBody(?Method,?Inherit) :- +%writeGetDataAllBody(?Method,?Inherit) :- writeln('{')@prolog(), - %parentCallGetAllBody(?Method,?Inherit), + %parentCallGetBody(?Method,?Inherit,getdataAll), writeln('}')@prolog(). -%regularDeleteBody(?Method,?Inherit) :- +%writeDeleteDataBody(?Method,?Inherit) :- writeln('{')@prolog(), - %parentCallDeleteBody(?Method,?Inherit,delete), + %parentCallDeleteBody(?Method,?Inherit,deletedata), writeln('}')@prolog(). -%regularDeleteAllBody(?Method,?Inherit) :- +%writeDeleteDataAllBody(?Method,?Inherit) :- writeln('{')@prolog(), %parentCallDeleteAllBody(?Method,?Inherit), writeln('}')@prolog(). @@ -426,12 +468,12 @@ writeln('Vector pars = new Vector();')@prolog(). %writeProxySetCall(?FnName,?Inherit,?Type) :- - (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), - format('return proxyFlora.~w("',[?Type])@prolog(format), + (?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==set, !, writeln(',pars,value);')@prolog() + (?Type==setdata, !, writeln(',pars,value);')@prolog() ; writeln(',pars);')@prolog() ). @@ -443,26 +485,20 @@ %writeProxyGetCall(?FnName,?Inherit,?Type). %writeProxyGetCall(?FnName,?Inherit,?Type) :- - format('return proxyFlora.~w("',[?Type])@prolog(format), + format('return sourceFloraObject.~w(moduleName,"',[?Type])@prolog(format), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), writeln(',pars);')@prolog(). -%parentCallGetAllBody(?Method,?Inherit) :- +%parentCallGetAllBody(?Method,?Inherit,?Type) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), %writeVectorParsInit, %writeGetAllBodyList(?FnArgs), - %writeProxyGetAllCall(?FnName,?Inherit). + %writeProxyGetCall(?FnName,?Inherit,?Type). -%writeProxyGetAllCall(?FnName,?Inherit) :- - write('return proxyFlora.getAll("')@prolog(), - %write(?FnName)@flora(io), - write('",')@prolog(), - %write(?Inherit)@flora(io), - writeln(',pars);')@prolog(). %parentCallDeleteBody(?Method,?Inherit,?Type) :- ?Method =.. [?H|?FnArgs], @@ -472,11 +508,11 @@ %writeProxyDeleteBody(?FnName,?Inherit,?Type). %writeProxyDeleteBody(?FnName,?Inherit,?Type) :- - format('return proxyFlora.~w("',[?Type])@prolog(format), + format('return sourceFloraObject.~w(moduleName,"',[?Type])@prolog(format), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), - (?Type == delete, !, writeln(',pars,value);')@prolog() + (?Type == deletedata, !, writeln(',pars,value);')@prolog() ; writeln(',pars);')@prolog() ). @@ -488,7 +524,7 @@ %writeProxyDeleteAllBody(?FnName,?Inherit). %writeProxyDeleteAllBody(?FnName,?Inherit) :- - write('return proxyFlora.delete("')@prolog(), + write('return sourceFloraObject.deletedata(moduleName,"')@prolog(), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), |
|
From: Michael K. <ki...@us...> - 2006-05-29 05:00:58
|
Update of /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv8039/java/API/examples/flogicbasicsExample Modified Files: person.java flogicbasicsExample.java Log Message: nup of the java interface Index: person.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample/person.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- person.java 25 May 2006 02:49:48 -0000 1.2 +++ person.java 29 May 2006 05:00:49 -0000 1.3 @@ -2,387 +2,387 @@ import com.declarativa.interprolog.TermModel; import net.sourceforge.flora.javaAPI.util.*; import net.sourceforge.flora.javaAPI.src.*; -public class person -{ -public FloraObject proxyFlora; -public TermModel floraClassName = new TermModel("person"); -public person(FloraObject proxy,String moduleName) { -proxyFlora = proxy; -if (proxy == null) +public class person extends FloraConstants { +FloraObject sourceFloraObject; +String moduleName; +TermModel floraClassName = new TermModel("person"); +public person(FloraObject sourceFloraObject,String moduleName) { +this.sourceFloraObject = sourceFloraObject; +if (sourceFloraObject == null) throw new FlrException("Cannot create Java class " + floraClassName - + ". Null proxy object passed to " - + floraClassName + "(proxy,modulename)"); -proxyFlora.moduleName = moduleName; -proxyFlora.floraClassName = floraClassName; + + ". Null sourceFloraObject object passed to " + + floraClassName + "(sourceFloraObject,moduleName)"); +this.moduleName = moduleName; +sourceFloraObject.floraClassName = floraClassName; return; } public String toString() { -return proxyFlora.toString(); +return sourceFloraObject.toString(); } -public boolean setI_age(Vector value) -{ +public Iterator getI_age(){ Vector pars = new Vector(); -return proxyFlora.set("age",true,pars,value); +return sourceFloraObject.getdata(moduleName,"age",INHERITABLE,pars); } -public boolean setI_age(Object value) -{ +public Iterator getIall_age(){ Vector pars = new Vector(); -return proxyFlora.set("age",true,pars,value); +return sourceFloraObject.getdataAll(moduleName,"age",INHERITABLE,pars); } -public Iterator getI_age(){ +public boolean setI_age(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("age",true,pars); +return sourceFloraObject.setdata(moduleName,"age",INHERITABLE,pars,value); } -public Iterator getAllI_age(){ +public boolean setI_age(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("age",true,pars); +return sourceFloraObject.setdata(moduleName,"age",INHERITABLE,pars,value); } public boolean deleteI_age(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("age",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"age",INHERITABLE,pars,value); } public boolean deleteI_age(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("age",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"age",INHERITABLE,pars,value); } public boolean deleteI_age(){ Vector pars = new Vector(); -return proxyFlora.delete("age",true,pars); +return sourceFloraObject.deletedata(moduleName,"age",INHERITABLE,pars); } -public boolean setI_believes_in(Vector value) -{ +public Iterator getI_believes_in(){ Vector pars = new Vector(); -return proxyFlora.set("believes_in",true,pars,value); +return sourceFloraObject.getdata(moduleName,"believes_in",INHERITABLE,pars); } -public boolean setI_believes_in(Object value) -{ +public Iterator getIall_believes_in(){ Vector pars = new Vector(); -return proxyFlora.set("believes_in",true,pars,value); +return sourceFloraObject.getdataAll(moduleName,"believes_in",INHERITABLE,pars); } -public Iterator getI_believes_in(){ +public boolean setI_believes_in(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("believes_in",true,pars); +return sourceFloraObject.setdata(moduleName,"believes_in",INHERITABLE,pars,value); } -public Iterator getAllI_believes_in(){ +public boolean setI_believes_in(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("believes_in",true,pars); +return sourceFloraObject.setdata(moduleName,"believes_in",INHERITABLE,pars,value); } public boolean deleteI_believes_in(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("believes_in",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"believes_in",INHERITABLE,pars,value); } public boolean deleteI_believes_in(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("believes_in",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"believes_in",INHERITABLE,pars,value); } public boolean deleteI_believes_in(){ Vector pars = new Vector(); -return proxyFlora.delete("believes_in",true,pars); +return sourceFloraObject.deletedata(moduleName,"believes_in",INHERITABLE,pars); } -public boolean setI_hobbies(Vector value) -{ +public Iterator getI_hobbies(){ Vector pars = new Vector(); -return proxyFlora.set("hobbies",true,pars,value); +return sourceFloraObject.getdata(moduleName,"hobbies",INHERITABLE,pars); } -public boolean setI_hobbies(Object value) -{ +public Iterator getIall_hobbies(){ Vector pars = new Vector(); -return proxyFlora.set("hobbies",true,pars,value); +return sourceFloraObject.getdataAll(moduleName,"hobbies",INHERITABLE,pars); } -public Iterator getI_hobbies(){ +public boolean setI_hobbies(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("hobbies",true,pars); +return sourceFloraObject.setdata(moduleName,"hobbies",INHERITABLE,pars,value); } -public Iterator getAllI_hobbies(){ +public boolean setI_hobbies(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("hobbies",true,pars); +return sourceFloraObject.setdata(moduleName,"hobbies",INHERITABLE,pars,value); } public boolean deleteI_hobbies(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("hobbies",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"hobbies",INHERITABLE,pars,value); } public boolean deleteI_hobbies(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("hobbies",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"hobbies",INHERITABLE,pars,value); } public boolean deleteI_hobbies(){ Vector pars = new Vector(); -return proxyFlora.delete("hobbies",true,pars); +return sourceFloraObject.deletedata(moduleName,"hobbies",INHERITABLE,pars); } -public boolean setI_kids(Vector value) -{ +public Iterator getI_kids(){ Vector pars = new Vector(); -return proxyFlora.set("kids",true,pars,value); +return sourceFloraObject.getdata(moduleName,"kids",INHERITABLE,pars); } -public boolean setI_kids(Object value) -{ +public Iterator getIall_kids(){ Vector pars = new Vector(); -return proxyFlora.set("kids",true,pars,value); +return sourceFloraObject.getdataAll(moduleName,"kids",INHERITABLE,pars); } -public Iterator getI_kids(){ +public boolean setI_kids(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("kids",true,pars); +return sourceFloraObject.setdata(moduleName,"kids",INHERITABLE,pars,value); } -public Iterator getAllI_kids(){ +public boolean setI_kids(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("kids",true,pars); +return sourceFloraObject.setdata(moduleName,"kids",INHERITABLE,pars,value); } public boolean deleteI_kids(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("kids",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"kids",INHERITABLE,pars,value); } public boolean deleteI_kids(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("kids",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"kids",INHERITABLE,pars,value); } public boolean deleteI_kids(){ Vector pars = new Vector(); -return proxyFlora.delete("kids",true,pars); +return sourceFloraObject.deletedata(moduleName,"kids",INHERITABLE,pars); } -public boolean setI_salary(Object year,Vector value) -{ +public Iterator getI_salary(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.set("salary",true,pars,value); +return sourceFloraObject.getdata(moduleName,"salary",INHERITABLE,pars); } -public boolean setI_salary(Object year,Object value) -{ +public Iterator getIall_salary(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.set("salary",true,pars,value); +return sourceFloraObject.getdataAll(moduleName,"salary",INHERITABLE,pars); } -public Iterator getI_salary(Object year){ +public boolean setI_salary(Object year,Vector value) +{ Vector pars = new Vector(); pars.add(year); -return proxyFlora.get("salary",true,pars); +return sourceFloraObject.setdata(moduleName,"salary",INHERITABLE,pars,value); } -public Iterator getAllI_salary(){ +public boolean setI_salary(Object year,Object value) +{ Vector pars = new Vector(); -pars.add("Par_year"); -return proxyFlora.getAll("salary",true,pars); +pars.add(year); +return sourceFloraObject.setdata(moduleName,"salary",INHERITABLE,pars,value); } public boolean deleteI_salary(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("salary",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"salary",INHERITABLE,pars,value); } public boolean deleteI_salary(Object year,Object value) { Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("salary",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"salary",INHERITABLE,pars,value); } public boolean deleteI_salary(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("salary",true,pars); +return sourceFloraObject.deletedata(moduleName,"salary",INHERITABLE,pars); } -public boolean setN_age(Vector value) -{ +public Iterator getN_age(){ Vector pars = new Vector(); -return proxyFlora.set("age",false,pars,value); +return sourceFloraObject.getdata(moduleName,"age",NONINHERITABLE,pars); } -public boolean setN_age(Object value) -{ +public Iterator getNall_age(){ Vector pars = new Vector(); -return proxyFlora.set("age",false,pars,value); +return sourceFloraObject.getdataAll(moduleName,"age",NONINHERITABLE,pars); } -public Iterator getN_age(){ +public boolean setN_age(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("age",false,pars); +return sourceFloraObject.setdata(moduleName,"age",NONINHERITABLE,pars,value); } -public Iterator getAllN_age(){ +public boolean setN_age(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("age",false,pars); +return sourceFloraObject.setdata(moduleName,"age",NONINHERITABLE,pars,value); } public boolean deleteN_age(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("age",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"age",NONINHERITABLE,pars,value); } public boolean deleteN_age(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("age",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"age",NONINHERITABLE,pars,value); } public boolean deleteN_age(){ Vector pars = new Vector(); -return proxyFlora.delete("age",false,pars); +return sourceFloraObject.deletedata(moduleName,"age",NONINHERITABLE,pars); } -public boolean setN_believes_in(Vector value) -{ +public Iterator getN_believes_in(){ Vector pars = new Vector(); -return proxyFlora.set("believes_in",false,pars,value); +return sourceFloraObject.getdata(moduleName,"believes_in",NONINHERITABLE,pars); } -public boolean setN_believes_in(Object value) -{ +public Iterator getNall_believes_in(){ Vector pars = new Vector(); -return proxyFlora.set("believes_in",false,pars,value); +return sourceFloraObject.getdataAll(moduleName,"believes_in",NONINHERITABLE,pars); } -public Iterator getN_believes_in(){ +public boolean setN_believes_in(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("believes_in",false,pars); +return sourceFloraObject.setdata(moduleName,"believes_in",NONINHERITABLE,pars,value); } -public Iterator getAllN_believes_in(){ +public boolean setN_believes_in(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("believes_in",false,pars); +return sourceFloraObject.setdata(moduleName,"believes_in",NONINHERITABLE,pars,value); } public boolean deleteN_believes_in(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("believes_in",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"believes_in",NONINHERITABLE,pars,value); } public boolean deleteN_believes_in(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("believes_in",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"believes_in",NONINHERITABLE,pars,value); } public boolean deleteN_believes_in(){ Vector pars = new Vector(); -return proxyFlora.delete("believes_in",false,pars); +return sourceFloraObject.deletedata(moduleName,"believes_in",NONINHERITABLE,pars); } -public boolean setN_hobbies(Vector value) -{ +public Iterator getN_hobbies(){ Vector pars = new Vector(); -return proxyFlora.set("hobbies",false,pars,value); +return sourceFloraObject.getdata(moduleName,"hobbies",NONINHERITABLE,pars); } -public boolean setN_hobbies(Object value) -{ +public Iterator getNall_hobbies(){ Vector pars = new Vector(); -return proxyFlora.set("hobbies",false,pars,value); +return sourceFloraObject.getdataAll(moduleName,"hobbies",NONINHERITABLE,pars); } -public Iterator getN_hobbies(){ +public boolean setN_hobbies(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("hobbies",false,pars); +return sourceFloraObject.setdata(moduleName,"hobbies",NONINHERITABLE,pars,value); } -public Iterator getAllN_hobbies(){ +public boolean setN_hobbies(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("hobbies",false,pars); +return sourceFloraObject.setdata(moduleName,"hobbies",NONINHERITABLE,pars,value); } public boolean deleteN_hobbies(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("hobbies",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"hobbies",NONINHERITABLE,pars,value); } public boolean deleteN_hobbies(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("hobbies",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"hobbies",NONINHERITABLE,pars,value); } public boolean deleteN_hobbies(){ Vector pars = new Vector(); -return proxyFlora.delete("hobbies",false,pars); +return sourceFloraObject.deletedata(moduleName,"hobbies",NONINHERITABLE,pars); } -public boolean setN_instances(Vector value) -{ +public Iterator getN_instances(){ Vector pars = new Vector(); -return proxyFlora.set("instances",false,pars,value); +return sourceFloraObject.getdata(moduleName,"instances",NONINHERITABLE,pars); } -public boolean setN_instances(Object value) -{ +public Iterator getNall_instances(){ Vector pars = new Vector(); -return proxyFlora.set("instances",false,pars,value); +return sourceFloraObject.getdataAll(moduleName,"instances",NONINHERITABLE,pars); } -public Iterator getN_instances(){ +public boolean setN_instances(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("instances",false,pars); +return sourceFloraObject.setdata(moduleName,"instances",NONINHERITABLE,pars,value); } -public Iterator getAllN_instances(){ +public boolean setN_instances(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("instances",false,pars); +return sourceFloraObject.setdata(moduleName,"instances",NONINHERITABLE,pars,value); } public boolean deleteN_instances(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("instances",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"instances",NONINHERITABLE,pars,value); } public boolean deleteN_instances(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("instances",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"instances",NONINHERITABLE,pars,value); } public boolean deleteN_instances(){ Vector pars = new Vector(); -return proxyFlora.delete("instances",false,pars); +return sourceFloraObject.deletedata(moduleName,"instances",NONINHERITABLE,pars); } -public boolean setN_kids(Vector value) -{ +public Iterator getN_kids(){ Vector pars = new Vector(); -return proxyFlora.set("kids",false,pars,value); +return sourceFloraObject.getdata(moduleName,"kids",NONINHERITABLE,pars); } -public boolean setN_kids(Object value) -{ +public Iterator getNall_kids(){ Vector pars = new Vector(); -return proxyFlora.set("kids",false,pars,value); +return sourceFloraObject.getdataAll(moduleName,"kids",NONINHERITABLE,pars); } -public Iterator getN_kids(){ +public boolean setN_kids(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("kids",false,pars); +return sourceFloraObject.setdata(moduleName,"kids",NONINHERITABLE,pars,value); } -public Iterator getAllN_kids(){ +public boolean setN_kids(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("kids",false,pars); +return sourceFloraObject.setdata(moduleName,"kids",NONINHERITABLE,pars,value); } public boolean deleteN_kids(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("kids",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"kids",NONINHERITABLE,pars,value); } public boolean deleteN_kids(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("kids",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"kids",NONINHERITABLE,pars,value); } public boolean deleteN_kids(){ Vector pars = new Vector(); -return proxyFlora.delete("kids",false,pars); +return sourceFloraObject.deletedata(moduleName,"kids",NONINHERITABLE,pars); } -public boolean setN_salary(Object year,Vector value) -{ +public Iterator getN_salary(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.set("salary",false,pars,value); +return sourceFloraObject.getdata(moduleName,"salary",NONINHERITABLE,pars); } -public boolean setN_salary(Object year,Object value) -{ +public Iterator getNall_salary(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.set("salary",false,pars,value); +return sourceFloraObject.getdataAll(moduleName,"salary",NONINHERITABLE,pars); } -public Iterator getN_salary(Object year){ +public boolean setN_salary(Object year,Vector value) +{ Vector pars = new Vector(); pars.add(year); -return proxyFlora.get("salary",false,pars); +return sourceFloraObject.setdata(moduleName,"salary",NONINHERITABLE,pars,value); } -public Iterator getAllN_salary(){ +public boolean setN_salary(Object year,Object value) +{ Vector pars = new Vector(); -pars.add("Par_year"); -return proxyFlora.getAll("salary",false,pars); +pars.add(year); +return sourceFloraObject.setdata(moduleName,"salary",NONINHERITABLE,pars,value); } public boolean deleteN_salary(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("salary",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"salary",NONINHERITABLE,pars,value); } public boolean deleteN_salary(Object year,Object value) { Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("salary",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"salary",NONINHERITABLE,pars,value); } public boolean deleteN_salary(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("salary",false,pars); +return sourceFloraObject.deletedata(moduleName,"salary",NONINHERITABLE,pars); } } Index: flogicbasicsExample.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample/flogicbasicsExample.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- flogicbasicsExample.java 25 May 2006 02:49:48 -0000 1.2 +++ flogicbasicsExample.java 29 May 2006 05:00:49 -0000 1.3 @@ -57,7 +57,7 @@ System.out.println("Person name:"+personObj); currPerson =new person(personObj,"foo_mod"); - Iterator kidsItr = currPerson.getN_kids(); + Iterator kidsItr = currPerson.getDN_kids(); while(kidsItr.hasNext()) { FloraObject kidObj = (FloraObject)(kidsItr.next()); @@ -67,7 +67,7 @@ person kidPerson = null; kidPerson = new person(kidObj,"foo_mod"); - Iterator hobbiesItr = kidPerson.getN_hobbies(); + Iterator hobbiesItr = kidPerson.getDN_hobbies(); while(hobbiesItr.hasNext()) { FloraObject hobbyObj = null; |
|
From: Michael K. <ki...@us...> - 2006-05-29 05:00:52
|
Update of /cvsroot/flora/flora2/java/API/examples/fooExample In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv8039/java/API/examples/fooExample Modified Files: fooExample.java foo.java Log Message: nup of the java interface Index: foo.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/fooExample/foo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- foo.java 25 May 2006 02:49:48 -0000 1.2 +++ foo.java 29 May 2006 05:00:49 -0000 1.3 @@ -2,414 +2,461 @@ import com.declarativa.interprolog.TermModel; import net.sourceforge.flora.javaAPI.util.*; import net.sourceforge.flora.javaAPI.src.*; -public class foo -{ -public FloraObject proxyFlora; -public TermModel floraClassName = new TermModel("foo"); -public foo(FloraObject proxy,String moduleName) { -proxyFlora = proxy; -if (proxy == null) +public class foo extends FloraConstants { +FloraObject sourceFloraObject; +String moduleName; +TermModel floraClassName = new TermModel("foo"); +public foo(FloraObject sourceFloraObject,String moduleName) { +this.sourceFloraObject = sourceFloraObject; +if (sourceFloraObject == null) throw new FlrException("Cannot create Java class " + floraClassName - + ". Null proxy object passed to " - + floraClassName + "(proxy,modulename)"); -proxyFlora.moduleName = moduleName; -proxyFlora.floraClassName = floraClassName; + + ". Null sourceFloraObject object passed to " + + floraClassName + "(sourceFloraObject,moduleName)"); +this.moduleName = moduleName; +sourceFloraObject.floraClassName = floraClassName; return; } public String toString() { -return proxyFlora.toString(); +return sourceFloraObject.toString(); } public boolean getBI_boolean() { Vector pars = new Vector(); -return proxyFlora.getboolean("boolean",true,pars); +return sourceFloraObject.getboolean(moduleName,"boolean",INHERITABLE,pars); +} +public Iterator getBIall_boolean() +{ +Vector pars = new Vector(); +return sourceFloraObject.getbooleanAll(moduleName,"boolean",INHERITABLE,pars); } public boolean setBI_boolean() { Vector pars = new Vector(); -return proxyFlora.setboolean("boolean",true,pars); +return sourceFloraObject.setboolean(moduleName,"boolean",INHERITABLE,pars); } public boolean deleteBI_boolean() { Vector pars = new Vector(); -return proxyFlora.deleteboolean("boolean",true,pars); +return sourceFloraObject.deleteboolean(moduleName,"boolean",INHERITABLE,pars); } public boolean getBI_boolean2() { Vector pars = new Vector(); -return proxyFlora.getboolean("boolean2",true,pars); +return sourceFloraObject.getboolean(moduleName,"boolean2",INHERITABLE,pars); +} +public Iterator getBIall_boolean2() +{ +Vector pars = new Vector(); +return sourceFloraObject.getbooleanAll(moduleName,"boolean2",INHERITABLE,pars); } public boolean setBI_boolean2() { Vector pars = new Vector(); -return proxyFlora.setboolean("boolean2",true,pars); +return sourceFloraObject.setboolean(moduleName,"boolean2",INHERITABLE,pars); } public boolean deleteBI_boolean2() { Vector pars = new Vector(); -return proxyFlora.deleteboolean("boolean2",true,pars); +return sourceFloraObject.deleteboolean(moduleName,"boolean2",INHERITABLE,pars); } public boolean getBN_boolean() { Vector pars = new Vector(); -return proxyFlora.getboolean("boolean",false,pars); +return sourceFloraObject.getboolean(moduleName,"boolean",NONINHERITABLE,pars); +} +public Iterator getBNall_boolean() +{ +Vector pars = new Vector(); +return sourceFloraObject.getbooleanAll(moduleName,"boolean",NONINHERITABLE,pars); } public boolean setBN_boolean() { Vector pars = new Vector(); -return proxyFlora.setboolean("boolean",false,pars); +return sourceFloraObject.setboolean(moduleName,"boolean",NONINHERITABLE,pars); } public boolean deleteBN_boolean() { Vector pars = new Vector(); -return proxyFlora.deleteboolean("boolean",false,pars); +return sourceFloraObject.deleteboolean(moduleName,"boolean",NONINHERITABLE,pars); } public boolean getBN_boolean2() { Vector pars = new Vector(); -return proxyFlora.getboolean("boolean2",false,pars); +return sourceFloraObject.getboolean(moduleName,"boolean2",NONINHERITABLE,pars); +} +public Iterator getBNall_boolean2() +{ +Vector pars = new Vector(); +return sourceFloraObject.getbooleanAll(moduleName,"boolean2",NONINHERITABLE,pars); } public boolean setBN_boolean2() { Vector pars = new Vector(); -return proxyFlora.setboolean("boolean2",false,pars); +return sourceFloraObject.setboolean(moduleName,"boolean2",NONINHERITABLE,pars); } public boolean deleteBN_boolean2() { Vector pars = new Vector(); -return proxyFlora.deleteboolean("boolean2",false,pars); +return sourceFloraObject.deleteboolean(moduleName,"boolean2",NONINHERITABLE,pars); } public boolean getBN_procedural() { Vector pars = new Vector(); -return proxyFlora.getboolean("procedural",false,pars); +return sourceFloraObject.getboolean(moduleName,"procedural",NONINHERITABLE,pars); +} +public Iterator getBNall_procedural() +{ +Vector pars = new Vector(); +return sourceFloraObject.getbooleanAll(moduleName,"procedural",NONINHERITABLE,pars); } public boolean setBN_procedural() { Vector pars = new Vector(); -return proxyFlora.setboolean("procedural",false,pars); +return sourceFloraObject.setboolean(moduleName,"procedural",NONINHERITABLE,pars); } public boolean deleteBN_procedural() { Vector pars = new Vector(); -return proxyFlora.deleteboolean("procedural",false,pars); +return sourceFloraObject.deleteboolean(moduleName,"procedural",NONINHERITABLE,pars); } public boolean getBN_boolean(Object person) { Vector pars = new Vector(); pars.add(person); -return proxyFlora.getboolean("boolean",false,pars); +return sourceFloraObject.getboolean(moduleName,"boolean",NONINHERITABLE,pars); +} +public Iterator getBNall_boolean(Object person) +{ +Vector pars = new Vector(); +pars.add(person); +return sourceFloraObject.getbooleanAll(moduleName,"boolean",NONINHERITABLE,pars); } public boolean setBN_boolean(Object person) { Vector pars = new Vector(); pars.add(person); -return proxyFlora.setboolean("boolean",false,pars); +return sourceFloraObject.setboolean(moduleName,"boolean",NONINHERITABLE,pars); } public boolean deleteBN_boolean(Object person) { Vector pars = new Vector(); pars.add(person); -return proxyFlora.deleteboolean("boolean",false,pars); +return sourceFloraObject.deleteboolean(moduleName,"boolean",NONINHERITABLE,pars); } public boolean getPN_procedural() { Vector pars = new Vector(); -return proxyFlora.getprocedural("procedural",false,pars); +return sourceFloraObject.getprocedural(moduleName,"procedural",NONINHERITABLE,pars); +} +public Iterator getPNall_procedural() +{ +Vector pars = new Vector(); +return sourceFloraObject.getproceduralAll(moduleName,"procedural",NONINHERITABLE,pars); } public boolean setPN_procedural() { Vector pars = new Vector(); -return proxyFlora.setprocedural("procedural",false,pars); +return sourceFloraObject.setprocedural(moduleName,"procedural",NONINHERITABLE,pars); } public boolean deletePN_procedural() { Vector pars = new Vector(); -return proxyFlora.deleteprocedural("procedural",false,pars); +return sourceFloraObject.deleteprocedural(moduleName,"procedural",NONINHERITABLE,pars); } public boolean getPN_procedural2() { Vector pars = new Vector(); -return proxyFlora.getprocedural("procedural2",false,pars); +return sourceFloraObject.getprocedural(moduleName,"procedural2",NONINHERITABLE,pars); +} +public Iterator getPNall_procedural2() +{ +Vector pars = new Vector(); +return sourceFloraObject.getproceduralAll(moduleName,"procedural2",NONINHERITABLE,pars); } public boolean setPN_procedural2() { Vector pars = new Vector(); -return proxyFlora.setprocedural("procedural2",false,pars); +return sourceFloraObject.setprocedural(moduleName,"procedural2",NONINHERITABLE,pars); } public boolean deletePN_procedural2() { Vector pars = new Vector(); -return proxyFlora.deleteprocedural("procedural2",false,pars); +return sourceFloraObject.deleteprocedural(moduleName,"procedural2",NONINHERITABLE,pars); } public boolean getPN_procedural(Object person) { Vector pars = new Vector(); pars.add(person); -return proxyFlora.getprocedural("procedural",false,pars); +return sourceFloraObject.getprocedural(moduleName,"procedural",NONINHERITABLE,pars); +} +public Iterator getPNall_procedural(Object person) +{ +Vector pars = new Vector(); +pars.add(person); +return sourceFloraObject.getproceduralAll(moduleName,"procedural",NONINHERITABLE,pars); } public boolean setPN_procedural(Object person) { Vector pars = new Vector(); pars.add(person); -return proxyFlora.setprocedural("procedural",false,pars); +return sourceFloraObject.setprocedural(moduleName,"procedural",NONINHERITABLE,pars); } public boolean deletePN_procedural(Object person) { Vector pars = new Vector(); pars.add(person); -return proxyFlora.deleteprocedural("procedural",false,pars); +return sourceFloraObject.deleteprocedural(moduleName,"procedural",NONINHERITABLE,pars); } -public boolean setI_ancestors(Vector value) -{ +public Iterator getI_ancestors(){ Vector pars = new Vector(); -return proxyFlora.set("ancestors",true,pars,value); +return sourceFloraObject.getdata(moduleName,"ancestors",INHERITABLE,pars); } -public boolean setI_ancestors(Object value) -{ +public Iterator getIall_ancestors(){ Vector pars = new Vector(); -return proxyFlora.set("ancestors",true,pars,value); +return sourceFloraObject.getdataAll(moduleName,"ancestors",INHERITABLE,pars); } -public Iterator getI_ancestors(){ +public boolean setI_ancestors(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("ancestors",true,pars); +return sourceFloraObject.setdata(moduleName,"ancestors",INHERITABLE,pars,value); } -public Iterator getAllI_ancestors(){ +public boolean setI_ancestors(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("ancestors",true,pars); +return sourceFloraObject.setdata(moduleName,"ancestors",INHERITABLE,pars,value); } public boolean deleteI_ancestors(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("ancestors",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"ancestors",INHERITABLE,pars,value); } public boolean deleteI_ancestors(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("ancestors",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"ancestors",INHERITABLE,pars,value); } public boolean deleteI_ancestors(){ Vector pars = new Vector(); -return proxyFlora.delete("ancestors",true,pars); +return sourceFloraObject.deletedata(moduleName,"ancestors",INHERITABLE,pars); } -public boolean setI_inheritableMeth(Vector value) -{ +public Iterator getI_inheritableMeth(){ Vector pars = new Vector(); -return proxyFlora.set("inheritableMeth",true,pars,value); +return sourceFloraObject.getdata(moduleName,"inheritableMeth",INHERITABLE,pars); } -public boolean setI_inheritableMeth(Object value) -{ +public Iterator getIall_inheritableMeth(){ Vector pars = new Vector(); -return proxyFlora.set("inheritableMeth",true,pars,value); +return sourceFloraObject.getdataAll(moduleName,"inheritableMeth",INHERITABLE,pars); } -public Iterator getI_inheritableMeth(){ +public boolean setI_inheritableMeth(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("inheritableMeth",true,pars); +return sourceFloraObject.setdata(moduleName,"inheritableMeth",INHERITABLE,pars,value); } -public Iterator getAllI_inheritableMeth(){ +public boolean setI_inheritableMeth(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("inheritableMeth",true,pars); +return sourceFloraObject.setdata(moduleName,"inheritableMeth",INHERITABLE,pars,value); } public boolean deleteI_inheritableMeth(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("inheritableMeth",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"inheritableMeth",INHERITABLE,pars,value); } public boolean deleteI_inheritableMeth(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("inheritableMeth",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"inheritableMeth",INHERITABLE,pars,value); } public boolean deleteI_inheritableMeth(){ Vector pars = new Vector(); -return proxyFlora.delete("inheritableMeth",true,pars); +return sourceFloraObject.deletedata(moduleName,"inheritableMeth",INHERITABLE,pars); } -public boolean setI_age(Object year,Vector value) -{ +public Iterator getI_age(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.set("age",true,pars,value); +return sourceFloraObject.getdata(moduleName,"age",INHERITABLE,pars); } -public boolean setI_age(Object year,Object value) -{ +public Iterator getIall_age(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.set("age",true,pars,value); +return sourceFloraObject.getdataAll(moduleName,"age",INHERITABLE,pars); } -public Iterator getI_age(Object year){ +public boolean setI_age(Object year,Vector value) +{ Vector pars = new Vector(); pars.add(year); -return proxyFlora.get("age",true,pars); +return sourceFloraObject.setdata(moduleName,"age",INHERITABLE,pars,value); } -public Iterator getAllI_age(){ +public boolean setI_age(Object year,Object value) +{ Vector pars = new Vector(); -pars.add("Par_year"); -return proxyFlora.getAll("age",true,pars); +pars.add(year); +return sourceFloraObject.setdata(moduleName,"age",INHERITABLE,pars,value); } public boolean deleteI_age(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("age",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"age",INHERITABLE,pars,value); } public boolean deleteI_age(Object year,Object value) { Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("age",true,pars,value); +return sourceFloraObject.deletedata(moduleName,"age",INHERITABLE,pars,value); } public boolean deleteI_age(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("age",true,pars); +return sourceFloraObject.deletedata(moduleName,"age",INHERITABLE,pars); } -public boolean setN_ancestors(Vector value) -{ +public Iterator getN_ancestors(){ Vector pars = new Vector(); -return proxyFlora.set("ancestors",false,pars,value); +return sourceFloraObject.getdata(moduleName,"ancestors",NONINHERITABLE,pars); } -public boolean setN_ancestors(Object value) -{ +public Iterator getNall_ancestors(){ Vector pars = new Vector(); -return proxyFlora.set("ancestors",false,pars,value); +return sourceFloraObject.getdataAll(moduleName,"ancestors",NONINHERITABLE,pars); } -public Iterator getN_ancestors(){ +public boolean setN_ancestors(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("ancestors",false,pars); +return sourceFloraObject.setdata(moduleName,"ancestors",NONINHERITABLE,pars,value); } -public Iterator getAllN_ancestors(){ +public boolean setN_ancestors(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("ancestors",false,pars); +return sourceFloraObject.setdata(moduleName,"ancestors",NONINHERITABLE,pars,value); } public boolean deleteN_ancestors(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("ancestors",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"ancestors",NONINHERITABLE,pars,value); } public boolean deleteN_ancestors(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("ancestors",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"ancestors",NONINHERITABLE,pars,value); } public boolean deleteN_ancestors(){ Vector pars = new Vector(); -return proxyFlora.delete("ancestors",false,pars); +return sourceFloraObject.deletedata(moduleName,"ancestors",NONINHERITABLE,pars); } -public boolean setN_inheritableMeth(Vector value) -{ +public Iterator getN_inheritableMeth(){ Vector pars = new Vector(); -return proxyFlora.set("inheritableMeth",false,pars,value); +return sourceFloraObject.getdata(moduleName,"inheritableMeth",NONINHERITABLE,pars); } -public boolean setN_inheritableMeth(Object value) -{ +public Iterator getNall_inheritableMeth(){ Vector pars = new Vector(); -return proxyFlora.set("inheritableMeth",false,pars,value); +return sourceFloraObject.getdataAll(moduleName,"inheritableMeth",NONINHERITABLE,pars); } -public Iterator getN_inheritableMeth(){ +public boolean setN_inheritableMeth(Vector value) +{ Vector pars = new Vector(); -return proxyFlora.get("inheritableMeth",false,pars); +return sourceFloraObject.setdata(moduleName,"inheritableMeth",NONINHERITABLE,pars,value); } -public Iterator getAllN_inheritableMeth(){ +public boolean setN_inheritableMeth(Object value) +{ Vector pars = new Vector(); -return proxyFlora.getAll("inheritableMeth",false,pars); +return sourceFloraObject.setdata(moduleName,"inheritableMeth",NONINHERITABLE,pars,value); } public boolean deleteN_inheritableMeth(Vector value) { Vector pars = new Vector(); -return proxyFlora.delete("inheritableMeth",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"inheritableMeth",NONINHERITABLE,pars,value); } public boolean deleteN_inheritableMeth(Object value) { Vector pars = new Vector(); -return proxyFlora.delete("inheritableMeth",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"inheritableMeth",NONINHERITABLE,pars,value); } public boolean deleteN_inheritableMeth(){ Vector pars = new Vector(); -return proxyFlora.delete("inheritableMeth",false,pars); +return sourceFloraObject.deletedata(moduleName,"inheritableMeth",NONINHERITABLE,pars); } -public boolean setN_age(Object year,Vector value) -{ +public Iterator getN_age(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.set("age",false,pars,value); +return sourceFloraObject.getdata(moduleName,"age",NONINHERITABLE,pars); } -public boolean setN_age(Object year,Object value) -{ +public Iterator getNall_age(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.set("age",false,pars,value); +return sourceFloraObject.getdataAll(moduleName,"age",NONINHERITABLE,pars); } -public Iterator getN_age(Object year){ +public boolean setN_age(Object year,Vector value) +{ Vector pars = new Vector(); pars.add(year); -return proxyFlora.get("age",false,pars); +return sourceFloraObject.setdata(moduleName,"age",NONINHERITABLE,pars,value); } -public Iterator getAllN_age(){ +public boolean setN_age(Object year,Object value) +{ Vector pars = new Vector(); -pars.add("Par_year"); -return proxyFlora.getAll("age",false,pars); +pars.add(year); +return sourceFloraObject.setdata(moduleName,"age",NONINHERITABLE,pars,value); } public boolean deleteN_age(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("age",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"age",NONINHERITABLE,pars,value); } public boolean deleteN_age(Object year,Object value) { Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("age",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"age",NONINHERITABLE,pars,value); } public boolean deleteN_age(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.delete("age",false,pars); +return sourceFloraObject.deletedata(moduleName,"age",NONINHERITABLE,pars); } -public boolean setN_bonus(Object year, Object month,Vector value) -{ +public Iterator getN_bonus(Object year, Object month){ Vector pars = new Vector(); pars.add(year); pars.add(month); -return proxyFlora.set("bonus",false,pars,value); +return sourceFloraObject.getdata(moduleName,"bonus",NONINHERITABLE,pars); } -public boolean setN_bonus(Object year, Object month,Object value) -{ +public Iterator getNall_bonus(Object year, Object month){ Vector pars = new Vector(); pars.add(year); pars.add(month); -return proxyFlora.set("bonus",false,pars,value); +return sourceFloraObject.getdataAll(moduleName,"bonus",NONINHERITABLE,pars); } -public Iterator getN_bonus(Object year, Object month){ +public boolean setN_bonus(Object year, Object month,Vector value) +{ Vector pars = new Vector(); pars.add(year); pars.add(month); -return proxyFlora.get("bonus",false,pars); +return sourceFloraObject.setdata(moduleName,"bonus",NONINHERITABLE,pars,value); } -public Iterator getAllN_bonus(){ +public boolean setN_bonus(Object year, Object month,Object value) +{ Vector pars = new Vector(); -pars.add("Par_year"); -pars.add("Par_month"); -return proxyFlora.getAll("bonus",false,pars); +pars.add(year); +pars.add(month); +return sourceFloraObject.setdata(moduleName,"bonus",NONINHERITABLE,pars,value); } public boolean deleteN_bonus(Object year, Object month,Vector value) { Vector pars = new Vector(); pars.add(year); pars.add(month); -return proxyFlora.delete("bonus",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"bonus",NONINHERITABLE,pars,value); } public boolean deleteN_bonus(Object year, Object month,Object value) { Vector pars = new Vector(); pars.add(year); pars.add(month); -return proxyFlora.delete("bonus",false,pars,value); +return sourceFloraObject.deletedata(moduleName,"bonus",NONINHERITABLE,pars,value); } public boolean deleteN_bonus(Object year, Object month){ Vector pars = new Vector(); pars.add(year); pars.add(month); -return proxyFlora.delete("bonus",false,pars); +return sourceFloraObject.deletedata(moduleName,"bonus",NONINHERITABLE,pars); } } Index: fooExample.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/fooExample/fooExample.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- fooExample.java 25 May 2006 02:49:48 -0000 1.2 +++ fooExample.java 29 May 2006 05:00:49 -0000 1.3 @@ -82,11 +82,11 @@ System.out.println("procedural2 is false"); - objJohn.setN_bonus("2004","Jan","5000"); + objJohn.setDN_bonus("2004","Jan","5000"); System.out.println("Set John's bonus"); - objJohn.setN_age("2004","50"); + objJohn.setDN_age("2004","50"); System.out.println("Set John's age"); - Iterator ageValues = objJohn.getN_age("2004"); + Iterator ageValues = objJohn.getDN_age("2004"); while (ageValues.hasNext()) { System.out.println("John's age:"+ageValues.next()); } @@ -95,12 +95,12 @@ ancestors.add("mary"); ancestors.add("sally"); - objJohn.setN_ancestors(ancestors); + objJohn.setDN_ancestors(ancestors); System.out.println("John obj:"+objJohn); /* To show the use of ExecuteQuery/2 */ - objJohn.setN_ancestors(ancestors); + objJohn.setDN_ancestors(ancestors); System.out.println("John obj:"+objJohn); Vector vars = new Vector(); |
|
From: Michael K. <ki...@us...> - 2006-05-29 04:59:37
|
Update of /cvsroot/flora/flora2/syslib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv7426/syslib Modified Files: flrtruthvalue.P Log Message: fix the bug with true{}, unknown{}, etc primitives. Index: flrtruthvalue.P =================================================================== RCS file: /cvsroot/flora/flora2/syslib/flrtruthvalue.P,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- flrtruthvalue.P 19 Apr 2005 09:37:19 -0000 1.4 +++ flrtruthvalue.P 29 May 2006 04:59:28 -0000 1.5 @@ -46,17 +46,26 @@ (flora_truthvalue_tabled_call(Goal), fail ; convert_to_head_literal(Goal,HGoal), - get_residual(flora_truthvalue_tabled_call(HGoal),[]) + get_residual(HGoal,[]) ), flora_abolish_table_call(flora_truthvalue_tabled_call(_)). FLLIBTRUTHVALUE(Goal,FL_UNKNOWN) :- (flora_truthvalue_tabled_call(Goal), fail ; convert_to_head_literal(Goal,HGoal), - get_residual(flora_truthvalue_tabled_call(HGoal),[_|_]) + get_residual(HGoal,[_|_]) ), flora_abolish_table_call(flora_truthvalue_tabled_call(_)). -FLLIBTRUTHVALUE(Goal,FL_FALSE) :- flora_tnot(Goal). -FLLIBTRUTHVALUE(Goal,FL_FAIL) :- flora_tnot(Goal). +FLLIBTRUTHVALUE(Goal,FL_FALSE) :- + (flora_truthvalue_tabled_call(Goal), fail + ; + convert_to_head_literal(Goal,HGoal), + (get_residual(HGoal,[_|_]) -> fail + ; + flora_tnot(Goal) + ) + ), + flora_abolish_table_call(flora_truthvalue_tabled_call(_)). +FLLIBTRUTHVALUE(Goal,FL_FAIL) :- FLLIBTRUTHVALUE(Goal,FL_FALSE). flora_truthvalue_tabled_call(Call) :- call(Call). |
|
From: Michael K. <ki...@us...> - 2006-05-25 02:49:52
|
Update of /cvsroot/flora/flora2/docs In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2341/docs Modified Files: flora2.tex flora-flrjava.tex Log Message: more or less finished with java API Index: flora-flrjava.tex =================================================================== RCS file: /cvsroot/flora/flora2/docs/flora-flrjava.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- flora-flrjava.tex 24 May 2006 20:23:56 -0000 1.6 +++ flora-flrjava.tex 25 May 2006 02:49:48 -0000 1.7 @@ -181,7 +181,7 @@ System.out.println("Person name:"+personObj); person currPerson =new person(personObj,"basic_mod"); - Iterator kidsItr = currPerson.get_kids(); + Iterator kidsItr = currPerson.getN_kids(); while(kidsItr.hasNext()) { Object kidObj = kidsItr.next(); @@ -190,7 +190,7 @@ person kidPerson = null; kidPerson = new person(kidObj,"basic_mod"); - Iterator hobbiesItr = kidPerson.get_hobbies(); + Iterator hobbiesItr = kidPerson.getN_hobbies(); while(hobbiesItr.hasNext()) { Object hobbyObj = hobbiesItr.next(); System.out.println("Kid:"+kidObj + " has hobby: " + hobbyObj); @@ -247,68 +247,101 @@ will have the following methods: %% \begin{enumerate} -\item {\tt public Iterator get\_foobar()} +\item {\tt public Iterator getI\_foobar()}\\ + {\tt public Iterator getN\_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}. -\item {\tt public void set\_foobar(Vector value)} + The {\tt getN} form queries non-inheritable methods and {\tt getI} + inheritable. +\item {\tt public boolean setI\_foobar(Vector value)}\\ + {\tt public boolean setN\_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. -\item {\tt public void set\_foobar(Object value)} + Again, {\tt setN} sets non-inheritable methods and {\tt setI} + inheritable. +\item {\tt public boolean setI\_foobar(Object value)}\\ + {\tt public boolean setN\_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 void delete\_foobar(Vector value)} +\item {\tt public boolean deleteI\_foobar(Vector value)}\\ + {\tt public boolean deleteN\_foobar(Vector value)} \\ Delete a set of values of the attribute {\tt foobar} as specified in the vector argument. -\item {\tt public void delete\_foobar(Object value)} +\item {\tt public boolean deleteI\_foobar(Object value)}\\ + {\tt public boolean deleteN\_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 void delete\_foobar()} +\item {\tt public boolean deleteI\_foobar()}\\ + {\tt public boolean deleteN\_foobar()} \\ Delete all values of the attribute {\tt foobar}. \end{enumerate} %% -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}. +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 getI\_*}, {\tt setI\_*}, +etc., forms of the Java methods are for dealing with inheritable \FLORA +methods and the {\tt getN\_*}, {\tt setN\_*}, +etc., forms are for dealing with non-inheritable \FLORA methods. + %% \begin{enumerate} -\item {\tt public Iterator get\_foobar2(Object arg1, Object arg2)} +\item {\tt public Iterator getI\_foobar2(Object arg1, Object arg2)}\\ + {\tt public Iterator getN\_foobar2(Object arg1, Object arg2)} \\ Obtain all values for the \fl method invocation {\tt foobar2(arg1,arg2)}. -\item {\tt public void set\_foobar2(Object arg1, Object arg2, Vector value)} +\item {\tt public boolean setI\_foobar2(Object arg1, Object arg2, Vector value)}\\ + {\tt public boolean setN\_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 void set\_foobar2(Object arg1, Object arg2, Object value)} +\item {\tt public boolean setI\_foobar2(Object arg1, Object arg2, Object value)}\\ + {\tt public boolean setN\_foobar2(Object arg1, Object arg2, Object value)} \\ A simplified interface when only one value is to be added. -\item {\tt public void delete\_foobar2(Object arg1, Object arg2, Vector value)} +\item {\tt public boolean deleteI\_foobar2(Object arg1, Object arg2, Vector value)}\\ + {\tt public boolean deleteN\_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 void delete\_foobar2(Object arg1, Object arg2, Object value)} +\item {\tt public boolean deleteI\_foobar2(Object arg1, Object arg2, Object value)}\\ + {\tt public boolean deleteN\_foobar2(Object arg1, Object arg2, Object value)} \\ A simplified interface for deleting a single value. -\item {\tt public void delete\_foobar2(Object arg1, Object arg2)} +\item {\tt public boolean deleteI\_foobar2(Object arg1, Object arg2)}\\ + {\tt public boolean deleteN\_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. For instance, +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. +For instance, %% \begin{enumerate} -\item {\tt public boolean get\_foobar3()} -\item {\tt public void set\_foobar3()} -\item {\tt public void delete\_foobar3()} +\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()} \end{enumerate} %% All these methods are generated automatically by executing the following @@ -370,30 +403,54 @@ public FloraObject proxyFlora; public person(FloraObject proxy,String moduleName) { ... } - public void set_age(Object value) { ... } - public Iterator get_age(){ ... } - public void delete_age(Object value) { ... } - public void delete_age() { ... } - public void set_salary(Object year,Object value) { ... } - public Iterator get_salary(Object year) { ... } - public void delete_salary(Object year,Object value) { ... } - public void delete_salary(Object year) { ... } - public void set_hobbies(Vector value) { ... } - public Iterator get_hobbies(){ ... } - public void delete_hobbies(Vector value) { ... } - public void delete_hobbies(){ ... } - public void set_instances(Vector value) { ... } - public Iterator get_instances(){ ... } - public void delete_instances(Vector value) { ... } - public void delete_instances(){ ... } - public void set_kids(Vector value) { ... } - public Iterator get_kids(){ ... } - public void delete_kids(Vector value) { ... } - public void delete_kids(){ ... } - public void set_believes_in(Vector value) { ... } - public Iterator get_believes_in(){ ... } - public void delete_believes_in(Vector value) { ... } - public void delete_believes_in(){ ... } + public boolean setI_age(Object value) { ... } + public boolean setN_age(Object value) { ... } + public Iterator getI_age(){ ... } + public Iterator getN_age(){ ... } + public boolean deleteI_age(Object value) { ... } + public boolean deleteN_age(Object value) { ... } + public boolean deleteI_age() { ... } + public boolean deleteN_age() { ... } + public boolean setI_salary(Object year,Object value) { ... } + public boolean setN_salary(Object year,Object value) { ... } + public Iterator getI_salary(Object year) { ... } + public Iterator getN_salary(Object year) { ... } + public boolean deleteI_salary(Object year,Object value) { ... } + public boolean deleteN_salary(Object year,Object value) { ... } + public boolean deleteI_salary(Object year) { ... } + public boolean deleteN_salary(Object year) { ... } + public boolean setI_hobbies(Vector value) { ... } + public boolean setN_hobbies(Vector value) { ... } + public Iterator getI_hobbies(){ ... } + public Iterator getN_hobbies(){ ... } + public boolean deleteI_hobbies(Vector value) { ... } + public boolean deleteN_hobbies(Vector value) { ... } + public boolean deleteI_hobbies(){ ... } + public boolean deleteN_hobbies(){ ... } + public boolean setI_instances(Vector value) { ... } + public boolean setN_instances(Vector value) { ... } + public Iterator getI_instances(){ ... } + public Iterator getN_instances(){ ... } + public boolean deleteI_instances(Vector value) { ... } + public boolean deleteN_instances(Vector value) { ... } + public boolean deleteI_instances(){ ... } + public boolean deleteN_instances(){ ... } + public boolean setI_kids(Vector value) { ... } + public boolean setN_kids(Vector value) { ... } + public Iterator getI_kids(){ ... } + public Iterator getN_kids(){ ... } + public boolean deleteI_kids(Vector value) { ... } + public boolean deleteN_kids(Vector value) { ... } + public boolean deleteI_kids(){ ... } + public boolean deleteN_kids(){ ... } + public boolean setI_believes_in(Vector value) { ... } + public boolean setN_believes_in(Vector value) { ... } + public Iterator getI_believes_in(){ ... } + public Iterator getN_believes_in(){ ... } + public boolean deleteI_believes_in(Vector value) { ... } + public boolean deleteN_believes_in(Vector value) { ... } + public boolean deleteI_believes_in(){ ... } + public boolean deleteN_believes_in(){ ... } } \end{verbatim} \end{quote} @@ -443,10 +500,10 @@ currPerson =new person(personObj,"basic_mod"); /* Set that person's age to 50 */ - currPerson.set_age("50"); + currPerson.setN_age("50"); /* Get this person's kids */ - Iterator kidsItr = currPerson.get_kids(); + Iterator kidsItr = currPerson.getN_kids(); while (kidsItr.hasNext()) { FloraObject kidObj = (FloraObject)(kidsItr.next()); System.out.println("Person: " + personObj + " has kid: " +kidObj); @@ -456,7 +513,7 @@ kidPerson = new person(kidObj,"basic_mod"); /* Get kidPerson's hobbies */ - Iterator hobbiesItr = kidPerson.get_hobbies(); + Iterator hobbiesItr = kidPerson.getN_hobbies(); while(hobbiesItr.hasNext()) { FloraObject hobbyObj = (FloraObject)(hobbiesItr.next()); System.out.println("Kid:"+kidObj + " has hobby:" +hobbyObj); Index: flora2.tex =================================================================== RCS file: /cvsroot/flora/flora2/docs/flora2.tex,v retrieving revision 1.154 retrieving revision 1.155 diff -u -d -r1.154 -r1.155 --- flora2.tex 23 May 2006 17:19:23 -0000 1.154 +++ flora2.tex 25 May 2006 02:49:48 -0000 1.155 @@ -3689,7 +3689,7 @@ {\tt ->}, {\tt *->}, {\tt =>}, {\tt *=>}, {\tt +>>}, {\tt *+>>}, {\tt ->->}, {\tt *->->}, {\tt :}, {\tt ::}, {\tt boolean} (tabled Boolean methods), {\tt *boolean} (inheritable tabled Boolean methods), {\tt - \%boolean} (transactional, nontabled Boolean methods), {\tt :=:}, {\tt + \%boolean} (procedural, nontabled Boolean methods), {\tt :=:}, {\tt []} (empty molecules, such as {\tt a[]}). Here is a number of examples that illustrate the use of {\tt =..} for decomposition of F-logic molecules: %% |
|
From: Michael K. <ki...@us...> - 2006-05-25 02:49:51
|
Update of /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2341/java/API/examples/flogicbasicsExample Modified Files: person.java flogicbasicsExample.java Log Message: more or less finished with java API Index: person.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample/person.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- person.java 24 May 2006 20:33:55 -0000 1.1 +++ person.java 25 May 2006 02:49:48 -0000 1.2 @@ -19,203 +19,370 @@ public String toString() { return proxyFlora.toString(); } -public void set_instances(Vector value) +public boolean setI_age(Vector value) { Vector pars = new Vector(); -proxyFlora.set("instances",false,pars,value); +return proxyFlora.set("age",true,pars,value); } -public void set_instances(Object value) +public boolean setI_age(Object value) { Vector pars = new Vector(); -proxyFlora.set("instances",false,pars,value); +return proxyFlora.set("age",true,pars,value); } -public Iterator get_instances(){ +public Iterator getI_age(){ Vector pars = new Vector(); -return proxyFlora.get("instances",false,pars); +return proxyFlora.get("age",true,pars); } -public Iterator getAll_instances(){ +public Iterator getAllI_age(){ Vector pars = new Vector(); -return proxyFlora.getAll("instances",false,pars); +return proxyFlora.getAll("age",true,pars); } -public void delete_instances(Vector value) +public boolean deleteI_age(Vector value) { Vector pars = new Vector(); -proxyFlora.delete("instances",false,pars,value); +return proxyFlora.delete("age",true,pars,value); } -public void delete_instances(Object value) +public boolean deleteI_age(Object value) { Vector pars = new Vector(); -proxyFlora.delete("instances",false,pars,value); +return proxyFlora.delete("age",true,pars,value); } -public void delete_instances(){ +public boolean deleteI_age(){ Vector pars = new Vector(); -proxyFlora.delete("instances",false,pars); +return proxyFlora.delete("age",true,pars); } -public void set_age(Vector value) +public boolean setI_believes_in(Vector value) { Vector pars = new Vector(); -proxyFlora.set("age",true,pars,value); +return proxyFlora.set("believes_in",true,pars,value); } -public void set_age(Object value) +public boolean setI_believes_in(Object value) { Vector pars = new Vector(); -proxyFlora.set("age",true,pars,value); +return proxyFlora.set("believes_in",true,pars,value); } -public Iterator get_age(){ +public Iterator getI_believes_in(){ Vector pars = new Vector(); -return proxyFlora.get("age",true,pars); +return proxyFlora.get("believes_in",true,pars); } -public Iterator getAll_age(){ +public Iterator getAllI_believes_in(){ Vector pars = new Vector(); -return proxyFlora.getAll("age",true,pars); +return proxyFlora.getAll("believes_in",true,pars); } -public void delete_age(Vector value) +public boolean deleteI_believes_in(Vector value) { Vector pars = new Vector(); -proxyFlora.delete("age",true,pars,value); +return proxyFlora.delete("believes_in",true,pars,value); } -public void delete_age(Object value) +public boolean deleteI_believes_in(Object value) { Vector pars = new Vector(); -proxyFlora.delete("age",true,pars,value); +return proxyFlora.delete("believes_in",true,pars,value); } -public void delete_age(){ +public boolean deleteI_believes_in(){ Vector pars = new Vector(); -proxyFlora.delete("age",true,pars); +return proxyFlora.delete("believes_in",true,pars); } -public void set_believes_in(Vector value) +public boolean setI_hobbies(Vector value) { Vector pars = new Vector(); -proxyFlora.set("believes_in",true,pars,value); +return proxyFlora.set("hobbies",true,pars,value); } -public void set_believes_in(Object value) +public boolean setI_hobbies(Object value) { Vector pars = new Vector(); -proxyFlora.set("believes_in",true,pars,value); +return proxyFlora.set("hobbies",true,pars,value); } -public Iterator get_believes_in(){ +public Iterator getI_hobbies(){ Vector pars = new Vector(); -return proxyFlora.get("believes_in",true,pars); +return proxyFlora.get("hobbies",true,pars); } -public Iterator getAll_believes_in(){ +public Iterator getAllI_hobbies(){ Vector pars = new Vector(); -return proxyFlora.getAll("believes_in",true,pars); +return proxyFlora.getAll("hobbies",true,pars); } -public void delete_believes_in(Vector value) +public boolean deleteI_hobbies(Vector value) { Vector pars = new Vector(); -proxyFlora.delete("believes_in",true,pars,value); +return proxyFlora.delete("hobbies",true,pars,value); } -public void delete_believes_in(Object value) +public boolean deleteI_hobbies(Object value) { Vector pars = new Vector(); -proxyFlora.delete("believes_in",true,pars,value); +return proxyFlora.delete("hobbies",true,pars,value); } -public void delete_believes_in(){ +public boolean deleteI_hobbies(){ Vector pars = new Vector(); -proxyFlora.delete("believes_in",true,pars); +return proxyFlora.delete("hobbies",true,pars); } -public void set_hobbies(Vector value) +public boolean setI_kids(Vector value) { Vector pars = new Vector(); -proxyFlora.set("hobbies",true,pars,value); +return proxyFlora.set("kids",true,pars,value); } -public void set_hobbies(Object value) +public boolean setI_kids(Object value) { Vector pars = new Vector(); -proxyFlora.set("hobbies",true,pars,value); +return proxyFlora.set("kids",true,pars,value); } -public Iterator get_hobbies(){ +public Iterator getI_kids(){ Vector pars = new Vector(); -return proxyFlora.get("hobbies",true,pars); +return proxyFlora.get("kids",true,pars); } -public Iterator getAll_hobbies(){ +public Iterator getAllI_kids(){ Vector pars = new Vector(); -return proxyFlora.getAll("hobbies",true,pars); +return proxyFlora.getAll("kids",true,pars); } -public void delete_hobbies(Vector value) +public boolean deleteI_kids(Vector value) { Vector pars = new Vector(); -proxyFlora.delete("hobbies",true,pars,value); +return proxyFlora.delete("kids",true,pars,value); } -public void delete_hobbies(Object value) +public boolean deleteI_kids(Object value) { Vector pars = new Vector(); -proxyFlora.delete("hobbies",true,pars,value); +return proxyFlora.delete("kids",true,pars,value); } -public void delete_hobbies(){ +public boolean deleteI_kids(){ Vector pars = new Vector(); -proxyFlora.delete("hobbies",true,pars); +return proxyFlora.delete("kids",true,pars); } -public void set_kids(Vector value) +public boolean setI_salary(Object year,Vector value) { Vector pars = new Vector(); -proxyFlora.set("kids",true,pars,value); +pars.add(year); +return proxyFlora.set("salary",true,pars,value); } -public void set_kids(Object value) +public boolean setI_salary(Object year,Object value) { Vector pars = new Vector(); -proxyFlora.set("kids",true,pars,value); +pars.add(year); +return proxyFlora.set("salary",true,pars,value); } -public Iterator get_kids(){ +public Iterator getI_salary(Object year){ Vector pars = new Vector(); -return proxyFlora.get("kids",true,pars); +pars.add(year); +return proxyFlora.get("salary",true,pars); } -public Iterator getAll_kids(){ +public Iterator getAllI_salary(){ Vector pars = new Vector(); -return proxyFlora.getAll("kids",true,pars); +pars.add("Par_year"); +return proxyFlora.getAll("salary",true,pars); } -public void delete_kids(Vector value) +public boolean deleteI_salary(Object year,Vector value) { Vector pars = new Vector(); -proxyFlora.delete("kids",true,pars,value); +pars.add(year); +return proxyFlora.delete("salary",true,pars,value); } -public void delete_kids(Object value) +public boolean deleteI_salary(Object year,Object value) { Vector pars = new Vector(); -proxyFlora.delete("kids",true,pars,value); +pars.add(year); +return proxyFlora.delete("salary",true,pars,value); } -public void delete_kids(){ +public boolean deleteI_salary(Object year){ Vector pars = new Vector(); -proxyFlora.delete("kids",true,pars); +pars.add(year); +return proxyFlora.delete("salary",true,pars); } -public void set_salary(Object year,Vector value) +public boolean setN_age(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.set("age",false,pars,value); +} +public boolean setN_age(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.set("age",false,pars,value); +} +public Iterator getN_age(){ +Vector pars = new Vector(); +return proxyFlora.get("age",false,pars); +} +public Iterator getAllN_age(){ +Vector pars = new Vector(); +return proxyFlora.getAll("age",false,pars); +} +public boolean deleteN_age(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("age",false,pars,value); +} +public boolean deleteN_age(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("age",false,pars,value); +} +public boolean deleteN_age(){ +Vector pars = new Vector(); +return proxyFlora.delete("age",false,pars); +} +public boolean setN_believes_in(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.set("believes_in",false,pars,value); +} +public boolean setN_believes_in(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.set("believes_in",false,pars,value); +} +public Iterator getN_believes_in(){ +Vector pars = new Vector(); +return proxyFlora.get("believes_in",false,pars); +} +public Iterator getAllN_believes_in(){ +Vector pars = new Vector(); +return proxyFlora.getAll("believes_in",false,pars); +} +public boolean deleteN_believes_in(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("believes_in",false,pars,value); +} +public boolean deleteN_believes_in(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("believes_in",false,pars,value); +} +public boolean deleteN_believes_in(){ +Vector pars = new Vector(); +return proxyFlora.delete("believes_in",false,pars); +} +public boolean setN_hobbies(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.set("hobbies",false,pars,value); +} +public boolean setN_hobbies(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.set("hobbies",false,pars,value); +} +public Iterator getN_hobbies(){ +Vector pars = new Vector(); +return proxyFlora.get("hobbies",false,pars); +} +public Iterator getAllN_hobbies(){ +Vector pars = new Vector(); +return proxyFlora.getAll("hobbies",false,pars); +} +public boolean deleteN_hobbies(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("hobbies",false,pars,value); +} +public boolean deleteN_hobbies(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("hobbies",false,pars,value); +} +public boolean deleteN_hobbies(){ +Vector pars = new Vector(); +return proxyFlora.delete("hobbies",false,pars); +} +public boolean setN_instances(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.set("instances",false,pars,value); +} +public boolean setN_instances(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.set("instances",false,pars,value); +} +public Iterator getN_instances(){ +Vector pars = new Vector(); +return proxyFlora.get("instances",false,pars); +} +public Iterator getAllN_instances(){ +Vector pars = new Vector(); +return proxyFlora.getAll("instances",false,pars); +} +public boolean deleteN_instances(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("instances",false,pars,value); +} +public boolean deleteN_instances(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("instances",false,pars,value); +} +public boolean deleteN_instances(){ +Vector pars = new Vector(); +return proxyFlora.delete("instances",false,pars); +} +public boolean setN_kids(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.set("kids",false,pars,value); +} +public boolean setN_kids(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.set("kids",false,pars,value); +} +public Iterator getN_kids(){ +Vector pars = new Vector(); +return proxyFlora.get("kids",false,pars); +} +public Iterator getAllN_kids(){ +Vector pars = new Vector(); +return proxyFlora.getAll("kids",false,pars); +} +public boolean deleteN_kids(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("kids",false,pars,value); +} +public boolean deleteN_kids(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("kids",false,pars,value); +} +public boolean deleteN_kids(){ +Vector pars = new Vector(); +return proxyFlora.delete("kids",false,pars); +} +public boolean setN_salary(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); -proxyFlora.set("salary",true,pars,value); +return proxyFlora.set("salary",false,pars,value); } -public void set_salary(Object year,Object value) +public boolean setN_salary(Object year,Object value) { Vector pars = new Vector(); pars.add(year); -proxyFlora.set("salary",true,pars,value); +return proxyFlora.set("salary",false,pars,value); } -public Iterator get_salary(Object year){ +public Iterator getN_salary(Object year){ Vector pars = new Vector(); pars.add(year); -return proxyFlora.get("salary",true,pars); +return proxyFlora.get("salary",false,pars); } -public Iterator getAll_salary(){ +public Iterator getAllN_salary(){ Vector pars = new Vector(); pars.add("Par_year"); -return proxyFlora.getAll("salary",true,pars); +return proxyFlora.getAll("salary",false,pars); } -public void delete_salary(Object year,Vector value) +public boolean deleteN_salary(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); -proxyFlora.delete("salary",true,pars,value); +return proxyFlora.delete("salary",false,pars,value); } -public void delete_salary(Object year,Object value) +public boolean deleteN_salary(Object year,Object value) { Vector pars = new Vector(); pars.add(year); -proxyFlora.delete("salary",true,pars,value); +return proxyFlora.delete("salary",false,pars,value); } -public void delete_salary(Object year){ +public boolean deleteN_salary(Object year){ Vector pars = new Vector(); pars.add(year); -proxyFlora.delete("salary",true,pars); +return proxyFlora.delete("salary",false,pars); } } Index: flogicbasicsExample.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample/flogicbasicsExample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- flogicbasicsExample.java 24 May 2006 20:33:55 -0000 1.1 +++ flogicbasicsExample.java 25 May 2006 02:49:48 -0000 1.2 @@ -57,7 +57,7 @@ System.out.println("Person name:"+personObj); currPerson =new person(personObj,"foo_mod"); - Iterator kidsItr = currPerson.get_kids(); + Iterator kidsItr = currPerson.getN_kids(); while(kidsItr.hasNext()) { FloraObject kidObj = (FloraObject)(kidsItr.next()); @@ -67,7 +67,7 @@ person kidPerson = null; kidPerson = new person(kidObj,"foo_mod"); - Iterator hobbiesItr = kidPerson.get_hobbies(); + Iterator hobbiesItr = kidPerson.getN_hobbies(); while(hobbiesItr.hasNext()) { FloraObject hobbyObj = null; |
|
From: Michael K. <ki...@us...> - 2006-05-25 02:49:51
|
Update of /cvsroot/flora/flora2/java/API/examples/fooExample In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2341/java/API/examples/fooExample Modified Files: fooExample.java foo.java foo.flr Log Message: more or less finished with java API Index: foo.flr =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/fooExample/foo.flr,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- foo.flr 24 May 2006 20:33:55 -0000 1.1 +++ foo.flr 25 May 2006 02:49:48 -0000 1.2 @@ -2,19 +2,23 @@ foo::foo_parent2. foo[age(year)=>number]. +foo[age(year)*=>number]. foo[bonus(year,month)=>number]. foo[ancestors*=>parents]. foo[ancestors*->{adam, eve}]. foo[inheritableMeth*=>string]. foo[inheritableMeth*->something]. -foo[=> boolean]. +foo[*=> boolean]. +foo[=> boolean(person)]. foo[=> boolean2]. foo[=> %procedural]. +foo[=> %procedural(person)]. foo[=> %procedural2]. foo[*=> boolean]. foo[*=> boolean2]. foo[*=> %procedural]. -foo[*=> %procedural2]. +foo[=> procedural]. +foo[=> %procedural2]. foo[*boolean]. Index: foo.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/fooExample/foo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- foo.java 24 May 2006 20:33:55 -0000 1.1 +++ foo.java 25 May 2006 02:49:48 -0000 1.2 @@ -19,209 +19,397 @@ public String toString() { return proxyFlora.toString(); } -public boolean get_boolean() +public boolean getBI_boolean() { -return proxyFlora.getboolean("boolean"); +Vector pars = new Vector(); +return proxyFlora.getboolean("boolean",true,pars); } -public void set_boolean() +public boolean setBI_boolean() { -proxyFlora.setboolean("boolean"); -return; +Vector pars = new Vector(); +return proxyFlora.setboolean("boolean",true,pars); } -public void delete_boolean() +public boolean deleteBI_boolean() { -proxyFlora.deleteboolean("boolean"); -return; +Vector pars = new Vector(); +return proxyFlora.deleteboolean("boolean",true,pars); } -public boolean get_boolean2() +public boolean getBI_boolean2() { -return proxyFlora.getboolean("boolean2"); +Vector pars = new Vector(); +return proxyFlora.getboolean("boolean2",true,pars); } -public void set_boolean2() +public boolean setBI_boolean2() { -proxyFlora.setboolean("boolean2"); -return; +Vector pars = new Vector(); +return proxyFlora.setboolean("boolean2",true,pars); } -public void delete_boolean2() +public boolean deleteBI_boolean2() { -proxyFlora.deleteboolean("boolean2"); -return; +Vector pars = new Vector(); +return proxyFlora.deleteboolean("boolean2",true,pars); } -public boolean get_procedural() +public boolean getBN_boolean() { -return proxyFlora.gettransactional("procedural"); +Vector pars = new Vector(); +return proxyFlora.getboolean("boolean",false,pars); } -public void set_procedural() +public boolean setBN_boolean() { -proxyFlora.settransactional("procedural"); -return; +Vector pars = new Vector(); +return proxyFlora.setboolean("boolean",false,pars); } -public void delete_procedural() +public boolean deleteBN_boolean() { -proxyFlora.deletetransactional("procedural"); -return; +Vector pars = new Vector(); +return proxyFlora.deleteboolean("boolean",false,pars); } -public boolean get_procedural2() +public boolean getBN_boolean2() { -return proxyFlora.gettransactional("procedural2"); +Vector pars = new Vector(); +return proxyFlora.getboolean("boolean2",false,pars); } -public void set_procedural2() +public boolean setBN_boolean2() { -proxyFlora.settransactional("procedural2"); -return; +Vector pars = new Vector(); +return proxyFlora.setboolean("boolean2",false,pars); } -public void delete_procedural2() +public boolean deleteBN_boolean2() { -proxyFlora.deletetransactional("procedural2"); -return; +Vector pars = new Vector(); +return proxyFlora.deleteboolean("boolean2",false,pars); } -public void set_age(Object year,Vector value) +public boolean getBN_procedural() { Vector pars = new Vector(); -pars.add(year); -proxyFlora.set("age",false,pars,value); +return proxyFlora.getboolean("procedural",false,pars); } -public void set_age(Object year,Object value) +public boolean setBN_procedural() { Vector pars = new Vector(); -pars.add(year); -proxyFlora.set("age",false,pars,value); +return proxyFlora.setboolean("procedural",false,pars); } -public Iterator get_age(Object year){ +public boolean deleteBN_procedural() +{ Vector pars = new Vector(); -pars.add(year); -return proxyFlora.get("age",false,pars); +return proxyFlora.deleteboolean("procedural",false,pars); } -public Iterator getAll_age(){ +public boolean getBN_boolean(Object person) +{ Vector pars = new Vector(); -pars.add("Par_year"); -return proxyFlora.getAll("age",false,pars); +pars.add(person); +return proxyFlora.getboolean("boolean",false,pars); } -public void delete_age(Object year,Vector value) +public boolean setBN_boolean(Object person) { Vector pars = new Vector(); -pars.add(year); -proxyFlora.delete("age",false,pars,value); +pars.add(person); +return proxyFlora.setboolean("boolean",false,pars); } -public void delete_age(Object year,Object value) +public boolean deleteBN_boolean(Object person) { Vector pars = new Vector(); -pars.add(year); -proxyFlora.delete("age",false,pars,value); +pars.add(person); +return proxyFlora.deleteboolean("boolean",false,pars); } -public void delete_age(Object year){ +public boolean getPN_procedural() +{ Vector pars = new Vector(); -pars.add(year); -proxyFlora.delete("age",false,pars); +return proxyFlora.getprocedural("procedural",false,pars); } -public void set_bonus(Object year, Object month,Vector value) +public boolean setPN_procedural() +{ +Vector pars = new Vector(); +return proxyFlora.setprocedural("procedural",false,pars); +} +public boolean deletePN_procedural() +{ +Vector pars = new Vector(); +return proxyFlora.deleteprocedural("procedural",false,pars); +} +public boolean getPN_procedural2() +{ +Vector pars = new Vector(); +return proxyFlora.getprocedural("procedural2",false,pars); +} +public boolean setPN_procedural2() +{ +Vector pars = new Vector(); +return proxyFlora.setprocedural("procedural2",false,pars); +} +public boolean deletePN_procedural2() +{ +Vector pars = new Vector(); +return proxyFlora.deleteprocedural("procedural2",false,pars); +} +public boolean getPN_procedural(Object person) +{ +Vector pars = new Vector(); +pars.add(person); +return proxyFlora.getprocedural("procedural",false,pars); +} +public boolean setPN_procedural(Object person) +{ +Vector pars = new Vector(); +pars.add(person); +return proxyFlora.setprocedural("procedural",false,pars); +} +public boolean deletePN_procedural(Object person) +{ +Vector pars = new Vector(); +pars.add(person); +return proxyFlora.deleteprocedural("procedural",false,pars); +} +public boolean setI_ancestors(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.set("ancestors",true,pars,value); +} +public boolean setI_ancestors(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.set("ancestors",true,pars,value); +} +public Iterator getI_ancestors(){ +Vector pars = new Vector(); +return proxyFlora.get("ancestors",true,pars); +} +public Iterator getAllI_ancestors(){ +Vector pars = new Vector(); +return proxyFlora.getAll("ancestors",true,pars); +} +public boolean deleteI_ancestors(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("ancestors",true,pars,value); +} +public boolean deleteI_ancestors(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("ancestors",true,pars,value); +} +public boolean deleteI_ancestors(){ +Vector pars = new Vector(); +return proxyFlora.delete("ancestors",true,pars); +} +public boolean setI_inheritableMeth(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.set("inheritableMeth",true,pars,value); +} +public boolean setI_inheritableMeth(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.set("inheritableMeth",true,pars,value); +} +public Iterator getI_inheritableMeth(){ +Vector pars = new Vector(); +return proxyFlora.get("inheritableMeth",true,pars); +} +public Iterator getAllI_inheritableMeth(){ +Vector pars = new Vector(); +return proxyFlora.getAll("inheritableMeth",true,pars); +} +public boolean deleteI_inheritableMeth(Vector value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("inheritableMeth",true,pars,value); +} +public boolean deleteI_inheritableMeth(Object value) +{ +Vector pars = new Vector(); +return proxyFlora.delete("inheritableMeth",true,pars,value); +} +public boolean deleteI_inheritableMeth(){ +Vector pars = new Vector(); +return proxyFlora.delete("inheritableMeth",true,pars); +} +public boolean setI_age(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); -pars.add(month); -proxyFlora.set("bonus",false,pars,value); +return proxyFlora.set("age",true,pars,value); } -public void set_bonus(Object year, Object month,Object value) +public boolean setI_age(Object year,Object value) { Vector pars = new Vector(); pars.add(year); -pars.add(month); -proxyFlora.set("bonus",false,pars,value); +return proxyFlora.set("age",true,pars,value); } -public Iterator get_bonus(Object year, Object month){ +public Iterator getI_age(Object year){ Vector pars = new Vector(); pars.add(year); -pars.add(month); -return proxyFlora.get("bonus",false,pars); +return proxyFlora.get("age",true,pars); } -public Iterator getAll_bonus(){ +public Iterator getAllI_age(){ Vector pars = new Vector(); pars.add("Par_year"); -pars.add("Par_month"); -return proxyFlora.getAll("bonus",false,pars); +return proxyFlora.getAll("age",true,pars); } -public void delete_bonus(Object year, Object month,Vector value) +public boolean deleteI_age(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); -pars.add(month); -proxyFlora.delete("bonus",false,pars,value); +return proxyFlora.delete("age",true,pars,value); } -public void delete_bonus(Object year, Object month,Object value) +public boolean deleteI_age(Object year,Object value) { Vector pars = new Vector(); pars.add(year); -pars.add(month); -proxyFlora.delete("bonus",false,pars,value); +return proxyFlora.delete("age",true,pars,value); } -public void delete_bonus(Object year, Object month){ +public boolean deleteI_age(Object year){ Vector pars = new Vector(); pars.add(year); -pars.add(month); -proxyFlora.delete("bonus",false,pars); +return proxyFlora.delete("age",true,pars); } -public void set_ancestors(Vector value) +public boolean setN_ancestors(Vector value) { Vector pars = new Vector(); -proxyFlora.set("ancestors",true,pars,value); +return proxyFlora.set("ancestors",false,pars,value); } -public void set_ancestors(Object value) +public boolean setN_ancestors(Object value) { Vector pars = new Vector(); -proxyFlora.set("ancestors",true,pars,value); +return proxyFlora.set("ancestors",false,pars,value); } -public Iterator get_ancestors(){ +public Iterator getN_ancestors(){ Vector pars = new Vector(); -return proxyFlora.get("ancestors",true,pars); +return proxyFlora.get("ancestors",false,pars); } -public Iterator getAll_ancestors(){ +public Iterator getAllN_ancestors(){ Vector pars = new Vector(); -return proxyFlora.getAll("ancestors",true,pars); +return proxyFlora.getAll("ancestors",false,pars); } -public void delete_ancestors(Vector value) +public boolean deleteN_ancestors(Vector value) { Vector pars = new Vector(); -proxyFlora.delete("ancestors",true,pars,value); +return proxyFlora.delete("ancestors",false,pars,value); } -public void delete_ancestors(Object value) +public boolean deleteN_ancestors(Object value) { Vector pars = new Vector(); -proxyFlora.delete("ancestors",true,pars,value); +return proxyFlora.delete("ancestors",false,pars,value); } -public void delete_ancestors(){ +public boolean deleteN_ancestors(){ Vector pars = new Vector(); -proxyFlora.delete("ancestors",true,pars); +return proxyFlora.delete("ancestors",false,pars); } -public void set_inheritableMeth(Vector value) +public boolean setN_inheritableMeth(Vector value) { Vector pars = new Vector(); -proxyFlora.set("inheritableMeth",true,pars,value); +return proxyFlora.set("inheritableMeth",false,pars,value); } -public void set_inheritableMeth(Object value) +public boolean setN_inheritableMeth(Object value) { Vector pars = new Vector(); -proxyFlora.set("inheritableMeth",true,pars,value); +return proxyFlora.set("inheritableMeth",false,pars,value); } -public Iterator get_inheritableMeth(){ +public Iterator getN_inheritableMeth(){ Vector pars = new Vector(); -return proxyFlora.get("inheritableMeth",true,pars); +return proxyFlora.get("inheritableMeth",false,pars); } -public Iterator getAll_inheritableMeth(){ +public Iterator getAllN_inheritableMeth(){ Vector pars = new Vector(); -return proxyFlora.getAll("inheritableMeth",true,pars); +return proxyFlora.getAll("inheritableMeth",false,pars); } -public void delete_inheritableMeth(Vector value) +public boolean deleteN_inheritableMeth(Vector value) { Vector pars = new Vector(); -proxyFlora.delete("inheritableMeth",true,pars,value); +return proxyFlora.delete("inheritableMeth",false,pars,value); } -public void delete_inheritableMeth(Object value) +public boolean deleteN_inheritableMeth(Object value) { Vector pars = new Vector(); -proxyFlora.delete("inheritableMeth",true,pars,value); +return proxyFlora.delete("inheritableMeth",false,pars,value); } -public void delete_inheritableMeth(){ +public boolean deleteN_inheritableMeth(){ Vector pars = new Vector(); -proxyFlora.delete("inheritableMeth",true,pars); +return proxyFlora.delete("inheritableMeth",false,pars); +} +public boolean setN_age(Object year,Vector value) +{ +Vector pars = new Vector(); +pars.add(year); +return proxyFlora.set("age",false,pars,value); +} +public boolean setN_age(Object year,Object value) +{ +Vector pars = new Vector(); +pars.add(year); +return proxyFlora.set("age",false,pars,value); +} +public Iterator getN_age(Object year){ +Vector pars = new Vector(); +pars.add(year); +return proxyFlora.get("age",false,pars); +} +public Iterator getAllN_age(){ +Vector pars = new Vector(); +pars.add("Par_year"); +return proxyFlora.getAll("age",false,pars); +} +public boolean deleteN_age(Object year,Vector value) +{ +Vector pars = new Vector(); +pars.add(year); +return proxyFlora.delete("age",false,pars,value); +} +public boolean deleteN_age(Object year,Object value) +{ +Vector pars = new Vector(); +pars.add(year); +return proxyFlora.delete("age",false,pars,value); +} +public boolean deleteN_age(Object year){ +Vector pars = new Vector(); +pars.add(year); +return proxyFlora.delete("age",false,pars); +} +public boolean setN_bonus(Object year, Object month,Vector value) +{ +Vector pars = new Vector(); +pars.add(year); +pars.add(month); +return proxyFlora.set("bonus",false,pars,value); +} +public boolean setN_bonus(Object year, Object month,Object value) +{ +Vector pars = new Vector(); +pars.add(year); +pars.add(month); +return proxyFlora.set("bonus",false,pars,value); +} +public Iterator getN_bonus(Object year, Object month){ +Vector pars = new Vector(); +pars.add(year); +pars.add(month); +return proxyFlora.get("bonus",false,pars); +} +public Iterator getAllN_bonus(){ +Vector pars = new Vector(); +pars.add("Par_year"); +pars.add("Par_month"); +return proxyFlora.getAll("bonus",false,pars); +} +public boolean deleteN_bonus(Object year, Object month,Vector value) +{ +Vector pars = new Vector(); +pars.add(year); +pars.add(month); +return proxyFlora.delete("bonus",false,pars,value); +} +public boolean deleteN_bonus(Object year, Object month,Object value) +{ +Vector pars = new Vector(); +pars.add(year); +pars.add(month); +return proxyFlora.delete("bonus",false,pars,value); +} +public boolean deleteN_bonus(Object year, Object month){ +Vector pars = new Vector(); +pars.add(year); +pars.add(month); +return proxyFlora.delete("bonus",false,pars); } } Index: fooExample.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/fooExample/fooExample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- fooExample.java 24 May 2006 20:33:55 -0000 1.1 +++ fooExample.java 25 May 2006 02:49:48 -0000 1.2 @@ -55,38 +55,38 @@ System.out.println("FOO obj Id: wrong answer!"); } - + foo objJohn = new foo(johnSuper,"foo_mod"); - boolean check = objJohn.get_boolean(); + boolean check = objJohn.getBN_boolean(); if (check) System.out.println("boolean is true"); else System.out.println("boolean is false"); - check = objJohn.get_boolean2(); + check = objJohn.getBN_boolean2(); if(check) System.out.println("boolean2 is true"); else System.out.println("boolean2 is false"); - check = objJohn.get_procedural(); + check = objJohn.getPN_procedural(); if (check) System.out.println("procedural is true"); else System.out.println("procedural is false"); - check = objJohn.get_procedural2(); + check = objJohn.getPN_procedural2(); if (check) System.out.println("procedural2 is true"); else System.out.println("procedural2 is false"); - objJohn.set_bonus("2004","Jan","5000"); - System.out.println("Set Johns bonus"); - objJohn.set_age("2004","50"); - System.out.println("Set Johns age"); - Iterator ageValues = objJohn.get_age("2004"); + objJohn.setN_bonus("2004","Jan","5000"); + System.out.println("Set John's bonus"); + objJohn.setN_age("2004","50"); + System.out.println("Set John's age"); + Iterator ageValues = objJohn.getN_age("2004"); while (ageValues.hasNext()) { System.out.println("John's age:"+ageValues.next()); } @@ -95,12 +95,12 @@ ancestors.add("mary"); ancestors.add("sally"); - objJohn.set_ancestors(ancestors); + objJohn.setN_ancestors(ancestors); System.out.println("John obj:"+objJohn); /* To show the use of ExecuteQuery/2 */ - objJohn.set_ancestors(ancestors); + objJohn.setN_ancestors(ancestors); System.out.println("John obj:"+objJohn); Vector vars = new Vector(); |
|
From: Michael K. <ki...@us...> - 2006-05-25 02:49:51
|
Update of /cvsroot/flora/flora2/pkgs In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2341/pkgs Modified Files: javaAPI.flr Log Message: more or less finished with java API Index: javaAPI.flr =================================================================== RCS file: /cvsroot/flora/flora2/pkgs/javaAPI.flr,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- javaAPI.flr 24 May 2006 20:23:56 -0000 1.3 +++ javaAPI.flr 25 May 2006 02:49:47 -0000 1.4 @@ -49,10 +49,13 @@ %openFile(?FileName), %writeImports, %writeStartClass(?Obj), - %writeBoolean(?Obj,?Module), - %writeTransactional(?Obj,?Module), - %writeAllnonInh(?Obj,?Module), - %writeAllinh(?Obj,?Module), + %writeBoolean(?Obj,?Module,booleanMethodInh), + %writeBoolean(?Obj,?Module,booleanMethodNoninh), + %writeProcedural(?Obj,?Module,proceduralMethodNoninh), + // proceduralMethodInh not implemented + //%writeProcedural(?Obj,?Module,proceduralMethodInh), + %writeRegular(?Obj,?Module,regularMethodInh), + %writeRegular(?Obj,?Module,regularMethodNoninh), %closeFile. %openFile(?FileName) :- @@ -102,21 +105,23 @@ /* Find all the methods of the object and write them to the java file */ -%writeBoolean(?Obj,?Module) :- - ?MethodList=collectset{?M|?Obj[=>?M]@?Module}, // NEED TO TREAT INHERITABLES ALSO - %callXOnList(?MethodList,booleanMethod). - -%writeTransactional(?Obj,?Module) :- - ?MethodList=collectset{?M|?Obj[=>%?M]@?Module}, - %callXOnList(?MethodList,transactionalMethod). +%writeBoolean(?Obj,?Module,?Inherit) :- + if ?Inherit == booleanMethodInh + then ?MethodList=collectset{?M|?Obj[*=>?M]@?Module} + else ?MethodList=collectset{?M|?Obj[=>?M; *=>?M]@?Module}, + %callXOnList(?MethodList,?Inherit). -%writeAllnonInh(?Obj,?Module) :- - ?MethodList=collectset{?M|?Obj[?M=>?_X]@?Module}, - %callXOnList(?MethodList,nonInh). +%writeProcedural(?Obj,?Module,?Inherit) :- + if ?Inherit == proceduralMethodInh + then %abort('Inheritable procedural methods are not yet supported') + else ?MethodList=collectset{?M|?Obj[=>%?M]@?Module}, + %callXOnList(?MethodList,?Inherit). -%writeAllinh(?Obj,?Module) :- - ?MethodList=collectset{?M|?Obj[?M*=>?_X]@?Module}, - %callXOnList(?MethodList,inh). +%writeRegular(?Obj,?Module,?Inherit) :- + if ?Inherit == regularMethodInh + then ?MethodList=collectset{?M|?Obj[?M*=>?_X]@?Module} + else ?MethodList=collectset{?M|?Obj[?M=>?_X; ?M*=>?_X]@?Module}, + %callXOnList(?MethodList,?Inherit). /* Predicate to call the X function on each term in the list */ %callXOnList([],?_X). @@ -127,286 +132,318 @@ /* Calling the same functions for inheritable/non-inheritable versions of the method */ -%booleanMethod(?Method) :- - %writeGetBool(?Method), - %writeBool(?Method), - %writeDeleteBool(?Method). +%booleanMethodInh(?Method) :- + %booleanMethodAny(?Method,true). +%booleanMethodNoninh(?Method) :- + %booleanMethodAny(?Method,false). -%transactionalMethod(?Method) :- - %writeGetTrans(?Method), - %writeTrans(?Method), - %writeDeleteTrans(?Method). +%booleanMethodAny(?Method,?Inherit) :- + %writeGetBool(?Method,?Inherit), + %writeSetBool(?Method,?Inherit), + %writeDeleteBool(?Method,?Inherit). -%inh(?Method) :- - %nonInhActual(?Method,true). +%proceduralMethodInh(?Method) :- // not yet implemented in FLORA-2 + %proceduralMethodAny(?Method,true). +%proceduralMethodNoninh(?Method) :- + %proceduralMethodAny(?Method,false). + +%proceduralMethodAny(?Method,?Inherit) :- + %writeGetProc(?Method,?Inherit), + %writeSetProc(?Method,?Inherit), + %writeDeleteProc(?Method,?Inherit). + +%regularMethodInh(?Method) :- + %regularMethodAny(?Method,true). +%regularMethodNoninh(?Method) :- + %regularMethodAny(?Method,false). + +%regularMethodAny(?Method,?Inherit) :- + %regularSet(?Method,?Inherit), + %regularGet(?Method,?Inherit), + %regularGetAll(?Method,?Inherit), + %regularDelete(?Method,?Inherit), + %regularDeleteAll(?Method,?Inherit). -%nonInh(?Method) :- - %nonInhActual(?Method,false). // Boolean -%writeGetBool(?Method) :- - %writeGetBoolProto(?Method), - %writeGetBoolBody(?Method). +%writeGetBool(?Method,?Inherit) :- + %writeGetBoolProto(?Method,?Inherit), + %writeGetBoolBody(?Method,?Inherit). -%writeBool(?Method) :- - %writeBoolProto(?Method), - %writeBoolBody(?Method). +%writeSetBool(?Method,?Inherit) :- + %writeSetBoolProto(?Method,?Inherit), + %writeSetBoolBody(?Method,?Inherit). -%writeDeleteBool(?Method) :- - %writeDeleteBoolProto(?Method), - %writeDeleteBoolBody(?Method). +%writeDeleteBool(?Method,?Inherit) :- + %writeDeleteBoolProto(?Method,?Inherit), + %writeDeleteBoolBody(?Method,?Inherit). -%writeGetBoolProto(?Method) :- - write('public boolean get_')@prolog(), - %write(?Method)@flora(io), +%writeGetBoolProto(?Method,?Inherit) :- + ?Method =.. [?H|?FnArgs], + (?H = hilog(?FnName), ! ; ?H = ?FnName), + (?Inherit==true, !, write('public boolean getBI_')@prolog() + ; write('public boolean getBN_')@prolog() + ), + %write(?FnName)@flora(io), write('(')@prolog(), + %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeGetBoolBody(?Method) :- +%writeGetBoolBody(?Method,?Inherit) :- writeln('{')@prolog(), - write('return ')@prolog(), - write('proxyFlora.getboolean("')@prolog(), - %write(?Method)@flora(io), - writeln('");')@prolog(), + %parentCallGetBody(?Method,?Inherit,getboolean), writeln('}')@prolog(). -%writeBoolProto(?Method) :- - write('public void set_')@prolog(), - %write(?Method)@flora(io), +%writeSetBoolProto(?Method,?Inherit) :- + ?Method =.. [?H|?FnArgs], + (?H = hilog(?FnName), ! ; ?H = ?FnName), + (?Inherit==true, !, write('public boolean setBI_')@prolog() + ; write('public boolean setBN_')@prolog() + ), + %write(?FnName)@flora(io), write('(')@prolog(), + %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeBoolBody(?Method) :- +%writeSetBoolBody(?Method,?Inherit) :- writeln('{')@prolog(), - write('proxyFlora.setboolean("')@prolog(), - %write(?Method)@flora(io), - writeln('");')@prolog(), - writeln('return;')@prolog(), + %parentCallSetBody(?Method,?Inherit,setboolean), writeln('}')@prolog(). -%writeDeleteBoolProto(?Method) :- - write('public void delete_')@prolog(), - %write(?Method)@flora(io), +%writeDeleteBoolProto(?Method,?Inherit) :- + ?Method =.. [?H|?FnArgs], + (?H = hilog(?FnName), ! ; ?H = ?FnName), + (?Inherit==true, !, write('public boolean deleteBI_')@prolog() + ; write('public boolean deleteBN_')@prolog() + ), + %write(?FnName)@flora(io), write('(')@prolog(), + %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeDeleteBoolBody(?Method) :- +%writeDeleteBoolBody(?Method,?Inherit) :- writeln('{')@prolog(), - write('proxyFlora.deleteboolean("')@prolog(), - %write(?Method)@flora(io), - writeln('");')@prolog(), - writeln('return;')@prolog(), + %parentCallDeleteBody(?Method,?Inherit,deleteboolean), writeln('}')@prolog(). -// Transactional -%writeGetTrans(?Method) :- - %writeGetTransProto(?Method), - %writeGetTransBody(?Method). +// Procedural +%writeGetProc(?Method,?Inherit) :- + %writeGetProcProto(?Method,?Inherit), + %writeGetProcBody(?Method,?Inherit). -%writeTrans(?Method) :- - %writeTransProto(?Method), - %writeTransBody(?Method). +%writeSetProc(?Method,?Inherit) :- + %writeSetProcProto(?Method,?Inherit), + %writeSetProcBody(?Method,?Inherit). -%writeDeleteTrans(?Method) :- - %writeDeleteTransProto(?Method), - %writeDeleteTransBody(?Method). +%writeDeleteProc(?Method,?Inherit) :- + %writeDeleteProcProto(?Method,?Inherit), + %writeDeleteProcBody(?Method,?Inherit). -%writeGetTransProto(?Method) :- - write('public boolean get_')@prolog(), - %write(?Method)@flora(io), - write('(')@prolog(), +%writeGetProcProto(?Method,?Inherit) :- + ?Method =.. [?H|?FnArgs], + (?H = hilog(?FnName), ! ; ?H = ?FnName), + (?Inherit==true, !, write('public boolean getPI_')@prolog() + ; write('public boolean getPN_')@prolog() + ), + %write(?FnName)@flora(io), + write('(')@prolog(), + %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeGetTransBody(?Method) :- +%writeGetProcBody(?Method,?Inherit) :- writeln('{')@prolog(), - write('return ')@prolog(), - write('proxyFlora.gettransactional("')@prolog(), - %write(?Method)@flora(io), - writeln('");')@prolog(), + %parentCallGetBody(?Method,?Inherit,getprocedural), writeln('}')@prolog(). -%writeTransProto(?Method) :- - write('public void set_')@prolog(), - %write(?Method)@flora(io), +%writeSetProcProto(?Method,?Inherit) :- + ?Method =.. [?H|?FnArgs], + (?H = hilog(?FnName), ! ; ?H = ?FnName), + (?Inherit==true, !, write('public boolean setPI_')@prolog() + ; write('public boolean setPN_')@prolog() + ), + %write(?FnName)@flora(io), write('(')@prolog(), + %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeTransBody(?Method) :- +%writeSetProcBody(?Method,?Inherit) :- writeln('{')@prolog(), - write('proxyFlora.settransactional("')@prolog(), - %write(?Method)@flora(io), - writeln('");')@prolog(), - writeln('return;')@prolog(), + %parentCallSetBody(?Method,?Inherit,setprocedural), writeln('}')@prolog(). -%writeDeleteTransProto(?Method) :- - write('public void delete_')@prolog(), - %write(?Method)@flora(io), +%writeDeleteProcProto(?Method,?Inherit) :- + ?Method =.. [?H|?FnArgs], + (?H = hilog(?FnName), ! ; ?H = ?FnName), + (?Inherit==true, !, write('public boolean deletePI_')@prolog() + ; write('public boolean deletePN_')@prolog() + ), + %write(?FnName)@flora(io), write('(')@prolog(), + %writeParlist(?FnArgs), writeln(')')@prolog(). -%writeDeleteTransBody(?Method) :- +%writeDeleteProcBody(?Method,?Inherit) :- writeln('{')@prolog(), - write('proxyFlora.deletetransactional("')@prolog(), - %write(?Method)@flora(io), - writeln('");')@prolog(), - writeln('return;')@prolog(), + %parentCallDeleteBody(?Method,?Inherit,deleteprocedural), writeln('}')@prolog(). /* The set and the get functions involve writing the prototype and the body of the function */ -%nonInhActual(?Method,?Inherit) :- - %nonInh(?Method,?Inherit), - %nonInhGet(?Method,?Inherit), - %nonInhGetAll(?Method,?Inherit), - %nonInhDelete(?Method,?Inherit), - %nonInhDeleteAll(?Method,?Inherit). - -%nonInh(?Method,?Inherit) :- - %nonInhSetProto(?Method), - %setBody(?Method,?Inherit), - %nonInhSetProtoOneVal(?Method), - %setBody(?Method,?Inherit). +%regularSet(?Method,?Inherit) :- + %regularSetProto(?Method,?Inherit), + %regularSetBody(?Method,?Inherit), + %regularSetProtoOneVal(?Method,?Inherit), + %regularSetBody(?Method,?Inherit). -%nonInhGet(?Method,?Inherit) :- - %nonInhGetProto(?Method), - %getBody(?Method,?Inherit). +%regularGet(?Method,?Inherit) :- + %regularGetProto(?Method,?Inherit), + %regularGetBody(?Method,?Inherit). -%nonInhGetAll(?Method,?Inherit) :- - %nonInhGetAllProto(?Method), - %getAllBody(?Method,?Inherit). +%regularGetAll(?Method,?Inherit) :- + %regularGetAllProto(?Method,?Inherit), + %regularGetAllBody(?Method,?Inherit). -%nonInhDelete(?Method,?Inherit) :- - %nonInhDeleteProto(?Method), - %deleteBody(?Method,?Inherit), - %nonInhDeleteProtoOneVal(?Method), - %deleteBody(?Method,?Inherit). +%regularDelete(?Method,?Inherit) :- + %regularDeleteProto(?Method,?Inherit), + %regularDeleteBody(?Method,?Inherit), + %regularDeleteProtoOneVal(?Method,?Inherit), + %regularDeleteBody(?Method,?Inherit). -%nonInhDeleteAll(?Method,?Inherit) :- - %nonInhDeleteAllProto(?Method), - %deleteAllBody(?Method,?Inherit). +%regularDeleteAll(?Method,?Inherit) :- + %regularDeleteAllProto(?Method,?Inherit), + %regularDeleteAllBody(?Method,?Inherit). /* Writing the prototype */ -%nonInhSetProtoOneVal(?Method):- +%regularSetProtoOneVal(?Method,?Inherit):- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Object value)' else (?H = ?FnName, ?Msg = 'Object value)'), - write('public void set_')@prolog(), + (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), + format('public boolean set~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), - %writelist(?FnArgs), + %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%nonInhSetProto(?Method) :- +%regularSetProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Vector value)' else (?H = ?FnName, ?Msg = 'Vector value)'), - write('public void set_')@prolog(), + (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), + format('public boolean set~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), - %writelist(?FnArgs), + %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%nonInhGetProto(?Method) :- +%regularGetProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - write('public Iterator get_')@prolog(), + (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), + format('public Iterator get~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), - %writeGetlist(?FnArgs), + %writeParlist(?FnArgs), write(')')@prolog(). -%nonInhGetAllProto(?Method) :- +%regularGetAllProto(?Method,?Inherit) :- ?Method =.. [?H|?_FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - write('public Iterator getAll_')@prolog(), + (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), + format('public Iterator getAll~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('()')@prolog(). -%nonInhDeleteProtoOneVal(?Method):- +%regularDeleteProtoOneVal(?Method,?Inherit):- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Object value)' else (?H = ?FnName, ?Msg = 'Object value)'), - write('public void delete_')@prolog(), + (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), + format('public boolean delete~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), - %writelist(?FnArgs), + %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%nonInhDeleteProto(?Method) :- +%regularDeleteProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], if ?H = hilog(?FnName) then ?Msg = ',Vector value)' else (?H = ?FnName, ?Msg = 'Vector value)'), - write('public void delete_')@prolog(), + (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), + format('public boolean delete~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), - %writelist(?FnArgs), + %writeParlist(?FnArgs), writeln(?Msg)@prolog(). -%nonInhDeleteAllProto(?Method) :- +%regularDeleteAllProto(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), - write('public void delete_')@prolog(), + (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), + format('public boolean delete~w_',[?Modifier])@prolog(format), %write(?FnName)@flora(io), write('(')@prolog(), - %writeGetlist(?FnArgs), + %writeParlist(?FnArgs), write(')')@prolog(). /* Writing the body */ -%setBody(?Method,?Inherit) :- +%regularSetBody(?Method,?Inherit) :- writeln('{')@prolog(), - %parentCallBody(?Method,?Inherit), + %parentCallSetBody(?Method,?Inherit,set), writeln('}')@prolog(). -%getBody(?Method,?Inherit) :- +%regularGetBody(?Method,?Inherit) :- writeln('{')@prolog(), - %parentCallGetBody(?Method,?Inherit), + %parentCallGetBody(?Method,?Inherit,get), writeln('}')@prolog(). -%getAllBody(?Method,?Inherit) :- +%regularGetAllBody(?Method,?Inherit) :- writeln('{')@prolog(), %parentCallGetAllBody(?Method,?Inherit), writeln('}')@prolog(). -%deleteBody(?Method,?Inherit) :- +%regularDeleteBody(?Method,?Inherit) :- writeln('{')@prolog(), - %parentCallDeleteBody(?Method,?Inherit), + %parentCallDeleteBody(?Method,?Inherit,delete), writeln('}')@prolog(). -%deleteAllBody(?Method,?Inherit) :- +%regularDeleteAllBody(?Method,?Inherit) :- writeln('{')@prolog(), %parentCallDeleteAllBody(?Method,?Inherit), writeln('}')@prolog(). -%parentCallBody(?Method,?Inherit) :- +%parentCallSetBody(?Method,?Inherit,?Type) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), %writeVectorParsInit, %writeBodyList(?FnArgs), - %writeProxyCall(?FnName,?Inherit). + %writeProxySetCall(?FnName,?Inherit,?Type). %writeVectorParsInit:- writeln('Vector pars = new Vector();')@prolog(). -%writeProxyCall(?FnName,?Inherit) :- - write('proxyFlora.set("')@prolog(), +%writeProxySetCall(?FnName,?Inherit,?Type) :- + (?Inherit==true, !, ?Modifier=I ; ?Modifier=N), + format('return proxyFlora.~w("',[?Type])@prolog(format), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), - writeln(',pars,value);')@prolog(). + (?Type==set, !, writeln(',pars,value);')@prolog() + ; writeln(',pars);')@prolog() + ). -%parentCallGetBody(?Method,?Inherit) :- +%parentCallGetBody(?Method,?Inherit,?Type) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), %writeVectorParsInit, %writeBodyList(?FnArgs), - %writeProxyGetCall(?FnName,?Inherit). + %writeProxyGetCall(?FnName,?Inherit,?Type). -%writeProxyGetCall(?FnName,?Inherit) :- - write('return proxyFlora.get("')@prolog(), +%writeProxyGetCall(?FnName,?Inherit,?Type) :- + format('return proxyFlora.~w("',[?Type])@prolog(format), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), @@ -427,19 +464,21 @@ %write(?Inherit)@flora(io), writeln(',pars);')@prolog(). -%parentCallDeleteBody(?Method,?Inherit) :- +%parentCallDeleteBody(?Method,?Inherit,?Type) :- ?Method =.. [?H|?FnArgs], (?H = hilog(?FnName), ! ; ?H = ?FnName), %writeVectorParsInit, %writeBodyList(?FnArgs), - %writeProxyDeleteBody(?FnName,?Inherit). + %writeProxyDeleteBody(?FnName,?Inherit,?Type). -%writeProxyDeleteBody(?FnName,?Inherit) :- - write('proxyFlora.delete("')@prolog(), +%writeProxyDeleteBody(?FnName,?Inherit,?Type) :- + format('return proxyFlora.~w("',[?Type])@prolog(format), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), - writeln(',pars,value);')@prolog(). + (?Type == delete, !, writeln(',pars,value);')@prolog() + ; writeln(',pars);')@prolog() + ). %parentCallDeleteAllBody(?Method,?Inherit) :- ?Method =.. [?H|?FnArgs], @@ -449,7 +488,7 @@ %writeProxyDeleteAllBody(?FnName,?Inherit). %writeProxyDeleteAllBody(?FnName,?Inherit) :- - write('proxyFlora.delete("')@prolog(), + write('return proxyFlora.delete("')@prolog(), %write(?FnName)@flora(io), write('",')@prolog(), %write(?Inherit)@flora(io), @@ -468,10 +507,6 @@ write(', ')@prolog(), %writeParlist(?X). -%writelist(?List) :- - %writeParlist(?List). -%writeGetlist(?List) :- - %writeParlist(?List). %writeBodyList([]). %writeBodyList([?A|[]]) :- |
|
From: Michael K. <ki...@us...> - 2006-05-25 02:49:50
|
Update of /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2341/java/API/net/sourceforge/flora/javaAPI/src Modified Files: FloraObject.java Log Message: more or less finished with java API Index: FloraObject.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/FloraObject.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FloraObject.java 24 May 2006 20:33:55 -0000 1.1 +++ FloraObject.java 25 May 2006 02:49:48 -0000 1.2 @@ -73,12 +73,19 @@ /* Get a boolean property of the object + ** ** methodName is the name of the boolean method + ** inherit: whether the method is inheritable or not + ** parameters: parameters passed to the method */ - public boolean getboolean(Object methodName) + public boolean getboolean(Object methodName,boolean inherit,Vector parameters) { + String paramList = makeParameterListString(parameters); String floraQuery = - floraOID + "[" + methodName.toString() + floraOID + "[" + + (inherit ? "*" : "") + + methodName.toString() + + paramList + "]" + session.moduleStr + moduleName + "."; try { @@ -92,16 +99,23 @@ /* Set a boolean property of the object + ** ** methodName : name of the boolean method + ** inherit: whether the method is inheritable or not + ** parameters: parameters passed to the method */ - public void setboolean(Object methodName) + public boolean setboolean(Object methodName,boolean inherit,Vector parameters) { + String paramList = makeParameterListString(parameters); String floraQuery= - "insert{"+floraOID+"["+methodName.toString() - +"]"+session.moduleStr+moduleName + "}."; + "insert{" + floraOID + "[" + + (inherit ? "*" : "") + + methodName.toString() + + paramList + + "]" + session.moduleStr + moduleName + "}."; try { - session.ExecuteCommand(floraQuery); + return session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); @@ -111,16 +125,23 @@ /* Delete a boolean property of the object + ** ** methodName : name of the boolean method + ** inherit: whether the method is inheritable or not + ** parameters: parameters passed to the method */ - public void deleteboolean(Object methodName) + public boolean deleteboolean(Object methodName,boolean inherit,Vector parameters) { - String floraQuery= - "deleteall{"+floraOID+"["+methodName.toString() - +"]"+session.moduleStr+moduleName +"}."; + String paramList = makeParameterListString(parameters); + String floraQuery = + "deleteall{" + floraOID + "[" + + (inherit ? "*" : "") + + methodName.toString() + + paramList + + "]" + session.moduleStr + moduleName + "}."; try { - session.ExecuteCommand(floraQuery); + return session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); @@ -130,13 +151,18 @@ } - /* Get a transactional property of the object + /* Get a procedural property of the object + ** ** methodName is the name of the boolean method + ** inherit: ignored - for future use + ** parameters: parameters passed to the method */ - public boolean gettransactional(Object methodName) + public boolean getprocedural(Object methodName,boolean inherit,Vector parameters) { + String paramList = makeParameterListString(parameters); String floraQuery = floraOID + "[%" + methodName.toString() + + paramList + "]" + session.moduleStr + moduleName + "."; try { @@ -150,32 +176,45 @@ } - /* Set a transactional property of the object */ - /* methodName : boolean method */ - public void settransactional(Object methodName) + /* Set a procedural property of the object + ** + ** methodName : boolean method + ** inherit: ignored - for future use + ** parameters: parameters passed to the method + */ + public boolean setprocedural(Object methodName,boolean inherit,Vector parameters) { + String paramList = makeParameterListString(parameters); String floraQuery= - "insert{"+floraOID+"[%"+methodName.toString() - +"]"+session.moduleStr+moduleName + "}."; + "insert{" + floraOID + "[%" + methodName.toString() + + paramList + + "]" + session.moduleStr + moduleName + "}."; try { - session.ExecuteCommand(floraQuery); + return session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); + throw new FlrException("j2flora2: Command " + + floraQuery + " failed"); } } - /* Delete a transactional property of the object + /* Delete a procedural property of the object + ** ** methodName : name of the boolean method + ** inherit: ignored - for future use + ** parameters: parameters passed to the method */ - public void deletetransactional(Object methodName) + public boolean deleteprocedural(Object methodName,boolean inherit,Vector parameters) { + String paramList = makeParameterListString(parameters); String floraQuery= - "deleteall{"+floraOID+"[%"+methodName.toString() - +"]"+session.moduleStr+moduleName+"}."; + "deleteall{" + floraOID + "[%" + methodName.toString() + + paramList + + "]" + session.moduleStr + moduleName + "}."; try { - session.ExecuteCommand(floraQuery); + return session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); @@ -191,7 +230,7 @@ ** parameters : the parameters to the method ** value : the value of the method to be deleted */ - public void delete(Object methodName,boolean inherit,Vector parameters,Object value) + public boolean delete(Object methodName,boolean inherit,Vector parameters,Object value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); @@ -208,7 +247,7 @@ + session.moduleStr + this.moduleName + "}."; try { - session.ExecuteCommand(floraQuery); + return session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); @@ -224,7 +263,7 @@ ** parameters : the parameters to the method ** value : the values of the method to be deleted */ - public void delete(Object methodName,boolean inherit,Vector parameters,Vector value) + public boolean delete(Object methodName,boolean inherit,Vector parameters,Vector value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); @@ -241,7 +280,7 @@ + paramList + operatorstring+valuelist + "]" + session.moduleStr + this.moduleName + "}."; try { - session.ExecuteCommand(floraQuery); + return session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); @@ -252,11 +291,12 @@ /* Delete all bindings of a method + ** ** methodName : name of method ** inherit : whether the method is inheritable or not ** parameters : the parameters to the method */ - public void delete(Object methodName,boolean inherit,Vector parameters) + public boolean delete(Object methodName,boolean inherit,Vector parameters) { String floraQuery= ""; String paramList = makeParameterListString(parameters); @@ -274,7 +314,7 @@ + session.moduleStr + this.moduleName + "}."; try { - session.ExecuteCommand(floraQuery); + return session.ExecuteCommand(floraQuery); } catch (Exception e) { e.printStackTrace(); @@ -285,12 +325,13 @@ /* Add a single value to method + ** ** methodName : method whose value is to be set ** inherit : whether the method is inheritable ** parameters : parameters to the method ** value : value to be set to */ - public void set(Object methodName,boolean inherit,Vector parameters,Object value) + public boolean set(Object methodName,boolean inherit,Vector parameters,Object value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); @@ -307,7 +348,7 @@ + session.moduleStr + this.moduleName + "}."; try { - session.ExecuteCommand(floraQuery); + return session.ExecuteCommand(floraQuery); } catch (Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in set. Query was " @@ -316,12 +357,14 @@ } - /* methodName : method to be set + /* Add multiple values + ** + ** methodName : method to be set ** inherit : whether the method is inheritable or not ** parameters : parameters to the method ** value : vector of values to be set to */ - public void set(Object methodName,boolean inherit,Vector parameters,Vector value) + public boolean set(Object methodName,boolean inherit,Vector parameters,Vector value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); @@ -338,7 +381,7 @@ + operatorstring + valuelist + "]" + session.moduleStr + this.moduleName +"}."; try { - session.ExecuteCommand(floraQuery); + return session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); @@ -466,7 +509,7 @@ /* Get all the methods of the class to which this object belongs - ** This doesn't return boolean or transactional methods. + ** This doesn't return boolean or procedural methods. */ public Iterator getAllMethods() { @@ -485,7 +528,8 @@ /* Get methods of a particular type (inheritable or noninheritable). - ** Returns only set-valued methods - not boolean or transactional + ** Returns only set-valued methods - not boolean or procedural + ** ** inherit : indicates if the method is inheritable */ private Iterator getMethods(boolean inherit) |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:34:02
|
Update of /cvsroot/flora/flora2/java/API/examples/fooExample In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv28569/java/API/examples/fooExample Added Files: fooExample.java foo.java foo.flr floraVariables.sh floraVariables.bat README .cvsignore Log Message: added the java API --- NEW FILE: .cvsignore --- *.xwam *.O *.P cmd... *.fdb *.flh *.fld *.con *.class --- NEW FILE: foo.flr --- foo::foo_parent1. foo::foo_parent2. foo[age(year)=>number]. foo[bonus(year,month)=>number]. foo[ancestors*=>parents]. foo[ancestors*->{adam, eve}]. foo[inheritableMeth*=>string]. foo[inheritableMeth*->something]. foo[=> boolean]. foo[=> boolean2]. foo[=> %procedural]. foo[=> %procedural2]. foo[*=> boolean]. foo[*=> boolean2]. foo[*=> %procedural]. foo[*=> %procedural2]. foo[*boolean]. mary[%procedural]. john:foo. john[age(2000)->19]. john[inheritableMeth->boo]. mary:foo. mary[ancestors->{sally, bill, bob, anne}]. --- NEW FILE: fooExample.java --- /* File: fooExample.java ** ** Author(s): Aditi Pandit ** ** Contact: flo...@li... ** ** Copyright (C) The Research Foundation of SUNY, 2005, 2006 ** ** FLORA-2 is free software; you can redistribute it and/or modify it under the ** terms of the GNU Library General Public License as published by the Free ** Software Foundation; either version 2 of the License, or (at your option) ** any later version. ** ** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for ** more details. ** ** ** You should have received a copy of the GNU Library General Public License ** along with FLORA-2; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** ** */ import net.sourceforge.flora.javaAPI.src.*; import java.util.*; /* Sample java file */ public class fooExample{ public static void main(String[] args) { FloraSession session = new FloraSession(); System.out.println("FLORA-2 session started"); String fileName = System.getProperty("FLORA_FILE"); if(fileName == null || fileName.trim().length() == 0) { System.out.println("Invalid path to example file"); System.exit(0); } session.loadFile(fileName,"foo_mod"); String command = "?Y : foo @ foo_mod."; Iterator fooObjs = session.ExecuteQuery(command); FloraObject johnSuper = null; while (fooObjs.hasNext()) { johnSuper = (FloraObject)fooObjs.next(); if (johnSuper != null) { System.out.println("FOO obj Id:"+johnSuper); } else System.out.println("FOO obj Id: wrong answer!"); } foo objJohn = new foo(johnSuper,"foo_mod"); boolean check = objJohn.get_boolean(); if (check) System.out.println("boolean is true"); else System.out.println("boolean is false"); check = objJohn.get_boolean2(); if(check) System.out.println("boolean2 is true"); else System.out.println("boolean2 is false"); check = objJohn.get_procedural(); if (check) System.out.println("procedural is true"); else System.out.println("procedural is false"); check = objJohn.get_procedural2(); if (check) System.out.println("procedural2 is true"); else System.out.println("procedural2 is false"); objJohn.set_bonus("2004","Jan","5000"); System.out.println("Set Johns bonus"); objJohn.set_age("2004","50"); System.out.println("Set Johns age"); Iterator ageValues = objJohn.get_age("2004"); while (ageValues.hasNext()) { System.out.println("John's age:"+ageValues.next()); } Vector ancestors = new Vector(); ancestors.add("mary"); ancestors.add("sally"); objJohn.set_ancestors(ancestors); System.out.println("John obj:"+objJohn); /* To show the use of ExecuteQuery/2 */ objJohn.set_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); HashMap firstmatch; System.out.println("Query: ?X : ?Y @ foo_mod."); while (allmatches.hasNext()) { firstmatch = (HashMap)allmatches.next(); Object Xobj = firstmatch.get("?X"); Object Yobj = firstmatch.get("?Y"); System.out.println(" " + Xobj + " : " + Yobj); } session.close(); System.exit(0); } } --- NEW FILE: foo.java --- import java.util.*; import com.declarativa.interprolog.TermModel; import net.sourceforge.flora.javaAPI.util.*; import net.sourceforge.flora.javaAPI.src.*; public class foo { public FloraObject proxyFlora; public TermModel floraClassName = new TermModel("foo"); public foo(FloraObject proxy,String moduleName) { proxyFlora = proxy; if (proxy == null) throw new FlrException("Cannot create Java class " + floraClassName + ". Null proxy object passed to " + floraClassName + "(proxy,modulename)"); proxyFlora.moduleName = moduleName; proxyFlora.floraClassName = floraClassName; return; } public String toString() { return proxyFlora.toString(); } public boolean get_boolean() { return proxyFlora.getboolean("boolean"); } public void set_boolean() { proxyFlora.setboolean("boolean"); return; } public void delete_boolean() { proxyFlora.deleteboolean("boolean"); return; } public boolean get_boolean2() { return proxyFlora.getboolean("boolean2"); } public void set_boolean2() { proxyFlora.setboolean("boolean2"); return; } public void delete_boolean2() { proxyFlora.deleteboolean("boolean2"); return; } public boolean get_procedural() { return proxyFlora.gettransactional("procedural"); } public void set_procedural() { proxyFlora.settransactional("procedural"); return; } public void delete_procedural() { proxyFlora.deletetransactional("procedural"); return; } public boolean get_procedural2() { return proxyFlora.gettransactional("procedural2"); } public void set_procedural2() { proxyFlora.settransactional("procedural2"); return; } public void delete_procedural2() { proxyFlora.deletetransactional("procedural2"); return; } public void set_age(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); proxyFlora.set("age",false,pars,value); } public void set_age(Object year,Object value) { Vector pars = new Vector(); pars.add(year); proxyFlora.set("age",false,pars,value); } public Iterator get_age(Object year){ Vector pars = new Vector(); pars.add(year); return proxyFlora.get("age",false,pars); } public Iterator getAll_age(){ Vector pars = new Vector(); pars.add("Par_year"); return proxyFlora.getAll("age",false,pars); } public void delete_age(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); proxyFlora.delete("age",false,pars,value); } public void delete_age(Object year,Object value) { Vector pars = new Vector(); pars.add(year); proxyFlora.delete("age",false,pars,value); } public void delete_age(Object year){ Vector pars = new Vector(); pars.add(year); proxyFlora.delete("age",false,pars); } public void set_bonus(Object year, Object month,Vector value) { Vector pars = new Vector(); pars.add(year); pars.add(month); proxyFlora.set("bonus",false,pars,value); } public void set_bonus(Object year, Object month,Object value) { Vector pars = new Vector(); pars.add(year); pars.add(month); proxyFlora.set("bonus",false,pars,value); } public Iterator get_bonus(Object year, Object month){ Vector pars = new Vector(); pars.add(year); pars.add(month); return proxyFlora.get("bonus",false,pars); } public Iterator getAll_bonus(){ Vector pars = new Vector(); pars.add("Par_year"); pars.add("Par_month"); return proxyFlora.getAll("bonus",false,pars); } public void delete_bonus(Object year, Object month,Vector value) { Vector pars = new Vector(); pars.add(year); pars.add(month); proxyFlora.delete("bonus",false,pars,value); } public void delete_bonus(Object year, Object month,Object value) { Vector pars = new Vector(); pars.add(year); pars.add(month); proxyFlora.delete("bonus",false,pars,value); } public void delete_bonus(Object year, Object month){ Vector pars = new Vector(); pars.add(year); pars.add(month); proxyFlora.delete("bonus",false,pars); } public void set_ancestors(Vector value) { Vector pars = new Vector(); proxyFlora.set("ancestors",true,pars,value); } public void set_ancestors(Object value) { Vector pars = new Vector(); proxyFlora.set("ancestors",true,pars,value); } public Iterator get_ancestors(){ Vector pars = new Vector(); return proxyFlora.get("ancestors",true,pars); } public Iterator getAll_ancestors(){ Vector pars = new Vector(); return proxyFlora.getAll("ancestors",true,pars); } public void delete_ancestors(Vector value) { Vector pars = new Vector(); proxyFlora.delete("ancestors",true,pars,value); } public void delete_ancestors(Object value) { Vector pars = new Vector(); proxyFlora.delete("ancestors",true,pars,value); } public void delete_ancestors(){ Vector pars = new Vector(); proxyFlora.delete("ancestors",true,pars); } public void set_inheritableMeth(Vector value) { Vector pars = new Vector(); proxyFlora.set("inheritableMeth",true,pars,value); } public void set_inheritableMeth(Object value) { Vector pars = new Vector(); proxyFlora.set("inheritableMeth",true,pars,value); } public Iterator get_inheritableMeth(){ Vector pars = new Vector(); return proxyFlora.get("inheritableMeth",true,pars); } public Iterator getAll_inheritableMeth(){ Vector pars = new Vector(); return proxyFlora.getAll("inheritableMeth",true,pars); } public void delete_inheritableMeth(Vector value) { Vector pars = new Vector(); proxyFlora.delete("inheritableMeth",true,pars,value); } public void delete_inheritableMeth(Object value) { Vector pars = new Vector(); proxyFlora.delete("inheritableMeth",true,pars,value); } public void delete_inheritableMeth(){ Vector pars = new Vector(); proxyFlora.delete("inheritableMeth",true,pars); } } --- NEW FILE: floraVariables.bat --- @echo off REM File: buildExample.bat REM REM Author(s): Aditi Pandit REM REM Contact: flo...@li... REM REM Copyright (C) The Research Foundation of SUNY, 2005 REM REM FLORA-2 is free software; you can redistribute it and/or modify it under the REM terms of the GNU Library General Public License as published by the Free REM Software Foundation; either version 2 of the License, or (at your option) REM any later version. REM REM FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY REM WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS REM FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for REM more details. REM REM REM You should have received a copy of the GNU Library General Public License REM along with FLORA-2; if not, write to the Free Software Foundation, REM Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. REM REM REM set FLORA_FILE=fooExample\\foo set JAVA_FILE=fooExample\\foo.java set FLORA_CLASS=foo --- NEW FILE: README --- Program files: fooExample.java foo.flr Settings for Windows and Unix: floraVariables.bat floraVariables.sh foo.java - file automatically generated by the Java-Flora API --- NEW FILE: floraVariables.sh --- # File: floraVariables.sh # # Author(s): Aditi Pandit # # Contact: flo...@li... # # Copyright (C) The Research Foundation of SUNY, 2005 # # FLORA-2 is free software; you can redistribute it and/or modify it under the # terms of the GNU Library General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for # more details. # # # You should have received a copy of the GNU Library General Public License # along with FLORA-2; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # FLORA_FILE=fooExample/foo JAVA_FILE=fooExample/foo.java FLORA_CLASS=foo |
Update of /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv28569/java/API/net/sourceforge/flora/javaAPI/src Added Files: PrologFlora.java FloraSession.java FloraObject.java FloraMethod.java FloraClassLoader.java .cvsignore Log Message: added the java API --- NEW FILE: .cvsignore --- *.xwam *.O *.P cmd... *.fdb *.flh *.fld *.con *.class --- NEW FILE: FloraObject.java --- /* File: FloraObject.java ** ** Author(s): Aditi Pandit ** ** Contact: flo...@li... ** ** Copyright (C) The Research Foundation of SUNY, 2005, 2006 ** ** FLORA-2 is free software; you can redistribute it and/or modify it under the ** terms of the GNU Library General Public License as published by the Free ** Software Foundation; either version 2 of the License, or (at your option) ** any later version. ** ** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for ** more details. ** ** ** You should have received a copy of the GNU Library General Public License ** along with FLORA-2; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** ** */ package net.sourceforge.flora.javaAPI.src; import java.util.*; import java.util.regex.*; import java.lang.reflect.*; import java.io.File; import java.io.IOException; import net.sourceforge.flora.javaAPI.util.*; import com.declarativa.interprolog.TermModel; /** This class is the glue between the high-level generated Java classes and the low-level interface. It contains the logic to translate calls from the high-level Java classes to f-logic queries to be called using the lower-level interface */ public class FloraObject{ boolean debug = false; FloraSession session; // The next three are set by proxy object constructors within // automatically generated files (by %write(?,?,?)) public TermModel floraOID; public TermModel floraClassName; // = new TermModel(); public String moduleName; // = "main"; public FloraObject(TermModel name,FloraSession sess) { floraOID = name; session = sess; } public FloraObject(String name, FloraSession sess) { floraOID = new TermModel(name); session = sess; } public String toString () { return this.floraOID.toString(); } /* Get a boolean property of the object ** methodName is the name of the boolean method */ public boolean getboolean(Object methodName) { String floraQuery = floraOID + "[" + methodName.toString() + "]" + session.moduleStr + moduleName + "."; try { return session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Command failed, " + floraQuery); } } /* Set a boolean property of the object ** methodName : name of the boolean method */ public void setboolean(Object methodName) { String floraQuery= "insert{"+floraOID+"["+methodName.toString() +"]"+session.moduleStr+moduleName + "}."; try { session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Command failed, " + floraQuery); } } /* Delete a boolean property of the object ** methodName : name of the boolean method */ public void deleteboolean(Object methodName) { String floraQuery= "deleteall{"+floraOID+"["+methodName.toString() +"]"+session.moduleStr+moduleName +"}."; try { session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Command " + floraQuery + " failed"); } } /* Get a transactional property of the object ** methodName is the name of the boolean method */ public boolean gettransactional(Object methodName) { String floraQuery = floraOID + "[%" + methodName.toString() + "]" + session.moduleStr + moduleName + "."; try { return session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Command " + floraQuery + " failed"); } } /* Set a transactional property of the object */ /* methodName : boolean method */ public void settransactional(Object methodName) { String floraQuery= "insert{"+floraOID+"[%"+methodName.toString() +"]"+session.moduleStr+moduleName + "}."; try { session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); } } /* Delete a transactional property of the object ** methodName : name of the boolean method */ public void deletetransactional(Object methodName) { String floraQuery= "deleteall{"+floraOID+"[%"+methodName.toString() +"]"+session.moduleStr+moduleName+"}."; try { session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in deleteall. Query was " + floraQuery); } } /* Delete a single value from method's result ** methodName : name of method ** inherit : whether the method is inheritable or not ** parameters : the parameters to the method ** value : the value of the method to be deleted */ public void delete(Object methodName,boolean inherit,Vector parameters,Object value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; if (inherit) operatorstring += session.inheritDataAtom; else operatorstring += session.noninheritDataAtom; floraQuery = "deleteall{"+floraOID + "[" + methodName.toString() + paramList + operatorstring + value + "]" + session.moduleStr + this.moduleName + "}."; try { session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in delete. Query was " + floraQuery); } } /* 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 void delete(Object methodName,boolean inherit,Vector parameters,Vector value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String valuelist = makeValueListString(value); String operatorstring = ""; if (inherit) operatorstring += session.inheritDataAtom; else operatorstring += session.noninheritDataAtom; floraQuery = "deleteall{" + floraOID + "[" + methodName.toString() + paramList + operatorstring+valuelist + "]" + session.moduleStr + this.moduleName + "}."; try { session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in delete. Query was " + floraQuery); } } /* Delete all bindings of a method ** methodName : name of method ** inherit : whether the method is inheritable or not ** parameters : the parameters to the method */ public void delete(Object methodName,boolean inherit,Vector parameters) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; if (inherit) { operatorstring += session.inheritDataAtom; } else { operatorstring += session.noninheritDataAtom; } floraQuery = "deleteall{" + floraOID + "[" + methodName.toString() + paramList + operatorstring + "?Value___395792" + "]" + session.moduleStr + this.moduleName + "}."; try { session.ExecuteCommand(floraQuery); } catch (Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in delete. Query was " + floraQuery); } } /* Add a single value to method ** methodName : method whose value is to be set ** inherit : whether the method is inheritable ** parameters : parameters to the method ** value : value to be set to */ public void set(Object methodName,boolean inherit,Vector parameters,Object value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; if(inherit) operatorstring += session.inheritDataAtom; else operatorstring += session.noninheritDataAtom; floraQuery = "insert{"+floraOID + "[" + methodName + paramList + operatorstring + value.toString() + "]" + session.moduleStr + this.moduleName + "}."; try { session.ExecuteCommand(floraQuery); } catch (Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in set. Query was " + floraQuery); } } /* methodName : method to be set ** inherit : whether the method is inheritable or not ** parameters : parameters to the method ** value : vector of values to be set to */ public void set(Object methodName,boolean inherit,Vector parameters,Vector value) { String floraQuery= ""; String paramList = makeParameterListString(parameters); String valuelist = makeValueListString(value); String operatorstring = ""; if (inherit) operatorstring += session.inheritDataAtom; else operatorstring += session.noninheritDataAtom; floraQuery = "insert{"+floraOID + "[" + methodName.toString() + paramList + operatorstring + valuelist + "]" + session.moduleStr + this.moduleName +"}."; try { session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in set. Query was " + floraQuery); } } /* Get all instances of the class of this object */ public Iterator getInstances() { String floraQuery = "?Object" + session.isASign + floraClassName.toString() + session.moduleStr + moduleName + "."; try { return session.ExecuteQuery(floraQuery); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in getInstances. Query was " + floraQuery); } } /* Get all instances of the current class that are it's ** direct instances and not instances of any subclasses */ public Iterator getOwnInstances() { // Construct a query of the form ?X:C, not ((?_S::C, ?X:?_S)). String floraQuery = "( ?Object" + session.isASign + floraClassName.toString() + ", not ((?__Subcl" + session.isASubClassOfSign + floraClassName.toString() + ", ?Object" + session.isASign + "?__Subcl)) )" + session.moduleStr + moduleName + "."; try { return session.ExecuteQuery(floraQuery); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in getInstances. Query was " + floraQuery); } } /* Get all SubClasses of the class of this object */ public Iterator getSubClasses() { String floraQuery = "?Class" + session.isASubClassOfSign + floraClassName.toString() + session.moduleStr + moduleName + "."; try { return session.ExecuteQuery(floraQuery); } catch (Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in getSubClasses. Query was " + floraQuery); } } /* Get all SuperClasses of the class of this object */ public Iterator getSuperClasses() { String floraQuery = floraClassName.toString() + session.isASubClassOfSign + "?Class" + session.moduleStr+moduleName+"."; try { return session.ExecuteQuery(floraQuery); } catch (Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in getSuperClasses. Query was " + floraQuery); } } /* Get all direct SuperClasses of the class of this object */ public Iterator getDirectSuperClasses() { // construct query of the form SC::?S, not ((SC::?_Mid, ?_Mid::?S)). String floraQuery = "( " + floraClassName + session.isASubClassOfSign + "?Class, " + "not ((" + floraClassName + session.isASubClassOfSign + "?__Mid, ?__Mid" + session.isASubClassOfSign + "?Class)))" + session.moduleStr+moduleName+"."; try { return session.ExecuteQuery(floraQuery); } catch (Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in getSuperClasses. Query was " + floraQuery); } } /* Get all non-inheritable methods of the ** class to which this object belongs */ public Iterator getNonInheritValuedMethods() { return getMethods(false); } /* Get all inheritable methods of the class ** to which this object belongs */ public Iterator getInheritValuedMethods() { return getMethods(true); } /* Get all the methods of the class to which this object belongs ** This doesn't return boolean or transactional methods. */ public Iterator getAllMethods() { Vector allMethods = new Vector(); Iterator allNonInherit = getNonInheritValuedMethods(); while(allNonInherit.hasNext()) allMethods.add((FloraMethod)(allNonInherit.next())); Iterator allInherit = getInheritValuedMethods(); while(allInherit.hasNext()) allMethods.add((FloraMethod)(allInherit.next())); return allMethods.iterator(); } /* Get methods of a particular type (inheritable or noninheritable). ** Returns only set-valued methods - not boolean or transactional ** inherit : indicates if the method is inheritable */ private Iterator getMethods(boolean inherit) { String floraQuerytype = ""; if(inherit) floraQuerytype = session.inheritSignatureAtom; else floraQuerytype = session.noninheritSignatureAtom; Vector vars = new Vector(); vars.add("?Method"); vars.add("?Value"); vars.add("?Arguments"); String floraQueryString = "(" + floraClassName.toString() + "[?__Call" + floraQuerytype + "?Value]" + ", ?__Call =.. [hilog(?Method) | ?Arguments]" + ")" +session.moduleStr + moduleName +"."; Iterator methodMatches; Vector returnMethodVec = new Vector(); try { methodMatches = session.FindAllMatches(floraQueryString,vars); HashMap firstmatch; while (methodMatches.hasNext()) { firstmatch = (HashMap)methodMatches.next(); FloraObject methodObj = (FloraObject)firstmatch.get("?Method"); FloraObject returnTypeObj = (FloraObject)firstmatch.get("?Value"); TermModel methodArgs = ((FloraObject)firstmatch.get("?Arguments")).floraOID; Vector methodPars = new Vector(); while (!methodArgs.isLeaf()) { methodPars.add(new FloraObject((TermModel)methodArgs.getChild(0),session)); methodArgs = (TermModel) methodArgs.getChild(1); } returnMethodVec.add(new FloraMethod(methodObj,methodPars, returnTypeObj,inherit)); } } catch (Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in getAllMethods. Query was " + floraQueryString); } return returnMethodVec.iterator(); } /* Get all values for a method, where all arguments are bound. ** ** methodName : name of method whose value is to be got ** inherit : if the method is inheritable or not ** parameters : the parameters for the method */ public Iterator get(Object methodName,boolean inherit,Vector parameters) { String floraQuery = ""; String paramList = makeParameterListString(parameters); String operatorstring = ""; if (inherit) operatorstring += session.inheritDataAtom; else operatorstring += session.noninheritDataAtom; floraQuery = floraOID + "[" + methodName.toString() + paramList + operatorstring + "?Value]" + session.moduleStr + this.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 " + this.moduleName); } } /* Get all values for a method where the arguments might be unbound. ** For instance, obj[m(aaa,?Y) -> ?Z] ** ** methodName : name of method whose value is to be got ** inherit : if the method is inheritable or not ** parameters : the parameters for the method */ public Iterator getAll(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 += session.inheritDataAtom; else operatorstring += session.noninheritDataAtom; // Use weird name Value___395792 to avoid clashes with argList vars floraQuery = floraOID + "[" + methodName.toString() + paramList + operatorstring + "?Value___395792]" + session.moduleStr + this.moduleName + "."; argList.add("?Value___395792"); try { return session.FindAllMatches(floraQuery,argList); } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in getAll. Query was " + floraQuery); } } private String makeParameterListString(Vector parameters) { String paramList = "("; int noOfPars = parameters.size(); for (int i=0; i<noOfPars; i++) paramList += parameters.elementAt(i).toString()+(i < noOfPars-1 ? "," : ")"); if (noOfPars==0) paramList = ""; return paramList; } private String makeValueListString(Vector value) { String valuelist = "{"; int noOfVals = value.size(); for (int i=0; i<noOfVals; i++) valuelist += value.elementAt(i).toString()+(i < noOfVals-1 ? "," : ""); valuelist += "}"; return valuelist; } } --- NEW FILE: FloraMethod.java --- /* File: FloraMethod.java ** ** Author(s): Aditi Pandit ** ** Contact: flo...@li... ** ** Copyright (C) The Research Foundation of SUNY, 2005, 2006 ** ** FLORA-2 is free software; you can redistribute it and/or modify it under the ** terms of the GNU Library General Public License as published by the Free ** Software Foundation; either version 2 of the License, or (at your option) ** any later version. ** ** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for ** more details. ** ** ** You should have received a copy of the GNU Library General Public License ** along with FLORA-2; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** ** */ package net.sourceforge.flora.javaAPI.src; import java.util.*; import com.declarativa.interprolog.TermModel; /* Class to encapsulate a Flora method */ public class FloraMethod{ public FloraObject MethodName; public Vector parameters; // of FloraObject public FloraObject ReturnType; public boolean inheritable; public FloraMethod(FloraObject ConsMethodName,Vector Conspars, FloraObject ConsReturnType, boolean Consinheritable) { MethodName = ConsMethodName; parameters = Conspars; ReturnType = ConsReturnType; inheritable = Consinheritable; return; } public void PrintMethod() { System.out.println("Method Name : " + MethodName.toString()); System.out.println("Parameters: " + parameters.toString()); System.out.println("ReturnType:" + ReturnType.toString()); if(inheritable) System.out.println("Inheritable"); else System.out.println("Non-Inheritable"); return; } } --- NEW FILE: PrologFlora.java --- /* File: PrologFlora.java ** ** Author(s): Aditi Pandit ** ** Contact: flo...@li... ** ** Copyright (C) The Research Foundation of SUNY, 2005, 2006 ** ** FLORA-2 is free software; you can redistribute it and/or modify it under the ** terms of the GNU Library General Public License as published by the Free ** Software Foundation; either version 2 of the License, or (at your option) ** any later version. ** ** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for ** more details. ** ** ** You should have received a copy of the GNU Library General Public License ** along with FLORA-2; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** */ package net.sourceforge.flora.javaAPI.src; import com.declarativa.interprolog.PrologEngine; import com.declarativa.interprolog.TermModel; import com.declarativa.interprolog.util.IPException; import com.xsb.interprolog.NativeEngine; import com.declarativa.interprolog.XSBSubprocessEngine; import net.sourceforge.flora.javaAPI.util.*; import java.io.File; import java.util.*; import java.lang.*; /** This class is used to call FLORA-2 commands at a low level from JAVA using Interprolog libraries */ public class PrologFlora { static boolean debug = false; /* Function for setting Initialization commands */ void initCommandStrings(String FloraRootDir) { commands = (new String[] { "(import bootstrap_flora/0 from flora2)", String.valueOf(String.valueOf((new StringBuffer("asserta(library_directory('")).append(FloraRootDir).append("'))"))), "consult(flora2)", "bootstrap_flora", "import (flLoad)/1 from flora2", "import flora_query/4 from flora2" }); } /* Function to execute the initialization commands */ void executeInitCommands() { if(commands == null) throw new FlrException("j2flora2: System bug, please report"); for(int i = 0; i < commands.length; i++) { boolean cmdsuccess = simplePrologCommand(commands[i]); if(!cmdsuccess) throw new FlrException("j2flora2: FLORA-2 startup failed"); } } /* Function to use flLoad to load FLORA-2 file into moduleName ** fileName : name of the file to load ** moduleName : name of FLORA module in which to load */ public void loadFile(String fileName,String moduleName) { String cmd = "flLoad('"+fileName + "'>>" + moduleName+")"; try { boolean flag = engine.command(cmd); } catch(IPException ipe) { ipe.printStackTrace(); throw new FlrException("j2flora2: Command "+ cmd + " failed"); } return; } /* Call the flora_query/4 predicate of FLORA-2 ** Binds FLORA-2 variables to the returned values ** and returns an array of answers. Each answer is an Interprolog ** term model from which variable bindings can be obtained. ** (See FindAllMatches and ExecuteQuery/1 for how to do this.) ** ** cmd : Flora query to be executed ** vars : Variables in the Flora query that need to be bound */ public Object[] FloraCommand(String cmd,Vector vars) { StringBuffer sb = new StringBuffer(); String varsString = "["; for (int i=0; i<vars.size(); i++) { String floravar = (String)vars.elementAt(i); if (!floravar.startsWith("?")) throw new FlrException("j2flora2: Illegal variable name " + floravar + ". 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 = "[]"; } String listString = "L_rnd="+varsString + ","; String queryString = "S_rnd='"+cmd + "',"; String floraQueryString = "findall(TM_rnd,(flora_query(S_rnd,L_rnd,_St,_Ex),buildTermModel(L_rnd,TM_rnd)),BL_rnd),ipObjectSpec('ArrayOfObject',BL_rnd,LM)"; sb.append(queryString); sb.append(listString); sb.append(floraQueryString); if (debug) System.out.println("FloraCommand: " + sb); try { Object solutions[] = (Object[])engine.deterministicGoal(sb.toString(), "[LM]")[0]; return solutions; } catch(Exception e) { e.printStackTrace(); return null; } } /* A simpler way to call FLORA commands that are not queries ** ** cmd : Command to be executed */ public boolean simpleFloraCommand(String cmd) { String queryString = "S_rnd='"+cmd + "',"; String listString = "L_rnd=[],"; StringBuffer sb = new StringBuffer(); sb.append(queryString); sb.append(listString); sb.append("flora_query(S_rnd,L_rnd,_St,_Ex)"); if (debug) System.out.println("simpleFloraCommand: " + sb); try { return engine.deterministicGoal(sb.toString()); } catch(IPException ipe) { ipe.printStackTrace(); throw new FlrException("j2flora2: Command " + cmd + " failed"); } } public boolean simplePrologCommand(String cmd) { try { return engine.command(cmd); } catch(IPException ipe) { ipe.printStackTrace(); throw ipe; } } /* Query the term model structure ** ** tm : TermModel to be queried ** name : binding variable name to be queried */ public static TermModel findValue(TermModel tm, String name) { if (debug) System.out.println("in findValue, Term model: " + tm); for( ; tm.isList(); tm = (TermModel)tm.getChild(1)) { TermModel item = (TermModel)tm.getChild(0); if (debug && name != null) System.out.println("name in findValue: " + name); if(name == null || (item.getChild(0).toString().compareTo(name) == 0)) { TermModel val = (TermModel)item.getChild(1); return val; } } return new TermModel(); } /* Initialise the PrologEngine */ void initEngine() { String PrologRootDir = System.getProperty("PROLOGDIR"); String CmdFloraRootDir = System.getProperty("FLORADIR"); String PrologBinDir = PrologRootDir + File.separator + "xsb"; if(PrologRootDir == null || PrologRootDir.trim().length() == 0) throw new FlrException("j2flora2: Must define PROLOGDIR property"); String FloraRootDir; if (CmdFloraRootDir == null || CmdFloraRootDir.trim().length() == 0) { throw new FlrException("j2flora2: Must define FLORADIR property"); } else FloraRootDir = CmdFloraRootDir; initCommandStrings(FloraRootDir); String engineType; engineType = System.getProperty("ENGINE"); engineType = engineType.toUpperCase(); if (engineType.equals("NATIVE")) { try { engine = new NativeEngine(PrologRootDir); isNative = true; } catch(Throwable e) { throw new FlrException("j2flora2: InterProlog failed to start its Native Engine"); } } else { try { engine = new XSBSubprocessEngine(PrologBinDir); } catch(Exception e2) { throw new FlrException("j2flora2: InterProlog failed start its SubProcess Engine"); } } executeInitCommands(); } /* Constructor function */ public PrologFlora() { commands = null; initEngine(); return; } /* Shut down the Prolog Engine */ public void close() { /* The native engine does not have a shutdown function */ /* Change this whenever it becomes available */ if(isNative) { engine.shutdown(); // shutdown isn't implemented in Native engine // don't exit: let the Java program continue after the shutdown //System.exit(0); } else { //engine.interrupt(); engine.shutdown(); // don't exit: let the Java program continue after the shutdown //System.exit(0); } } public static String sFloraRootDir = null; PrologEngine engine; boolean isNative = false; String commands[]; } --- NEW FILE: FloraSession.java --- /* File: FloraSession.java ** ** Author(s): Aditi Pandit ** ** Contact: flo...@li... ** ** Copyright (C) The Research Foundation of SUNY, 2005, 2006 ** ** FLORA-2 is free software; you can redistribute it and/or modify it under the ** terms of the GNU Library General Public License as published by the Free ** Software Foundation; either version 2 of the License, or (at your option) ** any later version. ** ** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for ** more details. ** ** ** You should have received a copy of the GNU Library General Public License ** along with FLORA-2; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** ** */ package net.sourceforge.flora.javaAPI.src; import java.util.*; import com.declarativa.interprolog.TermModel; import net.sourceforge.flora.javaAPI.util.*; /** This class is a higher level wrapper to call the lower level functions of the PrologFlora class */ public class FloraSession{ PrologFlora flora; boolean debug = false; public String isASign = ":"; public String isASubClassOfSign = "::"; public String inheritDataAtom = "*->"; public String noninheritDataAtom = "->"; public String inheritSignatureAtom = "*=>"; public String noninheritSignatureAtom = "=>"; public String moduleStr = "@"; /* Constructor function. */ public FloraSession() { flora = new PrologFlora(); if(debug) 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) { Vector vars = new Vector(); boolean result = false; try { result = flora.simpleFloraCommand(command); if (debug) System.out.println("ExecuteCommand: "+command); } catch (Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Command " + command + " failed"); } return result; } /* Execute a command at the FLORA-2 session ** The answer is a resultset that can be queried ** ** query : Flora query to be executed ** vars : Vector of variables to be bound */ public Iterator FindAllMatches(String query,Vector vars) { Vector retBindings = new Vector(); Object[] bindings = null; try { bindings = flora.FloraCommand(query,vars); for (int i=0; i<bindings.length; i++) { TermModel tm = (TermModel)bindings[i]; HashMap currBinding = new HashMap(); for (int j=0; j<vars.size(); j++) { String varValue = (String)vars.elementAt(j); if (debug) { System.out.println("FindAllMatches, term model: " + tm); System.out.println("FindAllMatches, varValue="+varValue); } TermModel objName = flora.findValue(tm,varValue); FloraObject obj = new FloraObject(objName,this); currBinding.put(varValue,obj); } retBindings.add(currBinding); } } catch (Exception e) { e.printStackTrace(); System.err.println(); throw new FlrException("j2flora2: Error in query "+query); } Iterator iter = retBindings.iterator(); return iter; } public void close() { flora.close(); } /* Load a FLORA-2 file into a module ** fileName : file to be loaded ** moduleName : module name to load the file into */ public void loadFile(String fileName,String moduleName) { flora.loadFile(fileName,moduleName); return; } /* Execute a query with variables ** ** query : query to be executed ** vars : variables in the query */ public Iterator ExecuteQuery(String query,Vector vars) { return FindAllMatches(query,vars); } /* ** Like ExecuteQuery/2 above, but is used only when a query has ** just one variable. This provides a simplified interface, since ** no variables need to be passed into ExecuteQuery/1 and the ** output is just an iterator, which contains just a list of ** bindings for that single variable. ** ** query : query to be executed */ public Iterator ExecuteQuery(String query) { Vector retBindings = new Vector(); Object[] bindings = null; Vector vars = new Vector(); vars.add("?"); try { bindings = flora.FloraCommand(query,vars); for (int i=0; i<bindings.length; i++) { TermModel tm = (TermModel)bindings[i]; TermModel objName = flora.findValue(tm,null); if (debug) { System.out.println("ExecuteQuery/1, term model: " + tm); System.out.println("ExecuteQuery/1, objName="+objName); } FloraObject obj = new FloraObject(objName,this); retBindings.add(obj); } } catch(Exception e) { e.printStackTrace(); throw new FlrException("j2flora2: Error in query "+query); } Iterator iter = retBindings.iterator(); return iter; } } --- NEW FILE: FloraClassLoader.java --- /* File: FloraClassLoader.java ** ** Author(s): Aditi Pandit ** ** Contact: flo...@li... ** ** Copyright (C) The Research Foundation of SUNY, 2005, 2006 ** ** FLORA-2 is free software; you can redistribute it and/or modify it under the ** terms of the GNU Library General Public License as published by the Free ** Software Foundation; either version 2 of the License, or (at your option) ** any later version. ** ** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for ** more details. ** ** ** You should have received a copy of the GNU Library General Public License ** along with FLORA-2; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** ** */ package net.sourceforge.flora.javaAPI.src; import java.util.*; import java.util.regex.*; import java.lang.*; import java.lang.reflect.*; import java.io.*; import java.io.File; import java.io.IOException; /* Class to load the java classes corresponding to flora classes into the JVM. Used by the Protege interface only */ public class FloraClassLoader { String floraFilesDir = ""; String floradir = ""; String javaClassPath = ""; String floraLoadClassName = ""; FloraSession session; /* Constructor function */ /* sessionpar : FloraSession to load flora classes from */ public FloraClassLoader(FloraSession sessionpar) { session = sessionpar; String query = "[flrjava>>write_java_mod]."; session.ExecuteCommand(query); floradir = System.getProperty("FLORADIR"); return; } /* Set the directory which contains the generated java and class ** files corresponding to the FLORA classes ** ** floraDirPar : path of the FLORA directory */ public void setFloraDir(String floraDirPar) { floraFilesDir = floraDirPar; } /* Set the javaClassPath to be used when compiling ** the java files generated by the %write predicate ** javaClassPathPar : classpath to be used. ** It must contain the javaAPI code */ public void setJavaClassPath(String javaClassPathPar) { javaClassPath = javaClassPathPar; } /* Write java code for floraClass, compile it, and load into JVM ** floraFileName : Flora file to load from ** floraClassName : Name of flora class to be loaded ** floraModuleName : Name of flora module to load into */ public Class loadFloraClass(String floraFileName, String floraClassName, String floraModuleName) throws ClassNotFoundException { floraLoadClassName = floraClassName; String floraQuery; /* Creating the java file */ try { String osname = (System.getProperty("os.name")).split(" ")[0].toUpperCase(); if (osname.startsWith("WINDOWS")) floraQuery = "%write("+floraClassName+ "," +floraModuleName+ ",''"+floraFilesDir+"\\\\" + floraClassName + ".java'')@write_java_mod."; else floraQuery = "%write("+floraClassName+ "," +floraModuleName+ ",''"+floraFilesDir+File.separator + floraClassName + ".java'')@write_java_mod."; session.ExecuteCommand(floraQuery); } catch(Exception e) { e.printStackTrace(); return null; } /* Compiling it to get the class file */ String javaDir = System.getProperty("JAVA_BIN"); File javaFile = new File(floraFilesDir + File.separator + floraClassName + ".java"); File classPathDir = new File(javaClassPath); String javaCompileCmd = ""; try { javaCompileCmd = javaDir + File.separator + "javac -classpath " + classPathDir.getCanonicalPath() + " " + javaFile.getCanonicalPath(); } catch(Exception e) { System.out.println("j2flora2: Class loaded failed to construct compile string"); return null; } System.out.println("Compile command:"+javaCompileCmd); Runtime rjavac = Runtime.getRuntime(); Process pjavac = null; try { pjavac = rjavac.exec(javaCompileCmd); pjavac.waitFor(); } catch(Exception e) { e.printStackTrace(); return null; } if (pjavac.exitValue()!=0) { System.out.println("FLORA-2 class loader: Compile command failed"); return null; } /* Using the Class.forName method to load a class */ Class floraClass = null; String name = floraClassName; try { floraClass = ClassLoad(name); } catch(Exception e) { e.printStackTrace(); return null; } return floraClass; } /* Use Class.forName java function to load the particular ** class into JVM */ private Class ClassLoad(String ClassName) throws ClassNotFoundException { Class floraClass = null; try { floraClass = Class.forName(ClassName); } catch(Exception e) { throw(new ClassNotFoundException("j2flora2: Loading failed for class "+ClassName)); } return floraClass; } } |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:34:00
|
Update of /cvsroot/flora/flora2/java In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv28569/java Added Files: windowsVariables.bat unixVariables.sh interprolog.jar flora_settings.sh flora_settings.bat README Log Message: added the java API --- NEW FILE: windowsVariables.bat --- @echo off REM File: windowsVariables.bat REM REM Author(s): Aditi Pandit REM REM Contact: flo...@li... REM REM Copyright (C) The Research Foundation of SUNY, 2005 REM REM FLORA-2 is free software; you can redistribute it and/or modify it under the REM terms of the GNU Library General Public License as published by the Free REM Software Foundation; either version 2 of the License, or (at your option) REM any later version. REM REM FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY REM WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS REM FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for REM more details. REM REM REM You should have received a copy of the GNU Library General Public License REM along with FLORA-2; if not, write to the Free Software Foundation, REM Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. REM REM REM REM Change JAVA_BIN, ENGINE, and PROTEGE_DIR, if necessary set JAVA_BIN="C:\Program Files\Java\jdk1.5.0_06\bin" REM Valid values: Native or Subprocess REM set ENGINE=Subprocess set ENGINE=Native set PROTEGE_DIR="C:\Program Files\Protege_3.1" REM Don't change this! set JARS="%PROTEGE_DIR%\protege.jar";"%PROTEGE_DIR%\looks.jar";"%PROTEGE_DIR%\unicode_panel.jar";"%PROTEGE_DIR%\driver.jar";"%PROTEGE_DIR%\driver1.jar";"%PROTEGE_DIR%\driver2.jar" --- NEW FILE: unixVariables.sh --- # File: unixVariables.sh # # Author(s): Aditi Pandit # # Contact: flo...@li... # # Copyright (C) The Research Foundation of SUNY, 2005 # # FLORA-2 is free software; you can redistribute it and/or modify it under the # terms of the GNU Library General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for # more details. # # # You should have received a copy of the GNU Library General Public License # along with FLORA-2; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # # Change PROTEGE_DIR and ENGINE if necessary PROTEGE_DIR="$HOME/Protege" # Valid values: Native or Subprocess # Native engine doesn't work well with Linux ENGINE=Subprocess #ENGINE=Native # Normally doesn't need to be set: autodetected JAVA_BIN= # don't touch this if [ -z "$JAVA_BIN" ]; then JAVA_PROG=`which java 2> /dev/null` if [ -z "$JAVA_PROG" -o ! -x "$JAVA_PROG" ]; then echo "** Java executable could not be found on your system" echo "** Please set the variable JAVA_BIN to the Java binary directory" else JAVA_BIN=`dirname "$JAVA_PROG"` echo "** Using Java executable in $JAVA_BIN" $JAVA_BIN/java -version echo "** Please make sure that your Java version is 1.4.2 or newer" fi fi # Don't change this! JARS=$PROTEGE_DIR/protege.jar:$PROTEGE_DIR/looks.jar:$PROTEGE_DIR/unicode_panel.jar:$PROTEGE_DIR/driver.jar:$PROTEGE_DIR/driver1.jar:$PROTEGE_DIR/driver2.jar --- NEW FILE: flora_settings.sh --- FLORADIR=/home/users/kifer/FLORA/flora2-new PROLOGDIR=/home/users/kifer/XSB/XSB/config/i686-pc-linux-gnu/bin --- NEW FILE: interprolog.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: flora_settings.bat --- @echo off CALL ..\..\.prolog_path_wind --- NEW FILE: README --- Meaning of variables used: The following files are generated automatically by the makeflora script: flora_settings.sh flora_settings.bat Don't change these files! The files (for Windows and Unix, respectively) windowsVariables.bat unixVariables.sh Contain variables that might need to be changed. These variables are: JAVA_BIN - The directory containing the javac and java binaries. Normally doesn't need to be set on Unix, but has to be set on Windows. ENGINE - Native or Subprocess engine. Tells InterProlog whether to use the Native engine, based on JNI, or Subprocess engine, based on sockets. PROTEGE_DIR - Protege installation directory. If not using Protege then this variable doesn't need to be set. JARS - DON'T change this variable! If contains the JAR files needed by Protege. |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:33:59
|
Update of /cvsroot/flora/flora2/java/API In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv28569/java/API Added Files: build.sh build.bat README Log Message: added the java API --- NEW FILE: README --- To build the java API code for FLORA-2, do the following: Unix/Linux: ./build.sh Windows: build.bat --- NEW FILE: build.sh --- #! /bin/sh # File: build.sh # # Author(s): Aditi Pandit # # Contact: flo...@li... # # Copyright (C) The Research Foundation of SUNY, 2005 # # FLORA-2 is free software; you can redistribute it and/or modify it under the # terms of the GNU Library General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for # more details. # # # You should have received a copy of the GNU Library General Public License # along with FLORA-2; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # . ../unixVariables.sh . ../flora_settings.sh rm -f net/sourceforge/flora/javaAPI/util/*.class rm -f net/sourceforge/flora/javaAPI/src/*.class ${JAVA_BIN}/javac -classpath ..:../interprolog.jar net/sourceforge/flora/javaAPI/util/*.java net/sourceforge/flora/javaAPI/src/*.java --- NEW FILE: build.bat --- @echo off REM File: build.bat REM REM Author(s): Aditi Pandit REM REM Contact: flo...@li... REM REM Copyright (C) The Research Foundation of SUNY, 2005 REM REM FLORA-2 is free software; you can redistribute it and/or modify it under the REM terms of the GNU Library General Public License as published by the Free REM Software Foundation; either version 2 of the License, or (at your option) REM any later version. REM REM FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY REM WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS REM FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for REM more details. REM REM REM You should have received a copy of the GNU Library General Public License REM along with FLORA-2; if not, write to the Free Software Foundation, REM Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. REM REM REM echo ============================== echo Building javaInterfaceCode CALL ..\windowsVariables.bat CALL ..\flora_settings.bat del net\sourceforge\flora\javaAPI\util\*.class del net\sourceforge\flora\javaAPI\src\*.class echo Compiling files %JAVA_BIN%\javac -Xlint -classpath ..;..\interprolog.jar net\sourceforge\flora\javaAPI\util\*.java net\sourceforge\flora\javaAPI\src\*.java |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:33:59
|
Update of /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/util In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv28569/java/API/net/sourceforge/flora/javaAPI/util Added Files: FlrException.java .cvsignore Log Message: added the java API --- NEW FILE: .cvsignore --- *.xwam *.O *.P cmd... *.fdb *.flh *.fld *.con *.class --- NEW FILE: FlrException.java --- /* File: FlrException.java ** ** Author(s): Aditi Pandit ** ** Contact: flo...@li... ** ** Copyright (C) The Research Foundation of SUNY, 2005, 2006 ** ** FLORA-2 is free software; you can redistribute it and/or modify it under the ** terms of the GNU Library General Public License as published by the Free ** Software Foundation; either version 2 of the License, or (at your option) ** any later version. ** ** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for ** more details. ** ** ** You should have received a copy of the GNU Library General Public License ** along with FLORA-2; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** ** */ package net.sourceforge.flora.javaAPI.util; /** An Exception related to Flora processing in general */ public class FlrException extends RuntimeException{ public FlrException(String s){ super(s); } } |
Update of /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv28569/java/API/examples/flogicbasicsExample Added Files: person.java floraVariables.sh floraVariables.bat flogicbasicsExample.java flogic_basics.flr README .cvsignore Log Message: added the java API --- NEW FILE: .cvsignore --- *.xwam *.O *.P cmd... *.fdb *.flh *.fld *.con *.class --- NEW FILE: person.java --- import java.util.*; import com.declarativa.interprolog.TermModel; import net.sourceforge.flora.javaAPI.util.*; import net.sourceforge.flora.javaAPI.src.*; public class person { public FloraObject proxyFlora; public TermModel floraClassName = new TermModel("person"); public person(FloraObject proxy,String moduleName) { proxyFlora = proxy; if (proxy == null) throw new FlrException("Cannot create Java class " + floraClassName + ". Null proxy object passed to " + floraClassName + "(proxy,modulename)"); proxyFlora.moduleName = moduleName; proxyFlora.floraClassName = floraClassName; return; } public String toString() { return proxyFlora.toString(); } public void set_instances(Vector value) { Vector pars = new Vector(); proxyFlora.set("instances",false,pars,value); } public void set_instances(Object value) { Vector pars = new Vector(); proxyFlora.set("instances",false,pars,value); } public Iterator get_instances(){ Vector pars = new Vector(); return proxyFlora.get("instances",false,pars); } public Iterator getAll_instances(){ Vector pars = new Vector(); return proxyFlora.getAll("instances",false,pars); } public void delete_instances(Vector value) { Vector pars = new Vector(); proxyFlora.delete("instances",false,pars,value); } public void delete_instances(Object value) { Vector pars = new Vector(); proxyFlora.delete("instances",false,pars,value); } public void delete_instances(){ Vector pars = new Vector(); proxyFlora.delete("instances",false,pars); } public void set_age(Vector value) { Vector pars = new Vector(); proxyFlora.set("age",true,pars,value); } public void set_age(Object value) { Vector pars = new Vector(); proxyFlora.set("age",true,pars,value); } public Iterator get_age(){ Vector pars = new Vector(); return proxyFlora.get("age",true,pars); } public Iterator getAll_age(){ Vector pars = new Vector(); return proxyFlora.getAll("age",true,pars); } public void delete_age(Vector value) { Vector pars = new Vector(); proxyFlora.delete("age",true,pars,value); } public void delete_age(Object value) { Vector pars = new Vector(); proxyFlora.delete("age",true,pars,value); } public void delete_age(){ Vector pars = new Vector(); proxyFlora.delete("age",true,pars); } public void set_believes_in(Vector value) { Vector pars = new Vector(); proxyFlora.set("believes_in",true,pars,value); } public void set_believes_in(Object value) { Vector pars = new Vector(); proxyFlora.set("believes_in",true,pars,value); } public Iterator get_believes_in(){ Vector pars = new Vector(); return proxyFlora.get("believes_in",true,pars); } public Iterator getAll_believes_in(){ Vector pars = new Vector(); return proxyFlora.getAll("believes_in",true,pars); } public void delete_believes_in(Vector value) { Vector pars = new Vector(); proxyFlora.delete("believes_in",true,pars,value); } public void delete_believes_in(Object value) { Vector pars = new Vector(); proxyFlora.delete("believes_in",true,pars,value); } public void delete_believes_in(){ Vector pars = new Vector(); proxyFlora.delete("believes_in",true,pars); } public void set_hobbies(Vector value) { Vector pars = new Vector(); proxyFlora.set("hobbies",true,pars,value); } public void set_hobbies(Object value) { Vector pars = new Vector(); proxyFlora.set("hobbies",true,pars,value); } public Iterator get_hobbies(){ Vector pars = new Vector(); return proxyFlora.get("hobbies",true,pars); } public Iterator getAll_hobbies(){ Vector pars = new Vector(); return proxyFlora.getAll("hobbies",true,pars); } public void delete_hobbies(Vector value) { Vector pars = new Vector(); proxyFlora.delete("hobbies",true,pars,value); } public void delete_hobbies(Object value) { Vector pars = new Vector(); proxyFlora.delete("hobbies",true,pars,value); } public void delete_hobbies(){ Vector pars = new Vector(); proxyFlora.delete("hobbies",true,pars); } public void set_kids(Vector value) { Vector pars = new Vector(); proxyFlora.set("kids",true,pars,value); } public void set_kids(Object value) { Vector pars = new Vector(); proxyFlora.set("kids",true,pars,value); } public Iterator get_kids(){ Vector pars = new Vector(); return proxyFlora.get("kids",true,pars); } public Iterator getAll_kids(){ Vector pars = new Vector(); return proxyFlora.getAll("kids",true,pars); } public void delete_kids(Vector value) { Vector pars = new Vector(); proxyFlora.delete("kids",true,pars,value); } public void delete_kids(Object value) { Vector pars = new Vector(); proxyFlora.delete("kids",true,pars,value); } public void delete_kids(){ Vector pars = new Vector(); proxyFlora.delete("kids",true,pars); } public void set_salary(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); proxyFlora.set("salary",true,pars,value); } public void set_salary(Object year,Object value) { Vector pars = new Vector(); pars.add(year); proxyFlora.set("salary",true,pars,value); } public Iterator get_salary(Object year){ Vector pars = new Vector(); pars.add(year); return proxyFlora.get("salary",true,pars); } public Iterator getAll_salary(){ Vector pars = new Vector(); pars.add("Par_year"); return proxyFlora.getAll("salary",true,pars); } public void delete_salary(Object year,Vector value) { Vector pars = new Vector(); pars.add(year); proxyFlora.delete("salary",true,pars,value); } public void delete_salary(Object year,Object value) { Vector pars = new Vector(); pars.add(year); proxyFlora.delete("salary",true,pars,value); } public void delete_salary(Object year){ Vector pars = new Vector(); pars.add(year); proxyFlora.delete("salary",true,pars); } } --- NEW FILE: flogicbasicsExample.java --- /* File: flogicbasicsExample.java ** ** Author(s): Aditi Pandit ** ** Contact: flo...@li... ** ** Copyright (C) The Research Foundation of SUNY, 2005, 2006 ** ** FLORA-2 is free software; you can redistribute it and/or modify it under the ** terms of the GNU Library General Public License as published by the Free ** Software Foundation; either version 2 of the License, or (at your option) ** any later version. ** ** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for ** more details. ** ** ** You should have received a copy of the GNU Library General Public License ** along with FLORA-2; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** ** */ import net.sourceforge.flora.javaAPI.src.*; import java.util.*; /* Sample java file */ public class flogicbasicsExample{ public static void main(String[] args) { FloraSession session = new FloraSession(); System.out.println("FLORA-2 session started"); String fileName = System.getProperty("FLORA_FILE"); if(fileName == null || fileName.trim().length() == 0) { System.out.println("Invalid path to example file!"); System.exit(0); } session.loadFile(fileName,"foo_mod"); /* Running queries from flogic_basics */ /* Query for persons */ String command = "?X:person@foo_mod."; System.out.println("Query:"+command); Iterator personObjs = session.ExecuteQuery(command); /* Printing out the person names and information about their kids */ person currPerson = null; while (personObjs.hasNext()) { FloraObject personObj = (FloraObject)(personObjs.next()); System.out.println("Person name:"+personObj); currPerson =new person(personObj,"foo_mod"); Iterator kidsItr = currPerson.get_kids(); while(kidsItr.hasNext()) { FloraObject kidObj = (FloraObject)(kidsItr.next()); System.out.println("Person Name: " + personObj + " has kid: " + kidObj); person kidPerson = null; kidPerson = new person(kidObj,"foo_mod"); Iterator hobbiesItr = kidPerson.get_hobbies(); while(hobbiesItr.hasNext()) { FloraObject hobbyObj = null; hobbyObj = (FloraObject)(hobbiesItr.next()); System.out.println("Kid:"+kidObj + " has hobby: " + hobbyObj); } } } command = "person[instances -> ?X]@foo_mod."; System.out.println("Query:"+command); personObjs = session.ExecuteQuery(command); /* Prining out the person names */ while (personObjs.hasNext()) { Object personObj = personObjs.next(); System.out.println("Person Id: "+personObj); } /* Example of query with two variables */ Vector vars = new Vector(); vars.add("?X"); vars.add("?Y"); Iterator allmatches = session.ExecuteQuery("?X[believes_in -> ?Y]@foo_mod.",vars); System.out.println("Query:?X[believes_in -> ?Y]@foo_mod."); HashMap firstmatch; 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); } session.close(); System.exit(0); } } --- NEW FILE: floraVariables.bat --- @echo off REM File: floraVariables.bat REM REM Author(s): Aditi Pandit REM REM Contact: flo...@li... REM REM Copyright (C) The Research Foundation of SUNY, 2005 REM REM FLORA-2 is free software; you can redistribute it and/or modify it under the REM terms of the GNU Library General Public License as published by the Free REM Software Foundation; either version 2 of the License, or (at your option) REM any later version. REM REM FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY REM WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS REM FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for REM more details. REM REM REM You should have received a copy of the GNU Library General Public License REM along with FLORA-2; if not, write to the Free Software Foundation, REM Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. REM REM REM set FLORA_FILE=flogicbasicsExample\\flogic_basics set JAVA_FILE=flogicbasicsExample\\person.java set FLORA_CLASS=person --- NEW FILE: README --- Program files: flogicbasicsExample.java flogic_basics.flr Settings for Windows and Unix floraVariables.bat floraVariables.sh person.java - file generated automatically by the Java-Flora API preprocessor --- NEW FILE: floraVariables.sh --- # File: floraVariables.sh # # Author(s): Aditi Pandit # # Contact: flo...@li... # # Copyright (C) The Research Foundation of SUNY, 2005 # # FLORA-2 is free software; you can redistribute it and/or modify it under the # terms of the GNU Library General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for # more details. # # # You should have received a copy of the GNU Library General Public License # along with FLORA-2; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # FLORA_FILE=flogicbasicsExample/flogic_basics JAVA_FILE=flogicbasicsExample/person.java FLORA_CLASS=person --- NEW FILE: flogic_basics.flr --- /* File: flogic_basics.flr ** Author(s): Bertram Ludaescher ** Contact: flo...@li... ** ** Copyright (C) Bertram Ludaescher, 1998 ** ** FLORA-2 is free software; you can redistribute it and/or modify it under the ** terms of the GNU Library General Public License as published by the Free ** Software Foundation; either version 2 of the License, or (at your option) ** any later version. ** ** FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for ** more details. ** ** You should have received a copy of the GNU Library General Public License ** along with FLORA-2; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** $Id: flogic_basics.flr,v 1.1 2006/05/24 20:33:55 kifer Exp $ ** */ // =========================================================================== // SOME SIMPLE EXAMPLES SHOWING SEVERAL F-LOGIC FEATURES // =========================================================================== :- ignore_depchk %e(?,?). %time_flies_like_an_arrow. // a 0-ary PREDICATE (proposition) fruit_flies_like_an_apple[]. // an OBJECT with empty specification [] %e(a,b). %e(b,a). %e(b,c). // a binary PREDICATE (graph) %e(b,d). tc(?X,?Y) :- %e(?X,?Y). // a RULE and ... tc(?X,?Y) :- tc(?X,?Z), tc(?Z,?Y). // ... a (doubly) RECURSIVE RULE person :: object. dangerous_hobby :: object. john:employee. // INSTANCE : CLASS employee::person. // SUBCLASS :: SUPERCLASS bob:person. tim:person. betty:employee. person[age*=>integer, kids*=>person, salary(year)*=>value, hobbies*=>hobby, believes_in*=>something, instances => person ]. // some (optional) SIGNATURE information mary:employee[ // a more complex MOLECULE involving age->29, // ... a SINGLE-VALUED method kids -> {tim,leo,betty,bob}, // ... a MULTI-VALUED method salary(1998) -> a_lot // ... a PARAMETERIZED method ]. tim[hobbies -> {stamps, snowboard}]. // somebodies hobbies betty[hobbies ->{fishing,diving}]. snowboard:dangerous_hobby. // isn't it?? diving:dangerous_hobby. ?_X[self-> ?_X]. // define self tim[believes_in->luck]. mary[believes_in->[magic,wand]]. person[believes_in *-> // INHERITABLE method {something, something_else}]. person[instances -> ?X] :- ?X:person. // NON-INHERITABLE method of person // =========================================================================== // now ask some QUERIES here (or INTERACTIVELY from the FLORA SHELL) // =========================================================================== ?- %time_flies_like_an_arrow. // ==> `yes' ?- fruit_flies_like_a_banana[]. // ==> `yes' ?- tc(?X,?Y). // computes the transitive closure of e(?,?) ?- ?X:person. // What persons are there? ?- person[instances -> ?X]. // ...same Q, but asked differently (see above) ?- ?X[believes_in -> ?Y]. // Who believes in ?Y ?- ?X.kids[ // Whose kids self -> ?K, // ... who is ?K hobbies -> ?H:dangerous_hobby // ... and has dangerous hobbies ]. ?- writeln('Thanks for using FLORA!') @ prolog (). |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:33:59
|
Update of /cvsroot/flora/flora2/java/API/examples In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv28569/java/API/examples Added Files: runExample.sh runExample.bat buildExample.sh buildExample.bat README Log Message: added the java API --- NEW FILE: README --- Use the command buildExample fooExample or buildExample flogicbasicsExample to build the corresponding example. Use the command runExample fooExample or runExample flogicbasicsExample to run the examples. --- NEW FILE: buildExample.bat --- @echo off REM File: buildExample.bat REM REM Author(s): Aditi Pandit REM REM Contact: flo...@li... REM REM Copyright (C) The Research Foundation of SUNY, 2005 REM REM FLORA-2 is free software; you can redistribute it and/or modify it under the REM terms of the GNU Library General Public License as published by the Free REM Software Foundation; either version 2 of the License, or (at your option) REM any later version. REM REM FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY REM WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS REM FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for REM more details. REM REM REM You should have received a copy of the GNU Library General Public License REM along with FLORA-2; if not, write to the Free Software Foundation, REM Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. REM REM REM echo ============================== echo Building javaInterfaceCode CALL ..\..\windowsVariables.bat CALL ..\..\flora_settings.bat CALL %1%\floraVariables.bat ..\..\..\runflora -e "flLoad('%FLORA_FILE%'>>foo_mod),flLoad(javaAPI),%write(%FLORA_CLASS%,foo_mod,'%JAVA_FILE%'),flHalt." echo Compiling files %JAVA_BIN%\javac -classpath ..;..\..\interprolog.jar %1%\*.java --- NEW FILE: runExample.bat --- @echo off REM File: runExample.bat REM REM Author(s): Aditi Pandit REM REM Contact: flo...@li... REM REM Copyright (C) The Research Foundation of SUNY, 2005 REM REM FLORA-2 is free software; you can redistribute it and/or modify it under the REM terms of the GNU Library General Public License as published by the Free REM Software Foundation; either version 2 of the License, or (at your option) REM any later version. REM REM FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY REM WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS REM FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for REM more details. REM REM REM You should have received a copy of the GNU Library General Public License REM along with FLORA-2; if not, write to the Free Software Foundation, REM Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. REM REM REM echo ============================== CALL ..\..\windowsVariables.bat CALL ..\..\flora_settings.bat CALL %1%\floraVariables.bat echo Calling code %JAVA_BIN%\java -DPROLOGDIR=%PROLOGDIR% -DFLORA_FILE=%FLORA_FILE% -DFLORADIR=%FLORADIR% -DXSB_BIN_DIRECTORY=%XSB_BIN_DIRECTORY% -Djava.library.path=%PROLOGDIR% -DENGINE=%ENGINE% -classpath %CLASSPATH%;..;..\..\interprolog.jar;fooExample;flogicbasicsExample %1% --- NEW FILE: buildExample.sh --- # File: buildExample.sh # # Author(s): Aditi Pandit # # Contact: flo...@li... # # Copyright (C) The Research Foundation of SUNY, 2005 # # FLORA-2 is free software; you can redistribute it and/or modify it under the # terms of the GNU Library General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for # more details. # # # You should have received a copy of the GNU Library General Public License # along with FLORA-2; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # #! /bin/sh . ../../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." ${JAVA_BIN}/javac -classpath ..:../../interprolog.jar ${1}/*.java --- NEW FILE: runExample.sh --- # File: runExamples.sh # # Author(s): Aditi Pandit # # Contact: flo...@li... # # Copyright (C) The Research Foundation of SUNY, 2005 # # FLORA-2 is free software; you can redistribute it and/or modify it under the # terms of the GNU Library General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # FLORA-2 is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for # more details. # # # You should have received a copy of the GNU Library General Public License # along with FLORA-2; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # #! /bin/sh . ../../unixVariables.sh . ../../flora_settings.sh . ${1}/floraVariables.sh ${JAVA_BIN}/java -DPROLOGDIR=${PROLOGDIR} -DFLORA_FILE=${FLORA_FILE} -DFLORADIR=${FLORADIR} -Djava.library.path=${PROLOGDIR} -DENGINE=${ENGINE} -classpath ${CLASSPATH}:..:../../interprolog.jar:fooExample:flogicbasicsExample ${1} |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:26:21
|
Update of /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/util In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv25773/java/API/net/sourceforge/flora/javaAPI/util Log Message: Directory /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/util added to the repository |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:26:21
|
Update of /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv25773/java/API/net/sourceforge/flora/javaAPI/src Log Message: Directory /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src added to the repository |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:26:13
|
Update of /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv25737/java/API/net/sourceforge/flora/javaAPI Log Message: Directory /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI added to the repository |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:25:48
|
Update of /cvsroot/flora/flora2/java/API/net/sourceforge/flora In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv25401/java/API/net/sourceforge/flora Log Message: Directory /cvsroot/flora/flora2/java/API/net/sourceforge/flora added to the repository |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:25:17
|
Update of /cvsroot/flora/flora2/java/API/net/sourceforge In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv25307/java/API/net/sourceforge Log Message: Directory /cvsroot/flora/flora2/java/API/net/sourceforge added to the repository |
|
From: Michael K. <ki...@us...> - 2006-05-24 20:25:16
|
Update of /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv25307/java/API/examples/flogicbasicsExample Log Message: Directory /cvsroot/flora/flora2/java/API/examples/flogicbasicsExample added to the repository |