aminePlatform.util.cg
Class CGOperations

java.lang.Object
  extended byaminePlatform.util.cg.CGOperations
All Implemented Interfaces:
AmineConstants
Direct Known Subclasses:
AnimatedCGOperations, SynergyCGOperations

public class CGOperations
extends java.lang.Object
implements AmineConstants

Title : util.cg.CGOperations Class

Description : CG operations are defined in terms of the generic CG operation match. See Amine Web Site for a detailed discussion of the background behind the current implementation of CG operations.

Copyright : Copyright (c) Adil KABBAJ 2004-2009


Field Summary
protected  boolean animation
           
protected  BindingContext bindContext
           
 java.util.HashMap conceptsMatched
          it is a HashMap of Key:ConcFromG1 Value:ConcCouple=
protected  Lexicon lexicon
           
 java.util.HashMap relationsMatched
          It is a HashMap of Key:RelationG1 Value:RelationG2
 boolean surfaceMatching
           
(package private)  java.util.ArrayList toLocalMatchs
          it is an ArrayList of ConcCouple :
 
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
CGOperations()
           
CGOperations(BindingContext bindContext)
          CGOperations(ontology) sets the proper context for the CG operation; creation and initialisation of auxiliary data structures
CGOperations(BindingContext bindContext, boolean coerce, boolean relaxType)
           
 
Method Summary
(package private)  boolean addSpcfcG2ToGx(CG G2, java.lang.Object bindInf2, CG Gx, java.util.HashMap c2cx)
          Method common to both maxJoinRslt and Specialize
(package private)  Concept analogicalCopy(Concept c2, java.lang.Object bindInf)
           
(package private)  Concept analogicalCoref(Concept conc, java.lang.Object bindInf)
           
(package private)  boolean analogicalTransfer(CG cgTarget, java.lang.Object bindInf1, CG cgSource, java.lang.Object bindInf2)
          Code for Analogical Transfer
 boolean analogy(CG G1, CG G2)
          analogy() determine the structural matching of the two CG and then transfer to the target CG all the elements that are specific to the source CG
 boolean analogy(CG G1, Concept E1, CG G2, Concept E2)
          analogy() determine the structural matching of the two CG and then transfer to the target CG all the elements that are specific to the source CG
 boolean analogy(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          analogy() determine the structural matching of the two CG and then transfer to the target CG all the elements that are specific to the source CG
protected  void animateConcept(int ind, Concept concept, boolean mode)
           
protected  void animateRelation(int ind, Relation relation, boolean mode)
           
static boolean bagInclusion(int nbreRelsG1, int nbreRelsG2, java.util.HashMap allRelsG1, java.util.HashMap allRelsG2)
          bagInclusion is used by the CGOperation at the begining, especially if the operation is a projection based operation (like EQUAL, SUBSUME, SUBSUME_WITH_RSLT, and UNIFY).
(package private)  void clearAuxStrs()
           
 void clearCorefMatchL()
           
(package private)  void clearCsMatched()
           
(package private)  void clearMatchCGStrs(int oldLastElemIdx)
           
(package private)  void clearRelsMatched()
           
(package private)  void clearToLocalMatchs()
           
(package private)  boolean commonRslt(CG G1, java.lang.Object bindInf1, CG G3)
          The resulted CG G3 is a common graph of the two input CG, modulo the nature of the operation (GENERALIZE or subsumeWithResult).
 CompareCGResult compare(CG cg1, Concept entryPoint1, CG cg2, Concept entryPoint2)
          Compare two CGs cg1 and cg2 : The operation starts by computing the generalization between the two CG cg1 and cg2.
 CompareCGResult compareCG(CG newCG, Concept entryPoint, CG currentCG, CS fatherOntNode)
          Compare two CGs : newCG and currentCG, and return the result of the comparison.
 boolean completeContract(CG G1, Concept E1, CG G2, Concept E2)
          Contract G1 from G2, using the two entry concepts E1 for G1 and E2 for G2.
 boolean completeContract(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          Contract G1 from G2, using the two entry concepts E1 for G1 and E2 for G2.
(package private)  boolean constructG3(byte matchOperation, CG G1, java.lang.Object bindInf1, CG G2, java.lang.Object bindInf2, CG G3)
          The general case of the construction of G3 from G1 and G2.
 boolean contractTypeDefinition(CG cg, Concept concept)
          Contract from the specified cg the definition of the type of the specified concept.
 boolean contractTypeDefinition(CG cg, Concept concept, Type type)
          Contract the definition of the specified Type from the CG cg, using the specified concept as the entry point for cg.
 boolean contractTypeDefinition(CG cg, java.lang.Object bindInf, Concept concept)
          Contract from the specified cg the definition of the type of the specified concept.
 boolean contractTypeDefinition(CG cg, java.lang.Object bindInf, Concept concept, Type type)
          Contract the definition of the specified Type from the CG cg, using the specified concept as the entry point for cg.
 boolean contractTypeDefinition(CG cg, Type type)
          Contract the definition of the specified Type from the CG cg.
 CG copyWithMapping(CG ante, CG consq)
          End Code for Analogical Transfer
 java.util.Enumeration coveredBy(CG G1, CG G2)
          coveredBy determine which part of G1 (a subgraph S1) covers a part of G2 (a subgraph S2), i.e.
 java.util.Enumeration coveredBy(CG G1, Concept E1, CG G2, Concept E2)
          coveredBy determine which part of G1 (a subgraph S1) covers a part of G2 (a subgraph S2), i.e.
 java.util.Enumeration coveredBy(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          coveredBy determine which part of G1 (a subgraph S1) covers a part of G2 (a subgraph S2), i.e.
(package private)  void createG3FromG1(CG G1, java.lang.Object bindInf1, CG G3)
          Start code for the first Step of maxJoinRslt : First : Create G3 from G1 create the squeleton of all the Concept of G3 from G1 to make sure later that the same concept is always refered by the same pointer.
static boolean eqMatchConc(int range1, int range2, java.util.HashMap concsMatched)
           
 boolean equal(CG G1, CG G2)
          Perform equal operation on CG g1 and CG g2 (no entry points are provided)
 boolean equal(CG G1, Concept E1, CG G2, Concept E2)
          Perform equal operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
 boolean equal(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          Perform equal operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
 CG expand(CG cg, java.lang.Object bindInf, Concept conc)
          Expand the given CG cg by the definition of the concept type of the specified conc which should be a concept in cg.
 CG expand(CG cg, java.lang.Object bindInf, Relation rel)
          Expand the CG cg by the definition of the relation type of rel which is a relation in cg.
 void finalize()
           
 void generalise(CG G1, CG G2)
          While generalize() perform a generalization of two CGs and produce a new CG that is a common generalization of the two CGs, this method generalizes CG g1 itself by doing a generalization of CG g2 with g1
 Concept generalise(CG G1, Concept E1, CG G2, Concept E2)
          While generalize() perform a generalization of two CGs and produce a new CG that is a common generalization of the two CGs, this method generalizes CG g1 itself by doing a generalization of CG g2 with g1, with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
 Concept generalise(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          While generalize() perform a generalization of two CGs and produce a new CG that is a common generalization of the two CGs, this method generalizes CG g1 itself by doing a generalization of CG g2 with g1, with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
(package private)  boolean generalise(CG G1, java.lang.Object bindInf1, CG G2, java.lang.Object bindInf2)
          Generalize G1 by generalizing concepts that were matched (by the content of the concept that result from the match/generalize) and by removing from G1 what is specific to it.
 CG generalize(CG G1, CG G2)
          This definition of generalize has two CG as input and produce the CG that result from the generalization of the two CGs (no entry points are provided)
 ResMatchCG generalize(CG G1, Concept E1, CG G2, Concept E2)
          Perform generalization operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
 ResMatchCG generalize(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          Perform generalization operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
 CG generalize(CG g1, Type pertinentType1, CG g2, Type pertinentType2)
           
static boolean getCoerceDesignator()
           
 java.util.HashMap getConceptsMatched()
           
 CorefMatchList getCorefMatchL()
           
(package private)  java.lang.Object getIndividual(Concept conc, java.lang.Object bindInf)
           
 Lexicon getLexicon()
           
 Concept getMatchedConcept1(Concept conc)
          Get the matched concept to the specified concept conc. conc is assumed to be from the first CG and the concept to return is from the second CG.
 Concept getMatchedConcept2(Concept conc)
          Get the matched concept to the specified concept conc. conc is assumed to be from the second CG and the concept to return is from the first CG.
 Ontology getOntology()
           
static boolean getRelaxType()
           
(package private)  Concept impliedByMapping(CG ante, Concept conc3)
           
(package private)  java.util.HashMap individualDesignator(CG g1, CG g2)
           
(package private)  boolean individualDesignator(CG G1, java.lang.Object bindInfG1, CG G2, java.lang.Object bindInfG2, ConcCouple concCple)
           
(package private)  Individual individualDesignator(java.lang.Object ref, java.lang.Object bindInf)
           
 boolean isCanonic(CG cg, java.lang.Object bindInf)
          Check if the given cg is canonic : a) for each type (concept type or relation type) in cg, search its canon (if it has) and checks that the canon subsumes cg.
(package private)  boolean isCanonic(CG cgTarget, java.lang.Object bindInf1, Concept newConcept, java.lang.Object bindInf2)
           
(package private)  boolean isCanonic(CG cgTarget, java.lang.Object bindInf1, Relation newRelation, java.lang.Object bindInf2)
           
(package private)  boolean isConnectingRelation(CG cg, Relation relation)
          A relation is a connecting relation if its elimination would make the CG disconnected.
 boolean isInDescr(CS ontNode, CG cg)
           
(package private)  boolean isPossibleToJoin(byte matchOperation, Concept concG1, java.lang.Object bindInf1, Concept concG2, java.lang.Object bindInf2)
          First check : if concG1 and concG2 have two income relations with the same type then it isnt possible to join since the resulted CG will not be functional If income relations of the two concepts are mutually different then the Second check is done; it is similar to the first except that is done on outcome relations.
(package private)  boolean localMatch(byte matchOperation, Concept conc1, java.lang.Object bindInf1, Concept conc2, java.lang.Object bindInf2)
           
 ResMatchCG match(byte matchOperation, CG G1, Concept E1, CG G2, Concept E2)
          This is the main method of this class.
 ResMatchCG match(byte matchOperation, CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          This is the main method of this class.
(package private)  boolean matchCG(byte matchOperation, CG G1, java.lang.Object bindInf1, CG G2, java.lang.Object bindInf2, int nbreRelsG1)
          Establish the matching between the two CG according to matchOperation but without constructing the CG that result from the match.
(package private)  boolean matchConc(byte matchOperation, Concept conc1, java.lang.Object bindInf1, Concept conc2, java.lang.Object bindInf2)
           
(package private)  boolean matchConc1(byte matchOperation, Concept conc1, java.lang.Object bindInf1, Concept conc2, java.lang.Object bindInf2)
           
protected  boolean matchConcept(byte matchOperation, Concept conc1, java.lang.Object bindInf1, Concept conc2, java.lang.Object bindInf2)
          If the two concepts to match (conc1 and conc2) have been already matched, then nothing to do, else match the two concepts, add the result to conceptsMatched, and add a new entry to toLocalMatchs.
(package private)  boolean matchContexts(byte matchOperation, java.lang.Object bindInf1, java.lang.Object bindInf2)
          Looking for all the embedded CGs of the two current CG and match them.
(package private)  boolean matchedCoref(byte matchOperation, CG G1, java.lang.Object bindInf1, CG G2, java.lang.Object bindInf2, ConcCouple concCple)
           
protected  boolean matchRelations(byte matchOperation, java.lang.Object[] relations1, java.lang.Object bindInf1, java.lang.Object[] relations2, java.lang.Object bindInf2, boolean areIncomeRelations)
          scan the list relations1 for all the relations that are not matched already (by looking at relationsMatched) and search corresponding relations in relations2 to match them.
 CG maximalJoin(CG G1, CG G2)
          This definition of MAXIMAL_JOIN has two CG as input and produce the CG that result from the MAXIMAL_JOIN (no entry points are provided)
 ResMatchCG maximalJoin(CG G1, Concept E1, CG G2, Concept E2)
          Perform maximal join operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
 ResMatchCG maximalJoin(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          Perform maximal join operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
(package private)  boolean maxJoinRslt(CG G1, java.lang.Object bindInf1, CG G2, java.lang.Object bindInf2, CG G3)
           
 CG minimalGeneralize(CG g1, CG g2)
           
(package private)  boolean mutuallyDiffRels(java.util.Enumeration rels1, java.lang.Object bindInf1, java.lang.Object[] rels2, java.lang.Object bindInf2)
          Test for functional CG.
static java.lang.String nameOfOper(byte matchOperation)
           
(package private)  java.lang.Object objDesignator(java.lang.Object ref, java.lang.Object bindInf)
           
static byte operInByte(java.lang.String idCGOper, int nbrArgs)
           
 boolean partialContract(CG G1, Concept E1, CG G2, Concept E2)
          Unlike completeContract which checks first that G1 subsumes G2, partialContract G1 from G2, using the two entry concepts E1 for G1 and E2 for G2, will check first that a subgraph of G1 subsumes a subgraph of G2.
 boolean partialContract(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          Unlike completeContract which checks first that G1 subsumes G2, partialContract G1 from G2, using the two entry concepts E1 for G1 and E2 for G2, will check first that a subgraph of G1 subsumes a subgraph of G2.
 boolean project(CG G1, CG G2)
          project checks if G1 is a subgraph of G2, according to the configuration (relational network) only.
 boolean project(CG G1, Concept E1, CG G2, Concept E2)
          project checks if G1 is a subgraph of G2, according to the configuration (relational network) only.
(package private) static Concept rangeConc(int range, Concept c1, Concept c2, Concept c3)
           
(package private)  boolean removeDanglingRelation(java.lang.Object bindInf1, CG cg2, Relation relation, java.lang.Object bindInf2)
          A relation is dangling if either its source or target concept has no other relation and the "isolated" concept is not specific to cg; it can be recovered by definition expansion.
(package private)  void renameSpecCorefsOfG1(CG g1)
           
static void setCoerceDesignator(boolean coerce)
           
 void setCorefMatchL(CorefMatchList crfMatchL)
           
(package private)  AmineSet setDesignator(java.lang.Object ref, java.lang.Object bindInf)
           
 void setLexicon(Lexicon lex)
           
 void setOntology(Ontology ont)
           
static void setRelaxType(boolean relxType)
           
protected  void sleep()
           
 boolean specialize(CG G1, CG G2)
          While maximalJoin() produces a new CG that is a maximalJoin of two CGs G1 and G2, this method specializes g1 itself by doing a maximalJoin of CG g2 to g1.
 Concept specialize(CG G1, Concept E1, CG G2, Concept E2)
          While maximalJoin() produces a new CG that is a maximalJoin of two CGs G1 and G2, this method specializes g1 itself by doing a maximalJoin of CG g2 to g1, with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
 Concept specialize(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          While maximalJoin() produces a new CG that is a maximalJoin of two CGs G1 and G2, this method specializes g1 itself by doing a maximalJoin of CG g2 to g1, with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
(package private)  boolean specialize(CG G1, java.lang.Object bindInf1, CG G2, java.lang.Object bindInf2)
          Specialize G1 by specializing concepts that were matched (by the content of the concept that result from the match/join) and by adding to G1 what is specific to G2.
 boolean specializeByExpansion(CG cg, Concept concept)
          specializeByExpansion performs the expansion in the specified cg itself; it does NOT create a new CG that represents the result of the expansion.
 boolean specializeByExpansion(CG cg, java.lang.Object bindInf, Concept concept)
          specializeByExpansion performs the expansion in the specified cg itself; it does NOT create a new CG that represents the result of the expansion.
protected  void stopAnimation()
           
 boolean subsume(CG G1, CG G2)
          Check that the first CG G1 subsumes (is more general than) the second CG G2.
 boolean subsume(CG G1, Concept E1, CG G2, Concept E2)
          Check that the first CG G1 subsumes (is more general than) the second CG G2.
 boolean subsume(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          Check that the first CG G1 subsumes (is more general than) the second CG G2.
 CG subsumeWithResult(CG G1, CG G2)
          Its use is similar to subsume except that the image of G1 in G2 is constructed; the image is a subgraph of G2 that is isomorphic to G1 modulo the subsumption constaint on the concepts (the concept in G1 should be more general than its image in G2).
 ResMatchCG subsumeWithResult(CG G1, Concept E1, CG G2, Concept E2)
          Its use is similar to subsume except that the image of G1 in G2 is constructed; the image is a subgraph of G2 that is isomorphic to G1 modulo the subsumption constaint on the concepts (the concept in G1 should be more general than its image in G2).
 ResMatchCG subsumeWithResult(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          Its use is similar to subsume except that the image of G1 in G2 is constructed; the image is a subgraph of G2 that is isomorphic to G1 modulo the subsumption constaint on the concepts (the concept in G1 should be more general than its image in G2).
 CG surfaceGeneralize(CG g1, Concept e1, CG g2, Concept e2)
           
 boolean unify(CG G1, Concept E1, java.lang.Object bindInf1, CG G2, Concept E2, java.lang.Object bindInf2)
          Perform unification operation of CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.
 boolean unify(CG G1, java.lang.Object bindInf1, CG G2, java.lang.Object bindInf2)
          Perform unification operation of CG g1 and CG g2 (no entry points are provided).
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

surfaceMatching

public boolean surfaceMatching

animation

protected boolean animation

bindContext

protected BindingContext bindContext

lexicon

protected Lexicon lexicon

toLocalMatchs

java.util.ArrayList toLocalMatchs
it is an ArrayList of ConcCouple :


conceptsMatched

public java.util.HashMap conceptsMatched
it is a HashMap of Key:ConcFromG1 Value:ConcCouple=


relationsMatched

public java.util.HashMap relationsMatched
It is a HashMap of Key:RelationG1 Value:RelationG2

Constructor Detail

CGOperations

public CGOperations()

CGOperations

public CGOperations(BindingContext bindContext)
CGOperations(ontology) sets the proper context for the CG operation; creation and initialisation of auxiliary data structures


CGOperations

public CGOperations(BindingContext bindContext,
                    boolean coerce,
                    boolean relaxType)
Method Detail

getCoerceDesignator

public static boolean getCoerceDesignator()

setCoerceDesignator

public static void setCoerceDesignator(boolean coerce)

getRelaxType

public static boolean getRelaxType()

setRelaxType

public static void setRelaxType(boolean relxType)

getOntology

public Ontology getOntology()

setOntology

public void setOntology(Ontology ont)

getLexicon

public Lexicon getLexicon()

setLexicon

public void setLexicon(Lexicon lex)

getCorefMatchL

public CorefMatchList getCorefMatchL()

setCorefMatchL

public void setCorefMatchL(CorefMatchList crfMatchL)

getConceptsMatched

public java.util.HashMap getConceptsMatched()

getMatchedConcept1

public Concept getMatchedConcept1(Concept conc)
Get the matched concept to the specified concept conc. conc is assumed to be from the first CG and the concept to return is from the second CG.

Parameters:
conc - Concept from the first CG
Returns:
Concept that matches conc. The concept to return is from the second CG. return null if the specified concept has no concept matched to it.

getMatchedConcept2

public Concept getMatchedConcept2(Concept conc)
Get the matched concept to the specified concept conc. conc is assumed to be from the second CG and the concept to return is from the first CG.

Parameters:
conc - Concept from the second CG
Returns:
Concept that matches conc. The concept to return is from the first CG. return null if the specified concept has no concept matched to it.

finalize

public void finalize()

clearAuxStrs

void clearAuxStrs()

clearToLocalMatchs

void clearToLocalMatchs()

clearCsMatched

void clearCsMatched()

clearRelsMatched

void clearRelsMatched()

clearCorefMatchL

public void clearCorefMatchL()

clearMatchCGStrs

void clearMatchCGStrs(int oldLastElemIdx)

bagInclusion

public static boolean bagInclusion(int nbreRelsG1,
                                   int nbreRelsG2,
                                   java.util.HashMap allRelsG1,
                                   java.util.HashMap allRelsG2)
bagInclusion is used by the CGOperation at the begining, especially if the operation is a projection based operation (like EQUAL, SUBSUME, SUBSUME_WITH_RSLT, and UNIFY). It check if the number of relations in G1 is less than or equal to the number of relations in G2. If it is, check that for each entry in allRelsG1, there is an entry in allRelsG2 with the same relation and with a number of occurrences EQUAL or greater than the first.


match

public ResMatchCG match(byte matchOperation,
                        CG G1,
                        Concept E1,
                        java.lang.Object bindInf1,
                        CG G2,
                        Concept E2,
                        java.lang.Object bindInf2)
This is the main method of this class. It is a generic matching operation that incorporates also special treatments for the specificity of each CG operation.

Parameters:
matchOperation - specify the CG operation to perform : MAXIMAL_JOIN, GENERALIZE, SPECIALIZE, GENERALISE, EQUAL, SUBSUME, SUBSUME_WITH_RSLT, and UNIFY. Specific methods have been defined for these operations to avoid the specification of the CG operation type (the parameter matchOperation), like maximalJoin(), generalize(), equal(), subsume(), and subsumeWithResult(). More detail on the CG operation is given as we present the other methods, in particular : match, matchCG, matchRelations, matchContexts and matchConcept. Others related methods that are responsible for the construction of the result (if a result should be constructed) are : isPossibleToJoin, constructG3 and the related methods specified in the commentary of constructG3.

G1 - is the first CG
E1 - is the a concept in G1 that will be taken as the entry point, E1 can be null, in this case on entry point is considered
bindInf1 - is the binding information for G1
G2 - is the second CG
E2 - is the a concept in G2 that will be taken as the entry point, E2 can be null, in this case on entry point is considered
bindInf2 - is the binding information for G2
Returns:
a ResMatchCG, if the operation succeeded; the CG that result from the match and the concept that result from the match of E1 and E2 (if the two are not null). If the operation doesn't succeed, it returns null.

match

public ResMatchCG match(byte matchOperation,
                        CG G1,
                        Concept E1,
                        CG G2,
                        Concept E2)
This is the main method of this class. It is a generic matching operation that incorporates also special treatments for the specificity of each CG operation.

Parameters:
matchOperation - specify the CG operation to perform : MAXIMAL_JOIN, GENERALIZE, SPECIALIZE, GENERALISE, EQUAL, SUBSUME, SUBSUME_WITH_RSLT, and UNIFY. Specific methods have been defined for these operations to avoid the specification of the CG operation type (the parameter matchOperation), like maximalJoin(), generalize(), equal(), subsume(), and subsumeWithResult(). More detail on the CG operation is given as we present the other methods, in particular : match, matchCG, matchRelations, matchContexts and matchConcept. Others related methods that are responsible for the construction of the result (if a result should be constructed) are : isPossibleToJoin, constructG3 and the related methods specified in the commentary of constructG3.
G1 - is the first CG
E1 - is the a concept in G1 that will be taken as the entry point, E1 can be null, in this case on entry point is considered
G2 - is the second CG
E2 - is the a concept in G2 that will be taken as the entry point, E2 can be null, in this case on entry point is considered
Returns:
a ResMatchCG, if the operation succeeded; the CG that result from the match and the concept that result from the match of E1 and E2 (if the two are not null). If the operation doesn't succeed, it returns null.

maximalJoin

public ResMatchCG maximalJoin(CG G1,
                              Concept E1,
                              java.lang.Object bindInf1,
                              CG G2,
                              Concept E2,
                              java.lang.Object bindInf2)
Perform maximal join operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
bindInf1 - is the binding information for G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
bindInf2 - is the binding information for G2
Returns:
the maximal join of the two CGs g1 and g2. ResMatchCG will contain the cg as well as the result of the join of the two entry points E1 and E2

maximalJoin

public ResMatchCG maximalJoin(CG G1,
                              Concept E1,
                              CG G2,
                              Concept E2)
Perform maximal join operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
Returns:
the maximal join of the two CGs g1 and g2. ResMatchCG will contain the cg as well as the result of the join of the two entry points E1 and E2

maximalJoin

public CG maximalJoin(CG G1,
                      CG G2)
This definition of MAXIMAL_JOIN has two CG as input and produce the CG that result from the MAXIMAL_JOIN (no entry points are provided)

Parameters:
G1 - A CG to join
G2 - A CG to join
Returns:
the cg that result from the join. Return null if the join fails.

specialize

public Concept specialize(CG G1,
                          Concept E1,
                          java.lang.Object bindInf1,
                          CG G2,
                          Concept E2,
                          java.lang.Object bindInf2)
While maximalJoin() produces a new CG that is a maximalJoin of two CGs G1 and G2, this method specializes g1 itself by doing a maximalJoin of CG g2 to g1, with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.

Parameters:
G1 - The CG to specialize
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
bindInf1 - is the binding information for G1
G2 - The CG to join
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
bindInf2 - is the binding information for G2
Returns:
the result of the join of the two entry points E1 and E2. Of course, the result of specialize is especially a specialization of G1.

specialize

public Concept specialize(CG G1,
                          Concept E1,
                          CG G2,
                          Concept E2)
While maximalJoin() produces a new CG that is a maximalJoin of two CGs G1 and G2, this method specializes g1 itself by doing a maximalJoin of CG g2 to g1, with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.

Parameters:
G1 - The CG to specialize
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
G2 - The CG to join
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
Returns:
the result of the join of the two entry points E1 and E2. Of course, the result of specialize is especially a specialization of G1.

specialize

public boolean specialize(CG G1,
                          CG G2)
While maximalJoin() produces a new CG that is a maximalJoin of two CGs G1 and G2, this method specializes g1 itself by doing a maximalJoin of CG g2 to g1.

Parameters:
G1 - The CG to specialize
G2 - The CG to join
Returns:
true if the specialization was done.

generalize

public ResMatchCG generalize(CG G1,
                             Concept E1,
                             java.lang.Object bindInf1,
                             CG G2,
                             Concept E2,
                             java.lang.Object bindInf2)
Perform generalization operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
bindInf1 - is the binding information for G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
bindInf2 - is the binding information for G2
Returns:
the generalization of the two CGs g1 and g2. ResMatchCG will contain the cg as well as the result of the generalization of the two entry points E1 and E2

generalize

public ResMatchCG generalize(CG G1,
                             Concept E1,
                             CG G2,
                             Concept E2)
Perform generalization operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
Returns:
the generalization of the two CGs g1 and g2. ResMatchCG will contain the cg as well as the result of the generalization of the two entry points E1 and E2

generalize

public CG generalize(CG G1,
                     CG G2)
This definition of generalize has two CG as input and produce the CG that result from the generalization of the two CGs (no entry points are provided)

Parameters:
G1 - A CG to generalize
G2 - A CG to generalize
Returns:
the cg that result from the generalization. Return null if the generalization fails.

surfaceGeneralize

public CG surfaceGeneralize(CG g1,
                            Concept e1,
                            CG g2,
                            Concept e2)

generalize

public CG generalize(CG g1,
                     Type pertinentType1,
                     CG g2,
                     Type pertinentType2)

analogy

public boolean analogy(CG G1,
                       Concept E1,
                       java.lang.Object bindInf1,
                       CG G2,
                       Concept E2,
                       java.lang.Object bindInf2)
analogy() determine the structural matching of the two CG and then transfer to the target CG all the elements that are specific to the source CG

Parameters:
G1 - The target CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
bindInf1 - is the binding information for G1
G2 - The source CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
bindInf2 - is the binding information for G2
Returns:
true : if no analog transfer is done, then the target will remain as it is

analogy

public boolean analogy(CG G1,
                       Concept E1,
                       CG G2,
                       Concept E2)
analogy() determine the structural matching of the two CG and then transfer to the target CG all the elements that are specific to the source CG

Parameters:
G1 - The target CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
G2 - The the source CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
Returns:
true : if no analog transfer is done, then the target will remain as it is

analogy

public boolean analogy(CG G1,
                       CG G2)
analogy() determine the structural matching of the two CG and then transfer to the target CG all the elements that are specific to the source CG

Parameters:
G1 - The target CG
G2 - The source CG
Returns:
true : if no analog transfer is done, then the target will remain as it is

coveredBy

public java.util.Enumeration coveredBy(CG G1,
                                       Concept E1,
                                       java.lang.Object bindInf1,
                                       CG G2,
                                       Concept E2,
                                       java.lang.Object bindInf2)
coveredBy determine which part of G1 (a subgraph S1) covers a part of G2 (a subgraph S2), i.e. S1 covers S2 if S1 is equal or more specific than S2. coveredBy can be complete if all G1 cover a subgraph from G2: if G1 is equal or more specific than a subgraph of G2. coveredBy is partial if only a subgraph of G1 cover a subgraph of G2. Note that the result, if not null, is a new CG G that is a "view" of G2: concepts and relations of G are (exactly) concepts and relations of G2; they are NOT copies of these concepts/relations. This operation is used by our Ontology Information Retrieval Process.

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
bindInf1 - is the binding information for G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
bindInf2 - is the binding information for G2
Returns:
null if there is nothing toCover or return an Enumeration of relations that represents the subgraph, from G2, that is covered.

coveredBy

public java.util.Enumeration coveredBy(CG G1,
                                       Concept E1,
                                       CG G2,
                                       Concept E2)
coveredBy determine which part of G1 (a subgraph S1) covers a part of G2 (a subgraph S2), i.e. S1 covers S2 is S1 is equal or more specific than S2. coveredBy can be complete if all G1 cover a subgraph from G2: if G1 is equal or more specific than a subgraph of G2. coveredBy is partial if only a subgraph of G1 cover a subgraph of G2. Note that the result, if not null, is a new CG G that is a "view" of G2: concepts and relations of G are (exactly) concepts and relations of G2; they are NOT copies of these concepts/relations. This operation is used by our Ontology Information Retrieval Process.

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
Returns:
null if there is nothing toCover or return an Enumeration of relations that represents the subgraph, from G2, that is covered.

coveredBy

public java.util.Enumeration coveredBy(CG G1,
                                       CG G2)
coveredBy determine which part of G1 (a subgraph S1) covers a part of G2 (a subgraph S2), i.e. S1 covers S2 is S1 is equal or more specific than S2. coveredBy can be complete if all G1 cover a subgraph from G2: if G1 is equal or more specific than a subgraph of G2. coveredBy is partial if only a subgraph of G1 cover a subgraph of G2. Note that the result, if not null, is a new CG G that is a "view" of G2: concepts and relations of G are (exactly) concepts and relations of G2; they are NOT copies of these concepts/relations.

Parameters:
G1 - The first CG
G2 - The second CG
Returns:
null if there is nothing toCover or return an Enumeration of relations that represents the subgraph, from G2, that is covered.

compare

public CompareCGResult compare(CG cg1,
                               Concept entryPoint1,
                               CG cg2,
                               Concept entryPoint2)
                        throws java.lang.Exception
Compare two CGs cg1 and cg2 : The operation starts by computing the generalization between the two CG cg1 and cg2. Then, the operation proceeds to determine the type of the relation between the two CGs :

- the two CG are equal if: the matched concepts are equal, the same number of concepts

and the same number of relations (and all the relations have been matched).

- else, newCG is more general than G2 if: the number of concepts of newCG is equal to

the number of matched concepts, and the number of relations of newCG is equal to the number of matched relations, and the matched concepts are equals to the corresponding concepts in newCG.

- else, newCG is more specific than G2 if: the number of concepts of currentCG is equal to

the number of matched concepts, and the number of relations of currentCG is equal to the number of matched relations, and the matched concepts are equals to the corresponding concepts in currentCG.

- else, newCG and currentCG have common information is the result of the generalization is not null and it doesn't correspond to the specified fatherOntNode or to its description.

Parameters:
cg1 - a CG to compare with cg2
entryPoint1 - Entry concept for cg1. entryPoint1 is a (and should be) concept in cg1
cg2 - a CG to compare with cg1
entryPoint2 - Entry concept for cg2. entryPoint2 is a (and should be) concept in cg2
Returns:
a CompareCGResults where the detail of the comparison is recorded
Throws:
java.lang.Exception - if some problems occur during the comparison

compareCG

public CompareCGResult compareCG(CG newCG,
                                 Concept entryPoint,
                                 CG currentCG,
                                 CS fatherOntNode)
                          throws java.lang.Exception
Compare two CGs : newCG and currentCG, and return the result of the comparison. This operation is essential to Dynamic Engine (similar to the role of unification in the interpreter of Prolog). The parameter entryPoint specifies the entry point for newCG. However, no specific entry point is specified for currentCG. So, the first task of this operation is to search for the "best entry point" for currentCG: the best entry point is the concept that produces the best generalization between newCG and currentCG. The best generalization is the generalization with the maximal overlap; the maximum number of matched relations. So the operation identifies any concept of currentCG that can be an entry point for the comparison and then compute the generalization of the two CG (newCG and currentCG). After the best generalization and the best entry point is determined, the operation compute again the best generalization (because the result of the generalizations are not stored), the operation proceeds to determine the type of the relation between the two CG:

- the two CG are equal if: the matched concepts are equal, the same number of concepts

and the same number of relations (and all the relations have been matched).

- else, newCG is more general than G2 if: the number of concepts of newCG is equal to

the number of matched concepts, and the number of relations of newCG is equal to the number of matched relations, and the matched concepts are equals to the corresponding concepts in newCG.

- else, newCG is more specific than G2 if: the number of concepts of currentCG is equal to

the number of matched concepts, and the number of relations of currentCG is equal to the number of matched relations, and the matched concepts are equals to the corresponding concepts in currentCG.

- else, newCG and currentCG have common information is the result of the generalization is not null and it doesn't correspond to the specified fatherOntNode or to its description.

Parameters:
newCG -
entryPoint -
currentCG -
fatherOntNode -
Returns:
CompareCGResults
Throws:
java.lang.Exception

minimalGeneralize

public CG minimalGeneralize(CG g1,
                            CG g2)

individualDesignator

java.util.HashMap individualDesignator(CG g1,
                                       CG g2)

generalise

public Concept generalise(CG G1,
                          Concept E1,
                          java.lang.Object bindInf1,
                          CG G2,
                          Concept E2,
                          java.lang.Object bindInf2)
While generalize() perform a generalization of two CGs and produce a new CG that is a common generalization of the two CGs, this method generalizes CG g1 itself by doing a generalization of CG g2 with g1, with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.

Parameters:
G1 - The CG to generalize
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
bindInf1 - is the binding information for G1
G2 - A CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
bindInf2 - is the binding information for G2
Returns:
the result of the generalization of the two entry points E1 and E2. Of course, the result of generalise is especially a generalization of G1.

generalise

public Concept generalise(CG G1,
                          Concept E1,
                          CG G2,
                          Concept E2)
While generalize() perform a generalization of two CGs and produce a new CG that is a common generalization of the two CGs, this method generalizes CG g1 itself by doing a generalization of CG g2 with g1, with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.

Parameters:
G1 - The CG to generalize
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
G2 - A CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
Returns:
the result of the generalization of the two entry points E1 and E2. Of course, the result of generalise is especially a generalization of G1.

generalise

public void generalise(CG G1,
                       CG G2)
While generalize() perform a generalization of two CGs and produce a new CG that is a common generalization of the two CGs, this method generalizes CG g1 itself by doing a generalization of CG g2 with g1

Parameters:
G1 - The CG to generalize
G2 - A CG

equal

public boolean equal(CG G1,
                     Concept E1,
                     java.lang.Object bindInf1,
                     CG G2,
                     Concept E2,
                     java.lang.Object bindInf2)
Perform equal operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
bindInf1 - is the binding information for G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
bindInf2 - is the binding information for G2
Returns:
true if the two CGs g1 and g2 are equal (in content).

equal

public boolean equal(CG G1,
                     Concept E1,
                     CG G2,
                     Concept E2)
Perform equal operation on CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2.

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
Returns:
true if the two CGs g1 and g2 are equal (in content).

equal

public boolean equal(CG G1,
                     CG G2)
Perform equal operation on CG g1 and CG g2 (no entry points are provided)

Parameters:
G1 - A CG
G2 - A CG
Returns:
true if the two CGs g1 and g2 are equal (in content).

unify

public boolean unify(CG G1,
                     Concept E1,
                     java.lang.Object bindInf1,
                     CG G2,
                     Concept E2,
                     java.lang.Object bindInf2)
Perform unification operation of CG g1 and CG g2 with the concept E1 as an entry point for g1 and the concept E2 as an entry point for g2. Binding information for g1 and g2 are provided also.

Parameters:
G1 - The first CG
E1 - A concept in G1 that plays the role of an entry point
bindInf1 - The Binding information for G1
G2 - The second CG
E2 - A concept in G2 that plays the role of an entry point
bindInf2 - The Binding information for G2
Returns:
true if the two CGs g1 and g2 can be unified.

unify

public boolean unify(CG G1,
                     java.lang.Object bindInf1,
                     CG G2,
                     java.lang.Object bindInf2)
Perform unification operation of CG g1 and CG g2 (no entry points are provided). Binding information for g1 and g2 are provided.

Parameters:
G1 - A CG
bindInf1 - The Binding information for G1
G2 - A CG
bindInf2 - The Binding information for G2
Returns:
true if the two CGs g1 and g2 can be unified.

subsume

public boolean subsume(CG G1,
                       Concept E1,
                       java.lang.Object bindInf1,
                       CG G2,
                       Concept E2,
                       java.lang.Object bindInf2)
Check that the first CG G1 subsumes (is more general than) the second CG G2. Start subsumption operation by matching the two entry concepts E1 and E2.

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
bindInf1 - The Binding information for G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
bindInf2 - The Binding information for G2
Returns:
true if the first cg G1 subsume (is more generalThan) the second cg G2, false otherwise

subsume

public boolean subsume(CG G1,
                       Concept E1,
                       CG G2,
                       Concept E2)
Check that the first CG G1 subsumes (is more general than) the second CG G2. Start subsumption operation by matching the two entry concepts E1 and E2.

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
Returns:
true if the first cg G1 subsume (is more generalThan) the second cg G2, false otherwise

subsume

public boolean subsume(CG G1,
                       CG G2)
Check that the first CG G1 subsumes (is more general than) the second CG G2.

Parameters:
G1 - The first CG
G2 - The second CG
Returns:
true if the first cg G1 SUBSUME (is more generalThan) the second cg G2, false otherwise

subsumeWithResult

public ResMatchCG subsumeWithResult(CG G1,
                                    Concept E1,
                                    java.lang.Object bindInf1,
                                    CG G2,
                                    Concept E2,
                                    java.lang.Object bindInf2)
Its use is similar to subsume except that the image of G1 in G2 is constructed; the image is a subgraph of G2 that is isomorphic to G1 modulo the subsumption constaint on the concepts (the concept in G1 should be more general than its image in G2).

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
bindInf1 - The Binding information for G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
bindInf2 - The Binding information for G2
Returns:
the result of the match (ResMatchCG) if the first cg G1 SUBSUME (is more generalThan) the second cg G2. The result is the image and the concept that result from the match of E1 and E2

subsumeWithResult

public ResMatchCG subsumeWithResult(CG G1,
                                    Concept E1,
                                    CG G2,
                                    Concept E2)
Its use is similar to subsume except that the image of G1 in G2 is constructed; the image is a subgraph of G2 that is isomorphic to G1 modulo the subsumption constaint on the concepts (the concept in G1 should be more general than its image in G2).

Parameters:
G1 - The first CG
E1 - Entry concept for G1. E1 is a (and should be) concept in G1
G2 - The second CG
E2 - Entry concept for G2. E2 is a (and should be) concept in G2
Returns:
the result of the match (ResMatchCG) if the first cg G1 SUBSUME (is more generalThan) the second cg G2. The result is the image and the concept that result from the match of E1 and E2

subsumeWithResult

public CG subsumeWithResult(CG G1,
                            CG G2)
Its use is similar to subsume except that the image of G1 in G2 is constructed; the image is a subgraph of G2 that is isomorphic to G1 modulo the subsumption constaint on the concepts (the concept in G1 should be more general than its image in G2).

Parameters:
G1 - The first CG
G2 - The second CG
Returns:
the result of the match (ResMatchCG) if the first cg G1 SUBSUME (is more generalThan) the second cg G2. The result is the image and the concept that result from the match of E1 and E2

project

public boolean project(CG G1,
                       Concept E1,
                       CG G2,
                       Concept E2)
project checks if G1 is a subgraph of G2, according to the configuration (relational network) only. It is similar to subsume except that it does not check if a concept in G1 is more general than the corresponding concept in G2. As a side effect, project establishs a mapping between concepts in G1 and concepts in G2. This mapping is stored in conceptsMatched HashMap.

Parameters:
G1 - CG
E1 - Concept
G2 - CG
E2 - Concept
Returns:
boolean
Since:
Amine 5

project

public boolean project(CG G1,
                       CG G2)
project checks if G1 is a subgraph of G2, according to the configuration (relational network) only. It is similar to subsume except that it does not check if a concept in G1 is more general than the corresponding concept in G2. As a side effect, project establishs a mapping between concepts in G1 and concepts in G2. This mapping is stored in conceptsMatched HashMap.

Parameters:
G1 - CG
G2 - CG
Returns:
boolean
Since:
Amine 5

expand

public CG expand(CG cg,
                 java.lang.Object bindInf,
                 Concept conc)
Expand the given CG cg by the definition of the concept type of the specified conc which should be a concept in cg. Expansion corresponds to the maximal join of cg with the definition of the specified concept type. Note that the specified type is replaced by its genus in the result. Since a concept type could be defined as a specialization of not only one type but several types (multiple-inheritance), and so it could have in its definition not only one "genus" but several "genus" (i.e. several concepts with designator "super"), expand will loop on all the genus in the definition searching for the one that can lead to a successfull expansion. Also, expand considers in this loop the static parameter of CG: canonicity; if this paramater is set to true, then the result should be canonic. If this parameter is false, the loop will not consider this constraint.

Parameters:
cg - A CG to expand
bindInf - The bindinf information related to cg
conc - The Concept in cg that contains the type to expand
Returns:
A CG that is the result of the expansion

expand

public CG expand(CG cg,
                 java.lang.Object bindInf,
                 Relation rel)
Expand the CG cg by the definition of the relation type of rel which is a relation in cg. Expansion corresponds to the maximal join of cg with the definition of the specified relation type. if the type of the relation is a Variable and bindContext is null or it is not null but the variable has no associated value, then return the specified cg without any expansion.

Parameters:
cg - A CG to expand
bindInf - The bindinf information related to cg
rel - The relation in cg that contains the type to expand
Returns:
A CG that is the result of the expansion

specializeByExpansion

public boolean specializeByExpansion(CG cg,
                                     java.lang.Object bindInf,
                                     Concept concept)
specializeByExpansion performs the expansion in the specified cg itself; it does NOT create a new CG that represents the result of the expansion. This operation is used by our "Description Elaboration Process".

Parameters:
cg - A CG to specialize by expansion
bindInf - The bindinf information related to cg
concept - The Concept in cg that contains the type to expand
Returns:
true if the specialization have been done, and false otherwise (if cg or concept are null or concept is not a concept in cg or the type of the concept has not a definition or the specialization was not possible).

specializeByExpansion

public boolean specializeByExpansion(CG cg,
                                     Concept concept)
specializeByExpansion performs the expansion in the specified cg itself; it does NOT create a new CG that represents the result of the expansion. This operation is used by our "Description Elaboration Process".

Parameters:
cg - A CG to specialize by expansion
concept - The Concept in cg that contains the type to expand
Returns:
true if the specialization have been done, and false otherwise (if cg or concept are null or concept is not a concept in cg or the type of the concept has not a definition or the specialization was not possible).

contractTypeDefinition

public boolean contractTypeDefinition(CG cg,
                                      java.lang.Object bindInf,
                                      Concept concept,
                                      Type type)
Contract the definition of the specified Type from the CG cg, using the specified concept as the entry point for cg. After, the contraction, the type of the specified concept will be replaced by the specified type. contractTypeDefinition is the inverse of the specializeByExpansion operation. Note that the contraction concerns the cg itself. To proceed otherwise, you can give a copy of the CG to the present method.

Parameters:
cg - A CG to contract
bindInf - Binding information for cg
concept - A concept that should be contained in cg
type - A type that should replace the contracted definition
Returns:
true if the contraction has been done.

contractTypeDefinition

public boolean contractTypeDefinition(CG cg,
                                      Concept concept,
                                      Type type)
Contract the definition of the specified Type from the CG cg, using the specified concept as the entry point for cg. After, the contraction, the type of the specified concept will be replaced by the specified type. contractTypeDefinition is the inverse of the specializeByExpansion operation. Note that the contraction concerns the cg itself. To proceed otherwise, you can give a copy of the CG to the present method.

Parameters:
cg - A CG to contract
concept - A concept that should be contained in cg
type - A type that should replace the contracted definition
Returns:
true if the contraction has been done.

contractTypeDefinition

public boolean contractTypeDefinition(CG cg,
                                      Type type)
Contract the definition of the specified Type from the CG cg. contractTypeDefinition is the inverse of the specializeByExpansion operation. Note that the contraction concerns the cg itself. To proceed otherwise, you can give a copy of the CG to the present method.

Parameters:
cg - A CG to contract
type - A type that should replace the contracted definition
Returns:
true if the contraction has been done.

contractTypeDefinition

public boolean contractTypeDefinition(CG cg,
                                      java.lang.Object bindInf,
                                      Concept concept)
Contract from the specified cg the definition of the type of the specified concept. contractTypeDefinition is the inverse of the specializeByExpansion operation. Note that the contraction concerns the cg itself. To proceed otherwise, you can give a copy of the CG to the present method.

Parameters:
cg - A CG to contract
bindInf - Binding information for cg
concept - A concept that should be contained in cg
Returns:
true if the contraction has been done.

contractTypeDefinition

public boolean contractTypeDefinition(CG cg,
                                      Concept concept)
Contract from the specified cg the definition of the type of the specified concept. contractTypeDefinition is the inverse of the specializeByExpansion operation. Note that the contraction concerns the cg itself. To proceed otherwise, you can give a copy of the CG to the present method.

Parameters:
cg - A CG to contract
concept - A concept that should be contained in cg
Returns:
true if the contraction has been done.

completeContract

public boolean completeContract(CG G1,
                                Concept E1,
                                java.lang.Object bindInf1,
                                CG G2,
                                Concept E2,
                                java.lang.Object bindInf2)
Contract G1 from G2, using the two entry concepts E1 for G1 and E2 for G2. The operation checks first if G1 subsumes G2, then G2 will be contracted.

Parameters:
G1 - A CG
E1 - A Concept from G1 that play the role of an entry point for G1
bindInf1 - Binding information for G1
G2 - A CG
E2 - A Concept from G2 that play the role of an entry point for G2
bindInf2 - Binding information for G2
Returns:
true if G2 has been contracted

completeContract

public boolean completeContract(CG G1,
                                Concept E1,
                                CG G2,
                                Concept E2)
Contract G1 from G2, using the two entry concepts E1 for G1 and E2 for G2. The operation checks first if G1 subsumes G2, then G2 will be contracted.

Parameters:
G1 - A CG
E1 - A Concept from G1 that play the role of an entry point for G1
G2 - A CG
E2 - A Concept from G2 that play the role of an entry point for G2
Returns:
true if G2 has been contracted

partialContract

public boolean partialContract(CG G1,
                               Concept E1,
                               java.lang.Object bindInf1,
                               CG G2,
                               Concept E2,
                               java.lang.Object bindInf2)
Unlike completeContract which checks first that G1 subsumes G2, partialContract G1 from G2, using the two entry concepts E1 for G1 and E2 for G2, will check first that a subgraph of G1 subsumes a subgraph of G2. Contraction will operate on the subsumed part of G2.

Parameters:
G1 - A CG
E1 - A Concept from G1 that play the role of an entry point for G1
G2 - A CG
E2 - A Concept from G2 that play the role of an entry point for G2
Returns:
true if G2 has been contracted

partialContract

public boolean partialContract(CG G1,
                               Concept E1,
                               CG G2,
                               Concept E2)
Unlike completeContract which checks first that G1 subsumes G2, partialContract G1 from G2, using the two entry concepts E1 for G1 and E2 for G2, will check first that a subgraph of G1 subsumes a subgraph of G2. Contraction will operate on the subsumed part of G2.

Parameters:
G1 - A CG
E1 - A Concept from G1 that play the role of an entry point for G1
G2 - A CG
E2 - A Concept from G2 that play the role of an entry point for G2
Returns:
true if G2 has been contracted

isCanonic

public boolean isCanonic(CG cg,
                         java.lang.Object bindInf)
Check if the given cg is canonic : a) for each type (concept type or relation type) in cg, search its canon (if it has) and checks that the canon subsumes cg. Also, if a concept in the given cg is a context, check that it is canonic. A canon specifies the minimal constraints for the semantically correct use of a type (concept type and relation type).

Parameters:
cg - A CG
bindInf - Binding information for cg
Returns:
true if cg is canonic

matchCG

boolean matchCG(byte matchOperation,
                CG G1,
                java.lang.Object bindInf1,
                CG G2,
                java.lang.Object bindInf2,
                int nbreRelsG1)
Establish the matching between the two CG according to matchOperation but without constructing the CG that result from the match. The heart of the matching operation : consider the match over all the two CG but without embedded matching : propagate local matchings to the whole G1 and G2. By the bootstrap in matchOperation, we assume that some "local match to do" was added to the list toLocalMatchs. The propagation of local matching is done as follows : While toLocalMatchs contains some elements, we remove one element (the last) and we perform the local match for that element, after the local match an entry for the matching of the two concepts and the resulted concept are added to conceptsMatched. When local match is done : if the operation is a projection based operation we Check that the first CG is completely matched with the second CG. This holds if all the relations of G1 have been matched. The two CG have been matched but without dealing with concepts-contexts. The next step is a recursive call to the matching operation on these contexts.


localMatch

boolean localMatch(byte matchOperation,
                   Concept conc1,
                   java.lang.Object bindInf1,
                   Concept conc2,
                   java.lang.Object bindInf2)

matchRelations

protected boolean matchRelations(byte matchOperation,
                                 java.lang.Object[] relations1,
                                 java.lang.Object bindInf1,
                                 java.lang.Object[] relations2,
                                 java.lang.Object bindInf2,
                                 boolean areIncomeRelations)
scan the list relations1 for all the relations that are not matched already (by looking at relationsMatched) and search corresponding relations in relations2 to match them. Note : Since we consider only functional CG we assume that if two relations have the same relation type, then they should match, except for GENERALIZE.


matchContexts

boolean matchContexts(byte matchOperation,
                      java.lang.Object bindInf1,
                      java.lang.Object bindInf2)
Looking for all the embedded CGs of the two current CG and match them.


matchConcept

protected boolean matchConcept(byte matchOperation,
                               Concept conc1,
                               java.lang.Object bindInf1,
                               Concept conc2,
                               java.lang.Object bindInf2)
If the two concepts to match (conc1 and conc2) have been already matched, then nothing to do, else match the two concepts, add the result to conceptsMatched, and add a new entry to toLocalMatchs. The matching of two concepts is a method of Concept (it corresponds to the matching of their types, designators, coreferences, and descriptors).


animateConcept

protected void animateConcept(int ind,
                              Concept concept,
                              boolean mode)

animateRelation

protected void animateRelation(int ind,
                               Relation relation,
                               boolean mode)

stopAnimation

protected void stopAnimation()

matchConc

boolean matchConc(byte matchOperation,
                  Concept conc1,
                  java.lang.Object bindInf1,
                  Concept conc2,
                  java.lang.Object bindInf2)

matchConc1

boolean matchConc1(byte matchOperation,
                   Concept conc1,
                   java.lang.Object bindInf1,
                   Concept conc2,
                   java.lang.Object bindInf2)

individualDesignator

boolean individualDesignator(CG G1,
                             java.lang.Object bindInfG1,
                             CG G2,
                             java.lang.Object bindInfG2,
                             ConcCouple concCple)

individualDesignator

Individual individualDesignator(java.lang.Object ref,
                                java.lang.Object bindInf)

setDesignator

AmineSet setDesignator(java.lang.Object ref,
                       java.lang.Object bindInf)

objDesignator

java.lang.Object objDesignator(java.lang.Object ref,
                               java.lang.Object bindInf)

getIndividual

java.lang.Object getIndividual(Concept conc,
                               java.lang.Object bindInf)

matchedCoref

boolean matchedCoref(byte matchOperation,
                     CG G1,
                     java.lang.Object bindInf1,
                     CG G2,
                     java.lang.Object bindInf2,
                     ConcCouple concCple)

sleep

protected void sleep()

isPossibleToJoin

boolean isPossibleToJoin(byte matchOperation,
                         Concept concG1,
                         java.lang.Object bindInf1,
                         Concept concG2,
                         java.lang.Object bindInf2)
First check : if concG1 and concG2 have two income relations with the same type then it isnt possible to join since the resulted CG will not be functional If income relations of the two concepts are mutually different then the Second check is done; it is similar to the first except that is done on outcome relations.


mutuallyDiffRels

boolean mutuallyDiffRels(java.util.Enumeration rels1,
                         java.lang.Object bindInf1,
                         java.lang.Object[] rels2,
                         java.lang.Object bindInf2)
Test for functional CG. This method concerns income (outcome) relations of two concepts


constructG3

boolean constructG3(byte matchOperation,
                    CG G1,
                    java.lang.Object bindInf1,
                    CG G2,
                    java.lang.Object bindInf2,
                    CG G3)
The general case of the construction of G3 from G1 and G2. The construction of a result concern MAXIMAL_JOIN, GENERALIZE and subsumeWithResult. The construction that requires more treatment is the construction of the MAXIMAL_JOIN result. See the comment on the method commonRslt() for the construction of the result of GENERALIZE and subsumeWithResult. The result CG G3 of MAXIMAL_JOIN will be constructed in two steps : 1) create G3 as a copy of G1 but replace each concept of G1 by the result of concept matching or by a copy of the concept (if the concept has not been matched). Since we can't access directly Concept2 and relations2 from the auxiliary data structures (conceptsMatched, relationsMatched), we will create two auxiliary data structures that provides such a direct access to enable an efficient treatment. So, first, from conceptsMatched create the HashMap c2c3 with entries : Cc2 => Cc3. Thus, specific concepts and relations of G2 can be accessed more easily. 2) scan G2 for relations that are specific to G2, add them to G3 with replacing each concept by the result of concept matching or by a copy of the concept (if the concept has not been matched) see createG3FromG1 for the continuation of the treatment (and the associated comment)


maxJoinRslt

boolean maxJoinRslt(CG G1,
                    java.lang.Object bindInf1,
                    CG G2,
                    java.lang.Object bindInf2,
                    CG G3)

createG3FromG1

void createG3FromG1(CG G1,
                    java.lang.Object bindInf1,
                    CG G3)
Start code for the first Step of maxJoinRslt : First : Create G3 from G1 create the squeleton of all the Concept of G3 from G1 to make sure later that the same concept is always refered by the same pointer. Second, scan G1 to create a copy of each relation but replace each concept in the relation with the concept that result from the concept matching or create a copy of the concept if it has not been matched. An important part of this method concerns the treatment of coreference: coreferences specific to G1 and to G2 should be added to G3, but with a renaming of these coreferences.


specialize

boolean specialize(CG G1,
                   java.lang.Object bindInf1,
                   CG G2,
                   java.lang.Object bindInf2)
Specialize G1 by specializing concepts that were matched (by the content of the concept that result from the match/join) and by adding to G1 what is specific to G2.

Parameters:
G1 - The CG to specialize
bindInf1 - binding information for G1
G2 - The CG to join to G1 (i.e. used for the specialization of G1)
bindInf2 - binding information for G2
Returns:
true if the specialization was successfull

renameSpecCorefsOfG1

void renameSpecCorefsOfG1(CG g1)

addSpcfcG2ToGx

boolean addSpcfcG2ToGx(CG G2,
                       java.lang.Object bindInf2,
                       CG Gx,
                       java.util.HashMap c2cx)
Method common to both maxJoinRslt and Specialize


analogicalTransfer

boolean analogicalTransfer(CG cgTarget,
                           java.lang.Object bindInf1,
                           CG cgSource,
                           java.lang.Object bindInf2)
Code for Analogical Transfer


isCanonic

boolean isCanonic(CG cgTarget,
                  java.lang.Object bindInf1,
                  Concept newConcept,
                  java.lang.Object bindInf2)

isCanonic

boolean isCanonic(CG cgTarget,
                  java.lang.Object bindInf1,
                  Relation newRelation,
                  java.lang.Object bindInf2)

analogicalCopy

Concept analogicalCopy(Concept c2,
                       java.lang.Object bindInf)

analogicalCoref

Concept analogicalCoref(Concept conc,
                        java.lang.Object bindInf)

copyWithMapping

public CG copyWithMapping(CG ante,
                          CG consq)
End Code for Analogical Transfer


impliedByMapping

Concept impliedByMapping(CG ante,
                         Concept conc3)

commonRslt

boolean commonRslt(CG G1,
                   java.lang.Object bindInf1,
                   CG G3)
The resulted CG G3 is a common graph of the two input CG, modulo the nature of the operation (GENERALIZE or subsumeWithResult). The construction is done in two steps : First, put in G3 all the Concept that resulted from the match, Second, Scan G1 to create a copy of each relation matched but replace each concept in the relation with the concept that result from the concept matching.


generalise

boolean generalise(CG G1,
                   java.lang.Object bindInf1,
                   CG G2,
                   java.lang.Object bindInf2)
Generalize G1 by generalizing concepts that were matched (by the content of the concept that result from the match/generalize) and by removing from G1 what is specific to it.

Parameters:
G1 - The CG to generalize
bindInf1 - binding information for G1
G2 - The CG that will generalize G1
bindInf2 - binding information for G2
Returns:
true if the generalization was successfull

removeDanglingRelation

boolean removeDanglingRelation(java.lang.Object bindInf1,
                               CG cg2,
                               Relation relation,
                               java.lang.Object bindInf2)
A relation is dangling if either its source or target concept has no other relation and the "isolated" concept is not specific to cg; it can be recovered by definition expansion.

Parameters:
relation - A Relation
Returns:
true if Relation is dangling and it has been removed from cg.

isConnectingRelation

boolean isConnectingRelation(CG cg,
                             Relation relation)
A relation is a connecting relation if its elimination would make the CG disconnected.

Parameters:
relation - A Relation to check
Returns:
true if relation is a connecting relation

nameOfOper

public static java.lang.String nameOfOper(byte matchOperation)
Returns:
the identifier of the CG operation given the constant that represents it : MAXIMAL_JOIN, GENERALIZE, SUBSUME, SUBSUME_WITH_RSLT, etc.

operInByte

public static byte operInByte(java.lang.String idCGOper,
                              int nbrArgs)

isInDescr

public boolean isInDescr(CS ontNode,
                         CG cg)

eqMatchConc

public static boolean eqMatchConc(int range1,
                                  int range2,
                                  java.util.HashMap concsMatched)

rangeConc

static Concept rangeConc(int range,
                         Concept c1,
                         Concept c2,
                         Concept c3)