jcreek.examples
Class CreekExample

java.lang.Object
  extended byjcreek.examples.CreekExample

public class CreekExample
extends java.lang.Object

This class in an example on how to use jCreek through the Java API. It first demonstrates creating a new KnowledgeModel using the jcreek.representation package. Then it demonstrates, on this model, using a the jcreek.reasoning engine to use Case-Based Reasoning on a sample problem case. Last, it shows off some standard GUI elements of the jcreek.gui packages. The implementation is very heavily commented and may be read as a tutorial to jCreek.

Version:
2.0
Author:
Frode Sørmo, small changes by Stein Brandser

Method Summary
static void addAttributes(KnowledgeModel km)
          Generates a new KnowledgeModel for a simple car-start problem domain, part 1 of 3.
static void addCases(KnowledgeModel km)
          Generates a new KnowledgeModel for a simple car-start problem domain, part 2 of 3.
static void addCausalModel(KnowledgeModel km)
          Generates a new KnowledgeModel for a simple car-start problem domain, part 3 of 3.
static void displayModel(KnowledgeModel km, boolean showGUI)
          Takes an already created model and displays the cases and entities of the model in different ways.
static Entity getEntity(KnowledgeModel km, java.lang.String name)
          Improvement to km.getEntity (more meaningful exception than NullPointer).
static KnowledgeModel loadModel(java.lang.String filename)
          Example of loading a KnowledgeModel from disk.
static void main(java.lang.String[] argv)
           
static void saveModel(KnowledgeModel model, java.lang.String filename)
          Exampel of saving the given model to disk.
static void solveCBR(KnowledgeModel km, boolean showGUI)
          Example of the jCreek CBR mechanism (jcreek.reasoning) and some GUI elements displaying the process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] argv)

getEntity

public static Entity getEntity(KnowledgeModel km,
                               java.lang.String name)
Improvement to km.getEntity (more meaningful exception than NullPointer).

Parameters:
km - KnowledgeModel
name - String
Returns:
Entity
To do:
Redesign km.getEntity (and fix broken code) instead of wrapping it.

addAttributes

public static void addAttributes(KnowledgeModel km)
                          throws NameAlreadyExistException,
                                 NoSuchRelationTypeException
Generates a new KnowledgeModel for a simple car-start problem domain, part 1 of 3.

Throws:
NameAlreadyExistException
NoSuchRelationTypeException

addCases

public static void addCases(KnowledgeModel km)
                     throws NameAlreadyExistException,
                            NoSuchRelationTypeException
Generates a new KnowledgeModel for a simple car-start problem domain, part 2 of 3.

Throws:
NameAlreadyExistException
NoSuchRelationTypeException

addCausalModel

public static void addCausalModel(KnowledgeModel km)
                           throws NameAlreadyExistException,
                                  NoSuchRelationTypeException
Generates a new KnowledgeModel for a simple car-start problem domain, part 3 of 3.

Throws:
NameAlreadyExistException
NoSuchRelationTypeException

displayModel

public static void displayModel(KnowledgeModel km,
                                boolean showGUI)
Takes an already created model and displays the cases and entities of the model in different ways.


saveModel

public static void saveModel(KnowledgeModel model,
                             java.lang.String filename)
Exampel of saving the given model to disk.


loadModel

public static KnowledgeModel loadModel(java.lang.String filename)
Example of loading a KnowledgeModel from disk.


solveCBR

public static void solveCBR(KnowledgeModel km,
                            boolean showGUI)
Example of the jCreek CBR mechanism (jcreek.reasoning) and some GUI elements displaying the process.



Created at IDI, NTNU by the Artificial Intelligence and Learning group