aminePlatform.engines.dynamicKnowledgeIntegration.terminologicalKB
Class IntegrateDefinition

java.lang.Object
  extended byaminePlatform.engines.dynamicKnowledgeIntegration.terminologicalKB.IntegrateDefinition
All Implemented Interfaces:
AmineConstants

public class IntegrateDefinition
extends java.lang.Object
implements AmineConstants

Title: IntegrateDefinition

Description: This class implements definition dynamic integration process

There are three modes of Definition Integration : classification-based integration, generalization-based integration, and information retrieval based integration. Copyright: Copyright (c) 2004-2009 Adil KABBAJ


Nested Class Summary
(package private)  class IntegrateDefinition.TypeEntryPoint
           
 
Field Summary
 CGOperations cgOperations
           
(package private)  boolean classify
           
(package private)  java.util.HashMap compareNodesHshMap
           
(package private)  java.util.HashMap focusHshMap
           
 AmineList integratedNodesList
          This ArrayList is used for GUI purposes.
 Lexicon lexicon
          The current lexicon used during the integration.
(package private)  CS newOntNode
           
 Ontology ontology
          The current ontology used during the integration
(package private)  boolean simulation
           
(package private)  boolean trace
           
 javax.swing.JTextArea traceArea
          This variable is used to know in which JTextArea the trace will be displayed
(package private)  AmineList typeEntryPoints
           
 
Fields inherited from interface aminePlatform.util.AmineConstants
ANALOGY, B_ASSIGN, B_DSPLY_WT_DELAY, B_DSPLY_WTT_DELAY, B_TRIGGER, B_WTT_DSPLY, BLOCK_BACKWARD_PROPAGATION, BLOCK_FORWARD_PROPAGATION, CANON, CGIF, CGRAPHIC, CHECK_PRECONDITIONS, COMPARE, COMPOSED_GOAL, CONCEPT_TYPE_IDENT, CONTEXT, COVERED_BY, CPLTE_CONTRACT, DEFINITION, EQ_OR_MORE_SPCFQ, EQUAL, EXPAND, FALSE_FOCUS_LIST, FUNCTIONAL, GENERALISE, GENERALIZE, HAVE_AN_INTERSECTION, ID_ADD, ID_DIV, ID_EQ, ID_INF, ID_IS, ID_MESSAGE, ID_MUL, ID_NOT, ID_NULL, ID_OPER_AND, ID_OPER_OR, ID_SUB, ID_SUP, IN_ACTIVATION, IN_MODE, IN_MODE2, INDIVIDUAL, INDIVIDUAL_IDENT, INTEGRATED, IS_CANONIC, KEY_GLOBAL_RULE, LC_ADD, LC_AMINE_BOOLEAN, LC_AMINE_DOUBLE, LC_AMINE_INTEGER, LC_AND, LC_BOOLEAN, LC_CG, LC_CLOSE_BRKT, LC_CLOSE_PARENT, LC_CLOSE_SET, LC_COMMA, LC_COMMA_SEMI, LC_CONCEPT, LC_CONSTRUCTOR, LC_CS, LC_CUT, LC_DIFF, LC_DIV, LC_DOUBLE, LC_DSBL_BKWRD_PRPGTN, LC_DSBL_FRWRD_PRPGTN, LC_EOF, LC_EQ, LC_FOUR_POINTS, LC_IDENTIFIER, LC_IF, LC_INF, LC_INTEGER, LC_INTEROG, LC_IS, LC_JAVA_OBJECT, LC_LEFT_ARROW, LC_LIST, LC_NULL, LC_OPEN_BRKT, LC_OPEN_PARENT, LC_OPEN_SET, LC_OPER_AND, LC_OPER_OR, LC_POINT, LC_RELATION, LC_RGHT_ARROW, LC_SEMI_COMMA, LC_SET, LC_STAR, LC_STATE, LC_STRING, LC_SUB, LC_SUP, LC_TERM, LC_TWO_POINTS, LC_VAR_LIST_CONSTRUCTOR, LC_VARIABLE, LF, MAXIMAL_JOIN, MORE_GENERAL, MORE_SPECIFIC, NOTHING_TO_INTEGRATE, OPERS_WITH_RSLT, OUT_MODE, OUT_MODE2, PARTIAL_CONTRACT, PARTIAL_SUBSUME, PRJCT_OPERS, PROJECT, READ, READ_SENTENCE, RELATION_TYPE_IDENT, S_AND, S_BOOLEAN, S_CG, S_CLOSE_BRKT, S_CLOSE_PARENT, S_CLOSE_SET, S_COMMA, S_CONCEPT, S_CONSTRUCTOR, S_CUT, S_DIFF, S_DOUBLE, S_EOF, S_EQUAL, S_EXPAND, S_FALSE, S_FOUR_POINTS, S_GENERALISE, S_GENERALIZE, S_IDENTIFIER, S_IF, S_INTEGER, S_INTEROG, S_IS, S_IS_CANONIC, S_LEFT_ARROW, S_LIST, S_MAXIMAL_JOIN, S_OPEN_BRKT, S_OPEN_PARENT, S_OPEN_SET, S_POINT, S_RGHT_ARROW, S_SEMI_COMMA, S_SOURCE, S_SPECIALIZE, S_STATE, S_STRING, S_SUBSUME, S_SUBSUME_WITH_RESULT, S_SUPER, S_TARGET, S_TERM, S_THIS, S_TRUE, S_TWO_POINTS, S_UNIFY, S_VARIABLE, SITUATION, SPECIALIZE, STEADY, SUBSUME, SUBSUME_WITH_RSLT, TRIGGER, UNCOMPARABLE, UNIFY, VAR_SUPER, WAIT_ASSIGNMENT, WAIT_END_OF_ASSIGNMENT, WAIT_PRECONDITIONS, WAIT_VALUE
 
Constructor Summary
IntegrateDefinition(Ontology ont)
          This is a minimal specification of IntegrateDefinition.
IntegrateDefinition(Ontology ont, Lexicon lex)
          Create a IntegrateDefinition task with the specified ont as the ontology where the integration should be processed and lex as the lexicon to use among the lexicons available in the ontology.
IntegrateDefinition(Ontology ont, Lexicon lex, javax.swing.JTextArea txtArea)
          Create a IntegrateDefinition task with the specified ont as the ontology where the integration should be processed, lex as the lexicon to use among the lexicons available in the ontology and txtArea as the Area where the trace of the integration is displayed.
 
Method Summary
 IntegrationResult ask(CG newDescr)
           
 IntegrationResult ask(CG newDescr, AmineList pertinentTypes)
           
 IntegrationResult ask(CG newDescr, AmineList pertinentTypes, AmineList superTypesPertinentTypes)
           
static IntegrationResult ask(Ontology ontology, CG defDescr)
           
static IntegrationResult ask(Ontology ontology, CG defDescr, AmineList pertinentTypes)
           
(package private)  java.util.ArrayList children(CS ontologyNode)
          returns an ArrayList of all the children of an Ontology Node except those that are Individual
 IntegrationResult classify(Identifier idType, CG newDescr)
           
 IntegrationResult classify(Identifier idType, CG newDescr, AmineList pertinentTypes)
           
 IntegrationResult classify(Identifier idType, CG newDescr, AmineList pertinentTypes, AmineList superTypesPertinentTypes)
           
static IntegrationResult classify(Ontology ontology, Identifier idType, CG defDescr)
           
static IntegrationResult classify(Ontology ontology, Identifier idType, CG defDescr, AmineList pertinentTypes)
          Static Methods That Can be Used by other Components of Amine like *** Prolog+CG, or any Java class
(package private)  boolean compareAndProceed(Concept entryPoint, CS currentOntNode, CS fatherOntNode, boolean realComparison, Type typeIndex, AmineList typeIndexes)
          method for comparing and propagating a new description from a node
 CompareCGResult compareCG(CG newCG, Concept entryPoint, CG currentCG, CS fatherOntNode)
           
(package private)  void compression(Type type, java.util.ArrayList childrenList)
          Perform compression of the description of CSs specified in childrenList as well as compression of their descendants.
(package private)  void doContraction(CG cg, java.util.ArrayList typeEntryPoints)
           
 void finalize()
           
(package private)  Type findImdtBestDef(Type type, CG newCG, Concept entryConcNewCG)
          Find the best definition among direct subtypes of type that subsumes newCG.
(package private)  Type findMostSpecSubsumer(Type type, CG newCG, Concept entryConcNewCG)
          Find the best definition among subtypes of type that subsumes newCG.
(package private)  boolean firstCompareAndProceed(Concept entryPoint, CS currentOntNode, CS fatherOntNode, boolean realComparison, Type typeIndex, AmineList typeIndexes)
           
 IntegrationResult generalize(Identifier idType, CG newDescr)
           
 IntegrationResult generalize(Identifier idType, CG newDescr, AmineList pertinentTypes)
           
 IntegrationResult generalize(Identifier idType, CG newDescr, AmineList pertinentTypes, AmineList superTypesPertinentTypes)
           
static IntegrationResult generalize(Ontology ontology, Identifier idType, CG defDescr)
           
static IntegrationResult generalize(Ontology ontology, Identifier idType, CG defDescr, AmineList pertinentTypes)
           
static AmineList getConceptTypes(java.lang.Object defDescr)
           
 AmineList getResultOfSimulation()
           
 boolean getTrace()
          Get the value of the boolean attribute trace.
(package private)  boolean hasGenusConjDef(Type type)
          Check if current type has a definition that corresponds to a conjunction of genus concepts
 IntegrationResult integrateDef(Identifier idType, CG newCG, AmineList pertinentTypes, AmineList superTypesPertinentTypes, boolean classify)
           
static boolean integrateSitWthNewType(Ontology ontology, CG description, Type newType, Type action)
          Integrate a new situation that contains a new type newType which is a new action.
static boolean integrateUpdateSit4Type(Ontology ontology, CG description, Type newType, Type action)
          Integrate a new situation (description) for the new type newType.
(package private)  boolean moreGeneral(Type newType, Type brother)
           
(package private)  void printFocusHashMap()
           
(package private)  boolean proceed(Concept entryPoint, CS currentOntNode, CS fatherOntNode, boolean realComparison, CompareCGResult compareCGResults, Type typeIndex, AmineList typeIndexes)
          method for proceeding on the real update of the memory
(package private)  void propagateFromOneFocus(CS oneFocus, AmineList oneEntryPointList)
           
(package private)  void propagateNewNodeViaFocus()
           
 void setTrace(boolean trace)
          Set the specified value to the boolean attribute trace.
 void setTraceArea(javax.swing.JTextArea txtArea)
           
 java.lang.String toStringResultOfSimulation()
           
(package private)  void trace(java.lang.String message)
          It appends a String message to the area where the trace is displayed.
(package private)  void trace(java.lang.String message, CG cg)
           
(package private)  void trace(java.lang.String message, CS cs)
           
(package private)  void updatePertinentTypes(AmineList initialConcTypesSet, AmineList currConcTypesSet, AmineList pertinentTypes)
          Update pertinent types list by adding any type in currConcTypesSet that is not contained in initialConcTypesSet nor in pertinentTypes.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ontology

public Ontology ontology
The current ontology used during the integration


lexicon

public Lexicon lexicon
The current lexicon used during the integration.


cgOperations

public CGOperations cgOperations

typeEntryPoints

AmineList typeEntryPoints

compareNodesHshMap

java.util.HashMap compareNodesHshMap

focusHshMap

java.util.HashMap focusHshMap

newOntNode

CS newOntNode

classify

boolean classify

simulation

boolean simulation

traceArea

public javax.swing.JTextArea traceArea
This variable is used to know in which JTextArea the trace will be displayed


integratedNodesList

public AmineList integratedNodesList
This ArrayList is used for GUI purposes. Indeed, when the integration is done, the relationships between the new description and the ontology are created in the memory. In case the integration is called from the integrateDefinitionGUI all the new ontology nodes and links that are created are sent within this array list to display them in the integrateDefinitionGUI


trace

boolean trace
Constructor Detail

IntegrateDefinition

public IntegrateDefinition(Ontology ont)
                    throws DynamicKnowledgeIntegrationException
This is a minimal specification of IntegrateDefinition. Create a IntegrateDefinition task with the specified ont as the ontology where the integration should be processed. lexicon attribute of the class is set to the main Lexicon of the ontology.

Parameters:
ont - The ontology considered for the integration. ont can not be null.
Throws:
DynamicOntologyException - if ont is null.
DynamicKnowledgeIntegrationException

IntegrateDefinition

public IntegrateDefinition(Ontology ont,
                           Lexicon lex)
                    throws DynamicKnowledgeIntegrationException
Create a IntegrateDefinition task with the specified ont as the ontology where the integration should be processed and lex as the lexicon to use among the lexicons available in the ontology. If lex is null then the main Lexicon of the ontology is used.

Parameters:
ont - The ontology considered for the integration. ont can not be null.
lex - The lexicon considered for the integration. lex could be null.
Throws:
DynamicOntologyException - if ont is null.
DynamicKnowledgeIntegrationException

IntegrateDefinition

public IntegrateDefinition(Ontology ont,
                           Lexicon lex,
                           javax.swing.JTextArea txtArea)
                    throws DynamicKnowledgeIntegrationException
Create a IntegrateDefinition task with the specified ont as the ontology where the integration should be processed, lex as the lexicon to use among the lexicons available in the ontology and txtArea as the Area where the trace of the integration is displayed. If lex is null then the main Lexicon of the ontology is used. If txtArea is null then System.out is used to display the trace.

Parameters:
ont - The ontology considered for the integration. ont can not be null.
lex - The lexicon considered for the integration. lex could be null.
txtArea - The Area where the trace is displayed. txtArea could be null.
Throws:
DynamicOntologyException - if ont is null.
DynamicKnowledgeIntegrationException
Method Detail

finalize

public void finalize()

getResultOfSimulation

public AmineList getResultOfSimulation()

toStringResultOfSimulation

public java.lang.String toStringResultOfSimulation()

getTrace

public boolean getTrace()
Get the value of the boolean attribute trace.

Returns:
true if the attribute trace is true and false otherwise

setTrace

public void setTrace(boolean trace)
Set the specified value to the boolean attribute trace.

Parameters:
trace -

setTraceArea

public void setTraceArea(javax.swing.JTextArea txtArea)

trace

void trace(java.lang.String message)
It appends a String message to the area where the trace is displayed. The message informs about a given step of the integration.

Parameters:
message - a String that is sent to the trace Area.

trace

void trace(java.lang.String message,
           CG cg)
     throws java.lang.Exception
Throws:
java.lang.Exception

trace

void trace(java.lang.String message,
           CS cs)
     throws java.lang.Exception
Throws:
java.lang.Exception

classify

public IntegrationResult classify(Identifier idType,
                                  CG newDescr)
                           throws java.lang.Exception
Throws:
java.lang.Exception

classify

public IntegrationResult classify(Identifier idType,
                                  CG newDescr,
                                  AmineList pertinentTypes)
                           throws java.lang.Exception
Throws:
java.lang.Exception

classify

public IntegrationResult classify(Identifier idType,
                                  CG newDescr,
                                  AmineList pertinentTypes,
                                  AmineList superTypesPertinentTypes)
                           throws java.lang.Exception
Throws:
java.lang.Exception

generalize

public IntegrationResult generalize(Identifier idType,
                                    CG newDescr)
                             throws java.lang.Exception
Throws:
java.lang.Exception

generalize

public IntegrationResult generalize(Identifier idType,
                                    CG newDescr,
                                    AmineList pertinentTypes)
                             throws java.lang.Exception
Throws:
java.lang.Exception

generalize

public IntegrationResult generalize(Identifier idType,
                                    CG newDescr,
                                    AmineList pertinentTypes,
                                    AmineList superTypesPertinentTypes)
                             throws java.lang.Exception
Throws:
java.lang.Exception

ask

public IntegrationResult ask(CG newDescr)
                      throws java.lang.Exception
Throws:
java.lang.Exception

ask

public IntegrationResult ask(CG newDescr,
                             AmineList pertinentTypes)
                      throws java.lang.Exception
Throws:
java.lang.Exception

ask

public IntegrationResult ask(CG newDescr,
                             AmineList pertinentTypes,
                             AmineList superTypesPertinentTypes)
                      throws java.lang.Exception
Throws:
java.lang.Exception

classify

public static IntegrationResult classify(Ontology ontology,
                                         Identifier idType,
                                         CG defDescr,
                                         AmineList pertinentTypes)
Static Methods That Can be Used by other Components of Amine like *** Prolog+CG, or any Java class


classify

public static IntegrationResult classify(Ontology ontology,
                                         Identifier idType,
                                         CG defDescr)

generalize

public static IntegrationResult generalize(Ontology ontology,
                                           Identifier idType,
                                           CG defDescr,
                                           AmineList pertinentTypes)

generalize

public static IntegrationResult generalize(Ontology ontology,
                                           Identifier idType,
                                           CG defDescr)

ask

public static IntegrationResult ask(Ontology ontology,
                                    CG defDescr,
                                    AmineList pertinentTypes)

ask

public static IntegrationResult ask(Ontology ontology,
                                    CG defDescr)

getConceptTypes

public static AmineList getConceptTypes(java.lang.Object defDescr)

integrateDef

public IntegrationResult integrateDef(Identifier idType,
                                      CG newCG,
                                      AmineList pertinentTypes,
                                      AmineList superTypesPertinentTypes,
                                      boolean classify)
                               throws java.lang.Exception
Parameters:
idType - Identifier
newCG - CG
pertinentTypes - AmineList
superTypesPertinentTypes - AmineList
classify - boolean
Returns:
IntegrationResult
Throws:
java.lang.Exception

propagateNewNodeViaFocus

void propagateNewNodeViaFocus()
                        throws java.lang.Exception
Throws:
java.lang.Exception

propagateFromOneFocus

void propagateFromOneFocus(CS oneFocus,
                           AmineList oneEntryPointList)
                     throws java.lang.Exception
Throws:
java.lang.Exception

compareAndProceed

boolean compareAndProceed(Concept entryPoint,
                          CS currentOntNode,
                          CS fatherOntNode,
                          boolean realComparison,
                          Type typeIndex,
                          AmineList typeIndexes)
                    throws java.lang.Exception
method for comparing and propagating a new description from a node

Parameters:
entryPoint - a Concept contained in the newCG to integrate. Comparison will take entryPoint as an entry point for newCG.
currentOntNode - a CS corresponding to the CS that the new description is currently compared with
fatherOntNode - a CS corresponding to the father in the ontology of the currentOntNode
realComparison - a Boolean that specifies if the integration via currentOntNode is effective or not. This parameter is important for Individual node especially.
Returns:
a boolean: true if newCG of newOntNode have been comparable with description of currentOntNode.
Throws:
java.lang.Exception

firstCompareAndProceed

boolean firstCompareAndProceed(Concept entryPoint,
                               CS currentOntNode,
                               CS fatherOntNode,
                               boolean realComparison,
                               Type typeIndex,
                               AmineList typeIndexes)
                         throws java.lang.Exception
Throws:
java.lang.Exception

proceed

boolean proceed(Concept entryPoint,
                CS currentOntNode,
                CS fatherOntNode,
                boolean realComparison,
                CompareCGResult compareCGResults,
                Type typeIndex,
                AmineList typeIndexes)
          throws java.lang.Exception
method for proceeding on the real update of the memory

Parameters:
entryPoint - A Concept that represents an Entry Point in the newCG to integrate.
currentOntNode - a CS corresponding to the CS that the new description is currently proccessed with
fatherOntNode - a CS corresponding to the father in the ontology of the currentOntNode
realComparison - a boolean indicating if we can integrate from the current node or from its father
compareCGResults - a CompareCGResults containing the result of the comparison between the current ontology node and the new description
Throws:
java.lang.Exception

hasGenusConjDef

boolean hasGenusConjDef(Type type)
Check if current type has a definition that corresponds to a conjunction of genus concepts

Returns:
boolean

moreGeneral

boolean moreGeneral(Type newType,
                    Type brother)

compareCG

public CompareCGResult compareCG(CG newCG,
                                 Concept entryPoint,
                                 CG currentCG,
                                 CS fatherOntNode)
                          throws java.lang.Exception
Throws:
java.lang.Exception

printFocusHashMap

void printFocusHashMap()
                 throws java.lang.Exception
Throws:
java.lang.Exception

updatePertinentTypes

void updatePertinentTypes(AmineList initialConcTypesSet,
                          AmineList currConcTypesSet,
                          AmineList pertinentTypes)
Update pertinent types list by adding any type in currConcTypesSet that is not contained in initialConcTypesSet nor in pertinentTypes. This method is used by elicitate method.

Parameters:
initialConcTypesSet - AmineList
currConcTypesSet - AmineList
pertinentTypes - AmineList
Since:
20/01/06

compression

void compression(Type type,
                 java.util.ArrayList childrenList)
           throws java.lang.Exception
Perform compression of the description of CSs specified in childrenList as well as compression of their descendants. Compression is based on contraction operation.

Parameters:
type -
childrenList -
Throws:
java.lang.Exception

children

java.util.ArrayList children(CS ontologyNode)
returns an ArrayList of all the children of an Ontology Node except those that are Individual

Parameters:
ontologyNode - an CS for which we look for the children that are not of type Individual
Returns:
an ArrayList representing all the children of ontologyNode except those that are Individual

doContraction

void doContraction(CG cg,
                   java.util.ArrayList typeEntryPoints)
             throws java.lang.Exception
Throws:
java.lang.Exception

integrateSitWthNewType

public static boolean integrateSitWthNewType(Ontology ontology,
                                             CG description,
                                             Type newType,
                                             Type action)
Integrate a new situation that contains a new type newType which is a new action. The method locates first the more specific action (the more specific subType of Action/Act that subsumes the specified description), then it links the best type located with the new type and then add the new description as a situation for the new type. This method assumes that a Type node (parameter newType) is already created; there is already an entry in the main lexicon for the type, but the type node is related to nothing. Parameter action refeers to the type for Action (or Act) in the ontology.

Parameters:
ontology - Ontology
description - CG Description that contains a new type newType
newType - Type
action - Type that refeers to type Action. newType is assumed to be a subtype of action
Since:
20/01/06

integrateUpdateSit4Type

public static boolean integrateUpdateSit4Type(Ontology ontology,
                                              CG description,
                                              Type newType,
                                              Type action)
Integrate a new situation (description) for the new type newType. The method assumes that the type exists already in the ontology and previous integrations have been done. This new integration may update previous integrations in the following way: 1. Direct super type of new type was induced (and not specified explicitly). So it is an hypothesis that can be contradicted by any new integration (i.e. the current one). 2. Integration of the new situation may lead to some update like any situation integration. First point is implemented as follows: Find the most specific subsumer for the new description. If the localised type is different from the current superType of newType, then we compute the minimal common super type (comSupType), we remove the link that relate superType to newType and we link comSupType to newType.

Parameters:
ontology - Ontology
description - CG
newType - Type
Since:
20/01/06

findMostSpecSubsumer

Type findMostSpecSubsumer(Type type,
                          CG newCG,
                          Concept entryConcNewCG)
Find the best definition among subtypes of type that subsumes newCG. The best means the most specific; the definition with the maximum number of relations that subsume newCG.

Parameters:
type - Type
newCG - CG
entryConcNewCG - Concept
Returns:
Type Type returned associated to the best definition
Since:
20/01/06

findImdtBestDef

Type findImdtBestDef(Type type,
                     CG newCG,
                     Concept entryConcNewCG)
Find the best definition among direct subtypes of type that subsumes newCG. The best means the most specific; the definition with the maximum number of relations that subsume newCG.

Parameters:
type - Type
newCG - CG
entryConcNewCG - Concept
Returns:
Type Type returned associated to the best definition
Since:
20/01/06