jcolibri.test.test4
Class Test4

java.lang.Object
  extended by jcolibri.test.test4.Test4
All Implemented Interfaces:
StandardCBRApplication

public class Test4
extends java.lang.Object
implements StandardCBRApplication

This example shows how to manage a complete case with solution and execute some adaptation methods. Now the case has also a solution bean with a few attributes. That way, the structure of the case is:

 Case
  |
  +- Description
  |       |
  |       +- caseId
  |       +- HollidayType
  |       +- Price
  |       +- NumberOfPersons
  |       +- Region
  |       |     |
  |       |     +- regionId
  |       |     +- regionName
  |       |     +- NearestCity
  |       |     +- Airport
  |       |     +- Currency
  |       +- Transportation
  |       +- Duration
  |       +- Season
  |       +- Accomodation
  |       +- Hotel
  |
  +- Solution
          |
          +- id
          +- price
          +- hotel
 
Solution is stored in the TravelSolution bean (CaseComponent). This bean could be saved into a separate table, but here were are going to show how to use the same table than the description. This way, the mapping is: Following picture shows how attibutes are mapped into the database:

To configure these mapping we must modify or create the following files:

Doing these changes the connector will manage the new case structure without problems.

This method also shows how to perform a simple adaptation based in the DirectProportion method that modifies the value of an attribute of the solution depending on the value in the query and retrieved case of other attribute of the description.

Version:
1.0
Author:
Juan A. Recio-Garcia
See Also:
TravelDescription, Region, TravelSolution, NumericDirectProportionMethod

Constructor Summary
Test4()
           
 
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

Test4

public Test4()
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