jcreek.cke.importexport
Class KnowledgeModelImportUtilities

java.lang.Object
  extended byjcreek.cke.importexport.KnowledgeModelImportUtilities

public class KnowledgeModelImportUtilities
extends java.lang.Object

Some general methods used to ease the import process.

Author:
Stein L. Tomassen, NTNU 2002

Nested Class Summary
 class KnowledgeModelImportUtilities.CaseAlreadyExist
          An exception that is thrown in cases where there have been an attempt to create a case that already exist.
 class KnowledgeModelImportUtilities.ClassDescriptorDoNotExist
          An exception that is thrown in cases where there have been an attempt to use a class descriptor that does not exist.
 class KnowledgeModelImportUtilities.CompilationFault
          An exception that is thrown in cases where there have been a fault in the compilation of a new relation type.
 class KnowledgeModelImportUtilities.EntityAlreadyExist
          An exception that is thrown in cases where there have been an attempt to create an entity that already exist.
 class KnowledgeModelImportUtilities.EntityDoNotExist
          An exception that is thrown in cases where there have been an attempt to use an entity that does not exist.
 class KnowledgeModelImportUtilities.EqualRelationAlreadyExist
          An exception that is thrown in cases where there have been an attempt to add a relation between two entities and these entities already have an equal relation between them.
 class KnowledgeModelImportUtilities.EqualRelationTypeAlreadyExist
          An exception that is thrown in cases where there have been an attempt to create a new relation type that already exist and is equal, that is, uses the same class descriptor.
 class KnowledgeModelImportUtilities.RelationTypeAlreadyExist
          An exception that is thrown in cases where there have been an attempt to create a new relation type that already exist but is not equal, that is, uses another class descriptor.
 class KnowledgeModelImportUtilities.RelationTypeDoNotExist
          An exception that is thrown in cases where there have been an attempt to use a relation type that does not exist.
 class KnowledgeModelImportUtilities.RelationTypeNameAlreadyInUse
          An exception that is thrown in cases where there have been an attempt to create a new relation type with either a name or inverse name that is already in use.
 
Constructor Summary
KnowledgeModelImportUtilities(KnowledgeModel km)
          The constructor that only sets the JavaCreek Knowledge Model to use in the import process.
 
Method Summary
 void addCase(java.lang.String name, java.lang.String description)
          Adds a new case to the Knowledge Model of Creek.
 void addEntity(java.lang.String name, java.lang.String description, java.lang.String valueClass, java.lang.String value)
          Adds a new entity if not already exist.
 void addHasFinding(java.lang.String caseName, java.lang.String relationType, java.lang.String toEntity, java.lang.String importance, java.lang.String predictiveStrength)
          Adds a finding to an already existing case of the Knowledge Model of Creek.
 void addHasSolution(java.lang.String caseName, java.lang.String status, java.lang.String toEntity, java.lang.String importance, java.lang.String predictiveStrength)
          Adds a solution to an already existing case of the Knowledge Model of Creek.
 void addNewRelationType(java.lang.String classDescriptor, java.lang.String name, java.lang.String inverseName, java.lang.String defaultStrengthStr, java.lang.String description)
          Creates a new relation type if not already exists.
 void addRelation(java.lang.String fromEntity, java.lang.String relationType, java.lang.String toEntity, java.lang.String strengthStr)
          Adds a new relation between two entities.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KnowledgeModelImportUtilities

public KnowledgeModelImportUtilities(KnowledgeModel km)
The constructor that only sets the JavaCreek Knowledge Model to use in the import process.

Parameters:
km - the JavaCreek Knowledge Model that the data should be imported into
Method Detail

addNewRelationType

public void addNewRelationType(java.lang.String classDescriptor,
                               java.lang.String name,
                               java.lang.String inverseName,
                               java.lang.String defaultStrengthStr,
                               java.lang.String description)
                        throws KnowledgeModelImportUtilities.ClassDescriptorDoNotExist,
                               KnowledgeModelImportUtilities.RelationTypeAlreadyExist,
                               KnowledgeModelImportUtilities.EqualRelationTypeAlreadyExist,
                               KnowledgeModelImportUtilities.RelationTypeNameAlreadyInUse,
                               KnowledgeModelImportUtilities.CompilationFault
Creates a new relation type if not already exists.

Parameters:
classDescriptor - the class descriptor from which this new relation type should inherit functionallity from
name - the name of the new relation type
inverseName - the inverse name of the new relation type
defaultStrengthStr - the default explanation strength, a value between 0 and 1. If this value is not in between 0 and 1 then a default value will be used which is 0.5
description - the description of the new relation type
Throws:
KnowledgeModelImportUtilities.ClassDescriptorDoNotExist - if the classDescriptor does not exists
KnowledgeModelImportUtilities.RelationTypeAlreadyExist - in a relation type already exist
KnowledgeModelImportUtilities.EqualRelationTypeAlreadyExist - if an equal relation type already exist
KnowledgeModelImportUtilities.RelationTypeNameAlreadyInUse - if a realtion with an equal name exist
KnowledgeModelImportUtilities.CompilationFault - if it wasn't possible to compile the new relation type, which e.g. may happen in cases where the classpath doesn't contain tool.jar

addEntity

public void addEntity(java.lang.String name,
                      java.lang.String description,
                      java.lang.String valueClass,
                      java.lang.String value)
               throws KnowledgeModelImportUtilities.EntityAlreadyExist
Adds a new entity if not already exist. If entity exist then throws a warning exception that the entity exist.

Parameters:
name - the name of the new entity
description - the description of the new entity
Throws:
KnowledgeModelImportUtilities.EntityAlreadyExist - if an entity by the same name already exist

addRelation

public void addRelation(java.lang.String fromEntity,
                        java.lang.String relationType,
                        java.lang.String toEntity,
                        java.lang.String strengthStr)
                 throws KnowledgeModelImportUtilities.EqualRelationAlreadyExist,
                        KnowledgeModelImportUtilities.EntityDoNotExist,
                        KnowledgeModelImportUtilities.RelationTypeDoNotExist
Adds a new relation between two entities. Both the entities and the relation type must exist in able to add a new relation.

Parameters:
fromEntity - the name of the entity from where the new relation should come from
relationType - the relation type to use
toEntity - the name of the entity to where the the new relation should end
strengthStr - the default strength, a value between 0 and 1. If this value is not in between 0 and 1 then a default value will be used which is 0.5
Throws:
KnowledgeModelImportUtilities.EqualRelationAlreadyExist - if an equal relation between these two entities already exist
KnowledgeModelImportUtilities.EntityDoNotExist - if one of the entities specified doesn't exist
KnowledgeModelImportUtilities.RelationTypeDoNotExist - if the relation type specified doesn't exist

addCase

public void addCase(java.lang.String name,
                    java.lang.String description)
             throws KnowledgeModelImportUtilities.CaseAlreadyExist
Adds a new case to the Knowledge Model of Creek. In able for this process to be successful, the case must not exist.

Parameters:
name - the name of the new case to create
description - the description of the new case
Throws:
KnowledgeModelImportUtilities.CaseAlreadyExist - if a case with a equal name already exist in the Knowledge Model

addHasFinding

public void addHasFinding(java.lang.String caseName,
                          java.lang.String relationType,
                          java.lang.String toEntity,
                          java.lang.String importance,
                          java.lang.String predictiveStrength)
                   throws KnowledgeModelImportUtilities.EqualRelationAlreadyExist,
                          KnowledgeModelImportUtilities.EntityDoNotExist,
                          KnowledgeModelImportUtilities.RelationTypeDoNotExist
Adds a finding to an already existing case of the Knowledge Model of Creek. In addition, the relation type and the entity specified must exist in order for this process to be successful.

Parameters:
caseName - the name of the case to add a new finding
relationType - the relation type for this relation. This relation type should either be of HasFinding class or a subclass of this. There is not done any checking to ensure that this is followed.
toEntity - the name of the entity that is the finding of this case
importance - the default importance of this finding, a value between 0 and 1. If this value is not in between 0 and 1 then a default value will be used which is 0.5
predictiveStrength - the default predictive strength of this finding, a value between 0 and 1. If this value is not in between 0 and 1 then a default value will be used which is 0.5
Throws:
KnowledgeModelImportUtilities.EqualRelationAlreadyExist - if an equal relation already exist
KnowledgeModelImportUtilities.EntityDoNotExist - if the entity of this finding does not exist
KnowledgeModelImportUtilities.RelationTypeDoNotExist - if the relation type specified does not exist

addHasSolution

public void addHasSolution(java.lang.String caseName,
                           java.lang.String status,
                           java.lang.String toEntity,
                           java.lang.String importance,
                           java.lang.String predictiveStrength)
                    throws KnowledgeModelImportUtilities.EqualRelationAlreadyExist,
                           KnowledgeModelImportUtilities.EntityDoNotExist
Adds a solution to an already existing case of the Knowledge Model of Creek. In addition, the entity specified must exist in order for this process to be successful.

Parameters:
caseName - the name of the case to add a new finding
status - the status of this solution, that is, SOLVED or UNSOLVED
toEntity - the name of the entity that is the solution of this case
importance - the default importance of this solution, a value between 0 and 1. If this value is not in between 0 and 1 then a default value will be used which is 0.5
predictiveStrength - the default predictive strength of this solution, a value between 0 and 1. If this value is not in between 0 and 1 then a default value will be used which is 0.5
Throws:
KnowledgeModelImportUtilities.EqualRelationAlreadyExist - if an equal relation already exist
KnowledgeModelImportUtilities.EntityDoNotExist - if the entity of this finding does not exist


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