TacKbp2017KBLoader implements KnowledgeBaseLoader { @Override public KnowledgeBase load(CharSource source) throws IOException { return new TacKbp2017KBLoading(source).load(); }  static TacKbp2017KBLoader create(); @Override KnowledgeBase load(CharSource source);  }
@Test public void testLoad() throws IOException { final KnowledgeBaseLoader loader = TacKbp2017KBLoader.create(); final String inputString = "dummy_runID\n" + "\n# This is a dummy comment. \n \n" + ":Event_0\ttype\tCONFLICT.ATTACK\t0.900 \n" + ":Event_0\tmention.actual\t\"dummy\\\"mention\\\"\"\tdocID:5-12"; final File inputFile = File.createTempFile("kb-loader-test", ".tmp"); Files.write(inputString, inputFile, Charsets.UTF_8); final KnowledgeBase actualKB = loader.load(Files.asCharSource(inputFile, Charsets.UTF_8)); inputFile.deleteOnExit(); final EventNode node = (EventNode) actualKB.nodes().asList().get(0); final Assertion assertion1 = TypeAssertion.of(node, Symbol.from("CONFLICT.ATTACK")); final Assertion assertion2 = EventMentionAssertion.of( node, "dummy\"mention\"", Symbol.from("actual"), JustificationSpan.of(Symbol.from("docID"), OffsetRange.charOffsetRange(5, 12))); final KnowledgeBase expectedKB = KnowledgeBase.builder() .runId(Symbol.from("dummy_runID")) .addNodes(node) .nameNode(node, ":Event_0") .addAssertions(assertion1, assertion2) .putConfidence(assertion1, 0.9) .build(); assertEquals(expectedKB, actualKB); }