protected String getSolutionFromMatchesWithClause ( IslandsPolicy . IslandPolicies islandPolicy , String matchesName , String indent ) { String indent2 = indent + TABSTOP ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( indent ) . append ( "solutions AS\n" ) ; sb . append ( indent ) . append ( "(\n" ) ; sb . append ( indent2 ) . append ( "SELECT " ) ; if ( islandPolicy == IslandsPolicy . IslandPolicies . none ) { sb . append ( "min(keys.key) AS key, " ) . append ( matchesName ) . append ( ".n AS n, " ) . append ( matchesName ) . append ( ".text, " ) . append ( matchesName ) . append ( ".corpus, " ) ; sb . append ( "min(" ) . append ( matchesName ) . append ( ".min" ) . append ( "), " ) ; sb . append ( "max(" ) . append ( matchesName ) . append ( ".max" ) . append ( ")" ) ; } else if ( islandPolicy == IslandsPolicy . IslandPolicies . context ) { sb . append ( "keys.key AS key, " ) . append ( matchesName ) . append ( ".n AS n, " ) . append ( matchesName ) . append ( ".text, " ) . append ( matchesName ) . append ( ".corpus, " ) ; sb . append ( matchesName ) . append ( ".min, " ) ; sb . append ( matchesName ) . append ( ".max" ) ; } else { throw new UnsupportedOperationException ( "No implementation for island policy " + islandsPolicy . toString ( ) ) ; } sb . append ( "\n" ) . append ( indent2 ) ; sb . append ( "FROM " ) . append ( matchesName ) . append ( ", keys\n" ) . append ( indent2 ) ; sb . append ( "WHERE keys.n = " ) . append ( matchesName ) . append ( ".n\n" ) ; if ( islandPolicy == IslandsPolicy . IslandPolicies . none ) { sb . append ( indent2 ) . append ( "GROUP BY " ) . append ( matchesName ) . append ( ".n, " ) . append ( matchesName ) . append ( ".text, " ) . append ( matchesName ) . append ( ".corpus" ) . append ( "\n" ) ; } sb . append ( indent ) . append ( ")" ) ; return sb . toString ( ) ; }
Breaks down the matches table so that each node of each match has it s own row .