@Test public void testDocumentGraphWithoutRelations() throws UIMAException { DocumentGraphOptions options = DocumentGraphOptions.builder().withRelations(false).build(); DocumentGraphFactory factory = createfactory(options); JCas jCas = JCasFactory.createJCas(); JCasTestGraphUtil.populateJcas(jCas); Graph graph = factory.create(jCas); assertEquals(3, graph.traversal().V().hasLabel(REFERENCE_TARGET).count().next().intValue()); assertEquals(1, graph.traversal().V().hasLabel(EVENT).count().next().intValue()); assertEquals(4, graph.traversal().V().hasLabel(MENTION).count().next().intValue()); assertEquals(4, graph.traversal().E().hasLabel(MENTION_OF).count().next().intValue()); assertEquals(0, graph.traversal().E().hasLabel(RELATION).count().next().intValue()); assertEquals(2, graph.traversal().E().hasLabel(PARTICIPANT_IN).count().next().intValue()); assertNoDocumentNode(graph); assertRelationsNotRerified(graph); assertEquals(8, IteratorUtils.count(graph.vertices())); assertEquals(6, IteratorUtils.count(graph.edges())); }
@Test public void testDocumentGraphWithRelationsAsLinks() throws UIMAException { DocumentGraphOptions options = DocumentGraphOptions.builder().withRelationsAsLinks(true).build(); DocumentGraphFactory factory = createfactory(options); JCas jCas = JCasFactory.createJCas(); JCasTestGraphUtil.populateJcas(jCas); Graph graph = factory.create(jCas); assertEquals(3, graph.traversal().V().hasLabel(REFERENCE_TARGET).count().next().intValue()); assertEquals(1, graph.traversal().V().hasLabel(EVENT).count().next().intValue()); assertEquals(4, graph.traversal().V().hasLabel(MENTION).count().next().intValue()); assertEquals(4, graph.traversal().E().hasLabel(MENTION_OF).count().next().intValue()); assertEquals(2, graph.traversal().E().hasLabel(RELATION).count().next().intValue()); assertEquals(2, graph.traversal().E().hasLabel(PARTICIPANT_IN).count().next().intValue()); assertNoDocumentNode(graph); assertRelationsNotRerified(graph); assertEquals(8, IteratorUtils.count(graph.vertices())); assertEquals(8, IteratorUtils.count(graph.edges())); } }