jcolibri.test.test6
Class Test6

java.lang.Object
  extended by jcolibri.test.test6.Test6
All Implemented Interfaces:
StandardCBRApplication

public class Test6
extends java.lang.Object
implements StandardCBRApplication

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).
Then we map each part of the case. Following the order of the columns in the text file we have to indicate to which attributes are mapped. This connector only uses the id of the description. It must be the first column of each row and is not included in the mapping file

Version:
1.0
Author:
Juan A. Recio-Garcia
See Also:
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

Test6

public Test6()
Method Detail

configure

public void configure()
               throws ExecutionException
Description copied from interface: StandardCBRApplication
Configures the application: case base, connectors, etc.

Specified by:
configure in interface StandardCBRApplication
Throws:
ExecutionException

preCycle

public CBRCaseBase preCycle()
                     throws ExecutionException
Description copied from interface: StandardCBRApplication
Runs the precyle where typically cases are read and organized into a case base.

Specified by:
preCycle in interface StandardCBRApplication
Returns:
The created case base with the cases in the storage.
Throws:
ExecutionException

cycle

public void cycle(CBRQuery query)
           throws ExecutionException
Description copied from interface: StandardCBRApplication
Executes a CBR cycle with the given query.

Specified by:
cycle in interface StandardCBRApplication
Throws:
ExecutionException

postCycle

public void postCycle()
               throws ExecutionException
Description copied from interface: StandardCBRApplication
Runs the code to shutdown the application. Typically it closes the connector.

Specified by:
postCycle in interface StandardCBRApplication
Throws:
ExecutionException

main

public static void main(java.lang.String[] args)
Parameters:
args -

GAIA - Group for Artificial Intelligence Applications
http://gaia.fdi.ucm.es