protected static Object [ ] mkAxioms ( HashMap < IAtomicConceptOfLabel , String > hashConceptNumber , Map < INode , ArrayList < IAtomicConceptOfLabel > > nmtAcols , Map < String , IAtomicConceptOfLabel > sourceACoLs , Map < String , IAtomicConceptOfLabel > targetACoLs , IContextMapping < IAtomicConceptOfLabel > acolMapping , INode sourceNode , INode targetNode ) { StringBuilder axioms = new StringBuilder ( ) ; Integer numberOfClauses = 0 ; // create DIMACS variables for all acols in the matching task createVariables ( hashConceptNumber , nmtAcols , sourceACoLs , sourceNode ) ; createVariables ( hashConceptNumber , nmtAcols , targetACoLs , targetNode ) ; ArrayList < IAtomicConceptOfLabel > sourceACols = nmtAcols . get ( sourceNode ) ; ArrayList < IAtomicConceptOfLabel > targetACols = nmtAcols . get ( targetNode ) ; if ( null != sourceACols && null != targetACols ) { for ( IAtomicConceptOfLabel sourceACoL : sourceACols ) { for ( IAtomicConceptOfLabel targetACoL : targetACols ) { char relation = acolMapping . getRelation ( sourceACoL , targetACoL ) ; if ( IMappingElement . IDK != relation ) { //get the numbers of DIMACS variables corresponding to ACoLs String sourceVarNumber = hashConceptNumber . get ( sourceACoL ) ; String targetVarNumber = hashConceptNumber . get ( targetACoL ) ; if ( IMappingElement . LESS_GENERAL == relation ) { String tmp = "-" + sourceVarNumber + " " + targetVarNumber + " 0\n" ; //if not already present add to axioms if ( - 1 == axioms . indexOf ( tmp ) ) { axioms . append ( tmp ) ; numberOfClauses ++ ; } } else if ( IMappingElement . MORE_GENERAL == relation ) { String tmp = sourceVarNumber + " -" + targetVarNumber + " 0\n" ; if ( - 1 == axioms . indexOf ( tmp ) ) { axioms . append ( tmp ) ; numberOfClauses ++ ; } } else if ( IMappingElement . EQUIVALENCE == relation ) { if ( ! sourceVarNumber . equals ( targetVarNumber ) ) { //add clauses for less and more generality String tmp = "-" + sourceVarNumber + " " + targetVarNumber + " 0\n" ; if ( - 1 == axioms . indexOf ( tmp ) ) { axioms . append ( tmp ) ; numberOfClauses ++ ; } tmp = sourceVarNumber + " -" + targetVarNumber + " 0\n" ; if ( - 1 == axioms . indexOf ( tmp ) ) { axioms . append ( tmp ) ; numberOfClauses ++ ; } } } else if ( IMappingElement . DISJOINT == relation ) { String tmp = "-" + sourceVarNumber + " -" + targetVarNumber + " 0\n" ; if ( - 1 == axioms . indexOf ( tmp ) ) { axioms . append ( tmp ) ; numberOfClauses ++ ; } } } } } } return new Object [ ] { axioms . toString ( ) , numberOfClauses } ; }
Makes axioms for a CNF formula out of relations between atomic concepts .