|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcolibri.test.test6.Test6
public class Test6
This example shows how to use the Plain Text connector. Here we only read the cases and store a new one in the persistence file.
The case base (iris_data_jCOLIBRI.txt) contains information about iris:
#Columns are: Sepal Length, Sepal Width, Petal Length, Petal Width, Type of Iris, Case 1,5.1,3.5,1.4,0.2,Iris-setosa Case 2,4.9,3,1.4,0.2,Iris-setosa Case 3,4.7,3.2,1.3,0.2,Iris-setosa ...These cases are mapped into the following structure: *
Case | +- Description | | | +- id * (1) | +- sepalLength (2) | +- sepalWidth (3) | +- petalLength (4) | +- petalWidth (5) | +- Solution | +- type * (6)The attributes with * are the ids of the compound objects and the numbers between parenthesis are the corresponding columns in the text file.
The mapping is configured by the plaintextconfig.xml file following the schema defined in PlainTextConnector:
<TextFileConfiguration> <FilePath>jcolibri/test/test6/iris_data_jCOLIBRI.txt</FilePath> <Delimiters>,</Delimiters> <DescriptionClassName>jcolibri.test.test6.IrisDescription</DescriptionClassName> <DescriptionMappings> <Map>sepalLength</Map> <Map>sepalWidth</Map> <Map>petalLength</Map> <Map>petalWidth</Map> </DescriptionMappings> <SolutionClassName>jcolibri.test.test6.IrisSolution</SolutionClassName> <SolutionMappings> <Map>type</Map> </SolutionMappings> </TextFileConfiguration>First, we define the path containing the data and the characters used as delimiters (comma in this example).
PlainTextConnector
Constructor Summary | |
---|---|
Test6()
|
Method Summary | |
---|---|
void |
configure()
Configures the application: case base, connectors, etc. |
void |
cycle(CBRQuery query)
Executes a CBR cycle with the given query. |
static void |
main(java.lang.String[] args)
|
void |
postCycle()
Runs the code to shutdown the application. |
CBRCaseBase |
preCycle()
Runs the precyle where typically cases are read and organized into a case base. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Test6()
Method Detail |
---|
public void configure() throws ExecutionException
StandardCBRApplication
configure
in interface StandardCBRApplication
ExecutionException
public CBRCaseBase preCycle() throws ExecutionException
StandardCBRApplication
preCycle
in interface StandardCBRApplication
ExecutionException
public void cycle(CBRQuery query) throws ExecutionException
StandardCBRApplication
cycle
in interface StandardCBRApplication
ExecutionException
public void postCycle() throws ExecutionException
StandardCBRApplication
postCycle
in interface StandardCBRApplication
ExecutionException
public static void main(java.lang.String[] args)
args
-
|
GAIA - Group for Artificial Intelligence Applications http://gaia.fdi.ucm.es |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |