public static void check ( BioCDocument document ) { String text = BioCUtils . getText ( document ) ; // check annotation offset and text checkAnnotations ( document . getAnnotations ( ) , text , 0 , BioCLog . log ( document ) ) ; // check relation for ( BioCRelation relation : document . getRelations ( ) ) { for ( BioCNode node : relation . getNodes ( ) ) { checkArgument ( document . getAnnotation ( node . getRefid ( ) ) . isPresent ( ) , "Cannot find node %s in relation %s\n" + "Location: %s" , node , relation , BioCLog . log ( document ) ) ; } } // check passage for ( BioCPassage passage : document . getPassages ( ) ) { text = BioCUtils . getText ( passage ) ; // check annotation offset and text checkAnnotations ( passage . getAnnotations ( ) , text , passage . getOffset ( ) , BioCLog . log ( document , passage ) ) ; // check relation for ( BioCRelation relation : passage . getRelations ( ) ) { for ( BioCNode node : relation . getNodes ( ) ) { checkArgument ( passage . getAnnotation ( node . getRefid ( ) ) . isPresent ( ) , "Cannot find node %s in relation %s\n" + "Location: %s" , node , relation , BioCLog . log ( document , passage ) ) ; } } // check sentence for ( BioCSentence sentence : passage . getSentences ( ) ) { // check annotation offset and text checkAnnotations ( sentence . getAnnotations ( ) , sentence . getText ( ) . get ( ) , sentence . getOffset ( ) , BioCUtils . getXPathString ( document , passage , sentence ) ) ; // check relation for ( BioCRelation relation : sentence . getRelations ( ) ) { for ( BioCNode node : relation . getNodes ( ) ) { checkArgument ( sentence . getAnnotation ( node . getRefid ( ) ) . isPresent ( ) , "Cannot find node %s in relation %s\n" + " Location: %s" , node , relation , BioCUtils . getXPathString ( document , passage , sentence ) ) ; } } } } }
Checks annotations and ie .