public class Test3 extends Object implements StandardCBRApplication
Case | +- Description | +- caseId +- HollidayType +- Price +- NumberOfPersons +- Region | | | +- regionId | +- regionName | +- NearestCity | +- Airport | +- Currency +- Transportation +- Duration +- Season +- Accomodation +- Hotel
travel: +-----------+-------------+-------+-----------------+----------+----------------+----------+-----------+---------------+-----------------------------+ | caseId | HolidayType | Price | NumberOfPersons | regionId | Transportation | Duration | Season | Accommodation | Hotel | +-----------+-------------+-------+-----------------+----------+----------------+----------+-----------+---------------+-----------------------------+ | Journey11 | City | 1978 | 2 | 1 | Plane | 7 | April | ThreeStars | Hotel Victoria, Cairo | | Journey21 | Recreation | 1568 | 2 | 2 | Car | 14 | May | TwoStars | Hotel Ostend, Belgium | ... region: +----------+------------+-------------+---------------------------+----------------+ | regionId | RegionName | NearestCity | Airport | Currency | +----------+------------+-------------+---------------------------+----------------+ | 1 | Cairo | Cairo | Cairo Airport | Egyptian Pound | | 2 | Belgium | Brussels | Brussels National Airport | Euro | ...To map the case structure with the data base we have to modify these lines in hibernate.cfg.xml:
<hibernate-mapping default-lazy="false"> <class name="es.ucm.fdi.gaia.jcolibri.test.test3.TravelDescription" table="travel"> ... <many-to-one name="Region" column="regionId" not-null="true" cascade="save-update"/> ... </class> <class name="es.ucm.fdi.gaia.jcolibri.test.test3.Region" table="region"> <id name="id" column="regionId"> </id> <property name="region" column="RegionName"/> <property name="city" column="NearestCity"/> <property name="airport" column="Airport"/> <property name="currency" column="Currency"/> </class> </hibernate-mapping>The many-to-one tag indicates the association between the regionId column in the travel table with the values of the region table.
This example also shows how to complete the CBR cycle including reuse, revise and retain methods:
TravelDescription
,
Region
,
jcolibri.method.reuse.CombineQueryAndCasesMethod
,
jcolibri.method.revise.DefineNewIdsMethod
,
jcolibri.method.retain.StoreCasesMethod
Constructor and Description |
---|
Test3() |
Modifier and Type | Method and Description |
---|---|
void |
configure() |
void |
cycle(CBRQuery query) |
static void |
main(String[] args) |
void |
postCycle() |
CBRCaseBase |
preCycle() |
public Test3()
public void configure() throws ExecutionException
configure
in interface StandardCBRApplication
ExecutionException
public CBRCaseBase preCycle() throws ExecutionException
preCycle
in interface StandardCBRApplication
ExecutionException
public void cycle(CBRQuery query) throws ExecutionException
cycle
in interface StandardCBRApplication
ExecutionException
public void postCycle() throws ExecutionException
postCycle
in interface StandardCBRApplication
ExecutionException
Copyright © 2018 Group of Artificial Intelligence Applications (GAIA). All rights reserved.