public int enrichXml(final MMOs root) throws SQLException {
        int count = 0;
        // TODO: take out the print statements
        for (final MMO mmo : root.getMMO()) {
            for (final Utterance utterance : mmo.getUtterances().getUtterance()) {
                for (final Phrase phrase : utterance.getPhrases().getPhrase()) {
                    System.out.printf("Phrase: %s\n", phrase.getPhraseText());
                    for (final Mapping mapping : phrase.getMappings().getMapping()) {
                        System.out.printf("Score: %s\n", mapping.getMappingScore());
                        for (final Candidate candidate : mapping.getMappingCandidates().getCandidate()) {
                            final Collection<String> semTypes = new ArrayList<>();
                            for (final SemType st : candidate.getSemTypes().getSemType()) {
                                semTypes.add(st.getvalue());
                            }

                            // the actual line of work
                            count += addSnomedId(candidate) ? 1 : 0;

                            System.out.printf("  %-5s %-9s %s %s %s %s\n",
                                              candidate.getCandidateScore(),
                                              candidate.getCandidateCUI(),
                                              candidate.getSnomedId(),
                                              candidate.getCandidatePreferred(),
                                              semTypes,
                                              candidate.getSources().getSource());
                        }
                    }
                    System.out.println();
                }
            }
        }
        return count;
    }
public int enrichXml ( final MMOs root ) throws SQLException { int count = 0 ; for ( final MMO mmo : root . getMMO ( ) ) { for ( final Utterance utterance : mmo . getUtterances ( ) . getUtterance ( ) ) { for ( final Phrase phrase : utterance . getPhrases ( ) . getPhrase ( ) ) { System . out . printf ( "Phrase: %s\n" , phrase . getPhraseText ( ) ) ; for ( final Mapping mapping : phrase . getMappings ( ) . getMapping ( ) ) { System . out . printf ( "Score: %s\n" , mapping . getMappingScore ( ) ) ; for ( final Candidate candidate : mapping . getMappingCandidates ( ) . getCandidate ( ) ) { final Collection < String > semTypes = new ArrayList < > ( ) ; for ( final SemType st : candidate . getSemTypes ( ) . getSemType ( ) ) { semTypes . add ( st . getvalue ( ) ) ; } count += addSnomedId ( candidate ) ? 1 : 0 ; System . out . printf ( "  %-5s %-9s %s %s %s %s\n" , candidate . getCandidateScore ( ) , candidate . getCandidateCUI ( ) , candidate . getSnomedId ( ) , candidate . getCandidatePreferred ( ) , semTypes , candidate . getSources ( ) . getSource ( ) ) ; } } System . out . println ( ) ; } } } return count ; }
Tries to look up each Mapping Candidate in the SNOMED CT db to add more data.
@return the number of Candidates that were enriched