private char matchPrefix ( String str1 , String str2 ) { //here always str1.startsWith(str2) colorless!color char rel = IMappingElement . IDK ; int spacePos1 = str1 . indexOf ( ' ' ) ; String suffix = str1 . substring ( str2 . length ( ) ) ; if ( - 1 < spacePos1 && ! suffixes . containsKey ( suffix ) ) { //check suffixes - pole vault=pole vaulter if ( str2 . length ( ) == spacePos1 ) { //plant part<plant rel = IMappingElement . LESS_GENERAL ; } else { //plant part<plan String left = str1 . substring ( 0 , spacePos1 ) ; char secondRel = match ( left , str2 ) ; if ( IMappingElement . MORE_GENERAL == secondRel || IMappingElement . EQUIVALENCE == secondRel ) { rel = IMappingElement . LESS_GENERAL ; } else { //?,<,! rel = secondRel ; } } } else { //spelling: -tree and tree if ( suffix . startsWith ( "-" ) ) { suffix = suffix . substring ( 1 ) ; } if ( suffix . endsWith ( "-" ) || suffix . endsWith ( ";" ) || suffix . endsWith ( "." ) || suffix . endsWith ( "," ) || suffix . endsWith ( "-" ) ) { suffix = suffix . substring ( 0 , suffix . length ( ) - 1 ) ; } if ( suffixes . containsKey ( suffix ) ) { rel = suffixes . get ( suffix ) ; rel = reverseRelation ( rel ) ; } //another approximation = Gversion4 // if (rel == MatchManager.LESS_GENERAL || rel == MatchManager.MORE_GENERAL) { // rel = MatchManager.EQUIVALENCE; // } } //filter = Gversion3 // if (MatchManager.LESS_GENERAL == rel || MatchManager.MORE_GENERAL == rel) { // rel = MatchManager.EQUIVALENCE; // } return rel ; }
Computes relation with prefix matcher .