MORE COMMENTARY ON THE DYNAMIC ONTOLOGY PROCESS

by Karim Bouzoubaa

 

case MORE_GENERAL

// proceeding the case MORE_GENERAL: except some cases, in general the link

// father->currentNode will be replaced by father->newOntNode->currentNode

 

case MORE_GENERAL: {

     if (!simulation) {

      trace("Proceeding the case of MORE_GENERAL");

      if (newOntNode.isType() && Type.hasDefinition(newOntNode))

        contract((Type) newOntNode, currentOntNode);

      link(newOntNode, currentOntNode);                         // 1

      trace("Adding a link between: \n", newOntNode);

      trace(" and \n", currentOntNode);

 

 

 

 

 

      if (realComparison) {

        link(fatherOntNode, newOntNode);                        // 2

        removeLink(fatherOntNode, currentOntNode);              // 2

        if (trace) {

          trace("Adding a link between: \n" + toString(fatherOntNode)

                + " and \n" + toString(newOntNode) );

          trace("Removing the link between: \n" + toString(fatherOntNode)

                + " and \n" + toString(currentOntNode) );

        }

      }

 

 

 

 

 

      else  if (fatherOntNode instanceof Individual)  {            // 2’

        Type typeOfIndividual = ((Individual) fatherOntNode).getType();

        link(typeOfIndividual, newOntNode);                        // 2’

        trace("Adding a link from the type of the father \n" +   

               toString(typeOfIndividual) + "\n to the new Ont Node");

      }

 

 

 

 

 

 

 

 

 

 

 

      if (realComparison)                                               // 3

        updateFathers(newOntNode, currentOntNode, "new ontology node"); // 3

 

 

 

         ….

 

 

 

 

 

Zone de Texte: New

 

Zone de Texte: Current

Zone de Texte: Father

Zone de Texte: 3

Zone de Texte: 2

Zone de Texte: 2

Zone de Texte: New

Zone de Texte: Current

Zone de Texte: Father

Zone de Texte: New

Zone de Texte: Current

Zone de Texte: Father

Zone de Texte: 1

Zone de Texte: 2’

Zone de Texte: New

Zone de Texte: Current

Zone de Texte: Father

Zone de Texte: Type(Father)

Zone de Texte: Other Father

 

 

 

1) In all cases

- we add the link

       New-> Current

 

 

 

 

 

 

 

 

 

2) If we have to compare (i.e. Father is not an individual)

- we add the link

       Father -> New

- we remove the link

       Father -> Current

 

 

 

 

 

 

 

 

 

2’) If Father is an individual

- we add the link

     Type(Father) -> New

 

 

 

 

 

 

 

 

 

 

 

 

3) In case the Father is not an individual, we check the other fathers (individuals and types) of Current that contain concepts of New. In such case

- we add the link

      Other Father -> New

- we remove the link

      Other Father -> Current

 

 

 

 

case MORE_SPECIFIC

 

// proceeding the case MORE_SPECIFIC: except some cases, in general the new

// Node is integrated via the children of the currentNode. In case no

// integration is done with all the children the new node is added as a child

// of the current node.

 

case MORE_SPECIFIC: {

   boolean integrated = false;

   trace("Proceeding the case of MORE_SPECIFIC");

   if (currentOntNode.isType() && Type.hasDefinition(currentOntNode))

      contract((Type) currentOntNode, newOntNode);

 

   /////////  1

   Enumeration currOntNodeChildren = currentOntNode.getChildren();

   if (currOntNodeChildren != null) {

     ArrayList copyChildren = enum2ArrayList(currOntNodeChildren);

     for(Iterator i = copyChildren.iterator(); i.hasNext(); ) {

       CS childOntNode = (CS) i.next();

       if (childOntNode instanceof Individual &&

          ((Individual)childOntNode).getType() != currentOntNode ) {

         trace("**** ChildOntNode is Individual and its Type is different

               from currentOntNode: ", childOntNode);

         continue;

       }

       trace("Compare and proceed with the child: \n", childOntNode);

       integrated = compareAndProceed(newOntNodeWrapper, entryPoint,

                                      currentOntNode,

                                      childOntNode, realComparison,

                                      simulation, compareNodesHshMap,

                                      contextsToIntegrate, mainContext) ||

                    integrated;

     }

     copyChildren.clear();

     copyChildren = null;

   }

   newOntNode = newOntNodeWrapper.newOntNode;

 

  

 

 

 

  /////////  2

 

 

 

 

 

 

 

 

 

   if (!integrated && !simulation) {  /////////  2’

     trace("No integration done with all the children OR no children found

            for the node: \n", currentOntNode);

     Object ref = entryPoint.getDesignator();

     if ( ref instanceof Individual &&  currOntNodeChildren != null &&

           enum2ArrayList(currOntNodeChildren).contains(ref) ) { /// 2’.1

       link(((Individual)ref), newOntNode);                      /// 2’.1

       trace("The new CS is added as a child of " + toString((Individual)  

              ref));

     }

 

 

 

 

 

 

 

 

 

 

 

 

 

 

    else if ((currentOntNode instanceof Individual &&

            ref != currentOntNode) //2’.2.1

            ||

            currentOntNode.isChild(newOntNode)   //2’.2.2

         ){

      trace("Nothing is done with : ", currentOntNode);

     }

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


     else {

       link(currentOntNode, newOntNode); //2’.3

       trace("The new CS is added as a child of ", currentOntNode);

     }

   }

   else trace("Integration done for:", currentOntNode);

 

 

   ….

 

 

Zone de Texte: 2’.3

 

Zone de Texte: Father

 

Zone de Texte: New

 

Zone de Texte: Current

 

Zone de Texte: New

 

Zone de Texte: Current=Ind1

 

Zone de Texte: 2’.2.2

 

Zone de Texte: Current

 

Zone de Texte: Father

 

Zone de Texte: 2’.2.1

 

Zone de Texte: New
[Entry Point: Ind2]

 

Zone de Texte: Father

 

Zone de Texte: Father

 

Zone de Texte: Child

 

Zone de Texte: New

 

Zone de Texte: 2

 

Zone de Texte: Current

 

Zone de Texte: 2’.1

 

Zone de Texte: New

 

Zone de Texte: Father

 

Zone de Texte: Ind

 

Zone de Texte: Current

 

Zone de Texte: Child

 

Zone de Texte: Child

 

Zone de Texte: Child

 

Zone de Texte: Father

 

Zone de Texte: 1

 

Zone de Texte: New

 

Zone de Texte: New

 

Zone de Texte: New

 

Zone de Texte: Current

 

 

 

 

 

 

 

 

 

 

 

1) New is integrated from all the children of Current (Except the individuals for which the type does not correspond to Current) 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2) If New has been integrated via one the children of Current, nothing is done

 

 

 

 

 

 

 

 

 

 

 

 

2’) If the integration has not been done (or if Current has no children)

 

2’.1) If one of the children of Current is an individual and that individual is the individual of the entry Point

- add the link

     Child -> New

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2’.2.1) If the Current is an individual that is different from the designator or the entry Point

 

 

 

 

 

 

 

or

 

 

 

 

 

2’.2.2) There is already a link between Current and New

 

-          Nothing is done

 

 

 

 

 

 

 

 

2’.3) In all other cases

- add the link

     Current -> New

 

 

 

 

 

 

 

 

 

 

 

 

 

 

case EQUAL

// proceeding the case EQUAL: except some cases, in general the current Node

// will be merged with the new Node

 

case EQUAL: {

   if (!simulation) {

         trace("Proceeding the case of EQUAL");

         CS ontNodeToKeep = null, ontNodeToEliminate = null;  //1

         ArrayList childrenList = null, ToEliminateList, ToKeepList;

         if (currentOntNode == newOntNode)

           return;

 

 

 

       /// 2

      else if ((currentOntNode.isSituation() || Type.hasCanon(currentOntNode))

                  &&

                Type.hasDefinition(newOntNode)) {

          ontNodeToEliminate = currentOntNode;

          ontNodeToKeep = newOntNode;

          childrenList = children(ontNodeToEliminate);

         }

 

 

 

 

 

 

 

 

 

 

 

 

    /// 2’

    else if ((newOntNode.isSituation() ||

              Type.hasCanon(newOntNode)) &&

              Type.hasDefinition(currentOntNode)) {

     ontNodeToEliminate = newOntNode;

     ontNodeToKeep = currentOntNode;

     newOntNodeWrapper.newOntNode = currentOntNode;

     updateCompareNodesHshMap(compareNodesHshMap, newOntNode, currentOntNode);

     childrenList = children(ontNodeToEliminate);

         }

    else if ((newOntNode.isSituation() ) && (currentOntNode.isSituation() )) {

          ontNodeToEliminate = newOntNode;

          ontNodeToKeep = currentOntNode;

 

            }

 

….

 

Zone de Texte: Current

 

Zone de Texte: 2’

 

Zone de Texte: New

 

Zone de Texte: 2

 

Zone de Texte: New

 

Zone de Texte: Father

 

Zone de Texte: Current

 

Zone de Texte: 1

 

Zone de Texte: New

 

Zone de Texte: Father

 

Zone de Texte: Current

 

 

 

 

 

 

 

 

 

 

 

1) Current and New are equal, depending on their respective types, one is to be kept, the other is to be removed 

 

 

 

 

 

2) If

Current is Situation/Canon

  And

New is Definition

 

-Keep New

-Remove Current

 

 

 

 

 

 

 

2’) If

New is Situation/Canon

  And

Current is Definition

 

OR

 

New is Situation

  And

Current is Situation

 

-Keep Current

-Remove New

 

 

 

 

 

case HAVE_AN_INTERSECTION

// proceeding the case HAVE_AN_INTERSECTION: except some cases, in general a

// common Node would be created. The content of this common node is the

// generalization of the current Node and the new Node. The link

// fatherNode->currentNode will be replaced with fatherNode->commonNode,

// commonNode->currentNode and commonNode->newNode

 

case HAVE_AN_INTERSECTION: {

       CS commonNode = null;

       if (!simulation && !hybridSimulation()) {

         CG commonNodeCG = (CG) compareCGResults.getCommonCG();

         trace("Proceeding the case of HAVE_AN_INTERSECTION");

         trace("The content of the common node to create is: \n",

                 commonNodeCG);

         CS effectiveFather = fatherOntNode;

         if (!realComparison)

           effectiveFather = ( (Individual) fatherOntNode).getType();

         removeLink(effectiveFather, currentOntNode);

         trace("Removing the link between the father and the current node");

 

         if (removeLink(effectiveFather, newOntNode))

           trace("Removing the link between the father and the new node");

           trace("Checking if the new situation to create equals to one of the

                  remaining fathers of the current node");

         Enumeration currentOntNodeFathers = currentOntNode.getFathers(); //1

         boolean integratedAmongFathers = false;

         if (currentOntNodeFathers != null) //Even if impossible

           for (Enumeration i = currentOntNodeFathers; i.hasMoreElements() &&

                                         !integratedAmongFathers; ) {     //1

 

 

 

             CS oneFather = (CS) i.nextElement();

             if (oneFather != null && !fatherOntNode.isFather(oneFather) &&

                 oneFather != fatherOntNode &&

                 commonNodeCG.equal(getContent(oneFather))) {     // 1.1

               commonNode = oneFather;

               integratedAmongFathers = true;

               link(oneFather, newOntNode);                       // 1.1

               trace("Yes, it's the case, we link from another father (if not

Zone de Texte: Common =
Other Father

 

Zone de Texte: Current

 

Zone de Texte: Other Father

 

Zone de Texte: 1.1

 

Zone de Texte: Father

 

Zone de Texte: New

 

                     already linked): \n", oneFather);

               trace("to the new ont node: \n", newOntNode);

 

 

 

 

 

 

 

 

 

 

 

 

               if (realComparison) {                       // 1.2

                 link(fatherOntNode, oneFather);           // 1.2

                 trace("we link from the current father: \n", fatherOntNode);

                 trace("to this other father : \n", oneFather);

               }

 

 

 

 

 

 

 

 

 

               else if (fatherOntNode instanceof Individual) {    // 1.2’

                Type typeOfIndividual= ((Individual) fatherOntNode).getType();

                 link(typeOfIndividual, oneFather);               // 1.2’

                 trace("we link from the type of the father: \n",

                        typeOfIndividual);

                 trace("to this other father : \n", oneFather);

               }

             }

           }

 

 

 

 

 

    

 

 

 

   if (!integratedAmongFathers ) {         // 3

      trace("The checking is done without any integration");

      // If newOntNode and currentOntNode are Context CS, then the common

      // node to create will be also a Context CS (not a Situation).

      if (Context.isContext(newOntNode) && Context.isContext(currentOntNode)){

         Type subjectNewOntNode = ((Context) newOntNode).getType();

         Type subjectCurrentOntNode = ((Context) currentOntNode).getType();

         Type subjectCommonNode=subjectNewOntNode.getMinComSuperType(

                                                    subjectCurrentOntNode );

         commonNode = new Context(subjectCommonNode, commonNodeCG);   //3.1

      }

      else {

         commonNode = new Situation(commonNodeCG);                    //3.1

      }

 

      guiTrace(commonNode);

      Concept concept;

      for (Enumeration e = commonNodeCG.getConcepts(); e.hasMoreElements();) {

         concept = (Concept) e.nextElement();

         if (Context.isContext(concept.getDescriptor())) {

          link((Context) concept.getDescriptor(), commonNode);

          // if description of the commonNode contains a context, the

          // corresponding context node should index commonNode

          trace("Adding a link from a context Node to the common Node. Context

                Node is: \n", (Context) concept.getDescriptor());

         }

      }

 

 

      link(commonNode, currentOntNode);      //3.1

      trace("Adding a link from the common Node to currentNode: \n",

                                                             currentOntNode);

      link(commonNode, newOntNode);          //3.1

      trace("Adding a link from the common Node to the new CS");

 

 

 

 

 

 

 

     

      link(effectiveFather, commonNode);    //3.2

      trace("Adding a link from the father Node to the common Node: \n",

                                                                 commonNode);

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

      if (realComparison)                                          //3.3

        updateFathers(commonNode, currentOntNode, "common node");  //3.3

   }

 

 

 

 

 

 

 

 

 

 

 

      } // end of case HAVE_AN_INTERSECTION

 

 

 

 

 

 

Zone de Texte: 3.2

 

Zone de Texte: Current

 

Zone de Texte: Father

 

Zone de Texte: New

 

Zone de Texte: Common

 

Zone de Texte: 3.1

 

Zone de Texte: Current

 

Zone de Texte: Father

 

Zone de Texte: New

 

Zone de Texte: Common

 

Zone de Texte: Type(Father)

 

Zone de Texte: 1.2’

 

Zone de Texte: Other Father

 

Zone de Texte: Common =
Other Father

 

Zone de Texte: Current

 

Zone de Texte: Father

 

Zone de Texte: New

 

Zone de Texte: 1.2

 

Zone de Texte: New

 

Zone de Texte: Other Father

 

Zone de Texte: Common =
Other Father

 

Zone de Texte: Current

 

Zone de Texte: Father

 

Zone de Texte: Other Father

 

Zone de Texte: Common

 

Zone de Texte: 1

 

Zone de Texte: Father

 

Zone de Texte: Current

 

Zone de Texte: Other Father

 

Zone de Texte: Current

 

Zone de Texte: 3.3

 

Zone de Texte: Common

 

Zone de Texte: New

 

Zone de Texte: Father

 

 

 

 

 

 

 

 

 

 

1) Check if the content of Common (to create) corresponds to one of the fathers of Current 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1.1) If one of the other fathers Other Father is not a descendant of Father and the content of Other Father equals Common

- add the link

     Other Father -> New

 

 

 

 

 

 

 

 

1.2) If Other Father is not an individual

- add the link

     Father -> Other Father

 

 

 

 

 

 

 

 

 

 

 

 

 

1.2’) If Other Father is an individual

- add the link

 Type(Father) -> Other Father

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3) If the integration has not been done among one of the other fathers of Current

 

 

 

 

 

3.1)Creation of the Common and

- add the link

     Common -> New

- add the link

     Common -> Current

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3.2)- add the link

   Effective Father -> Common

 

 

 

 

 

 

 

 

 

 

 

 

 

3.3) In case the Father is not an individual, we check the other fathers (individuals and types) of Current that contain concepts of Common. In such case

- we add the link

      Other Father -> Common

- we remove the link

      Other Father -> Current