@Test public void testDocumentGraphWithoutReferents() throws UIMAException { DocumentGraphOptions options = DocumentGraphOptions.builder().withReferenceTargets(false).build(); DocumentGraphFactory factory = createfactory(options); JCas jCas = JCasFactory.createJCas(); JCasTestGraphUtil.populateJcas(jCas); Graph graph = factory.create(jCas); assertEquals(0, 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(2, graph.traversal().V().hasLabel(RELATION).count().next().intValue()); assertEquals(0, graph.traversal().E().hasLabel(MENTION_OF).count().next().intValue()); assertEquals(2, graph.traversal().E().hasLabel(PARTICIPANT_IN).count().next().intValue()); assertNoDocumentNode(graph); assertEquals(7, IteratorUtils.count(graph.vertices())); assertEquals(6, IteratorUtils.count(graph.edges())); }
@Override public void doInitialize(UimaContext aContext) throws ResourceInitializationException { super.doInitialize(aContext); Set<Class<? extends Entity>> typeClasses = TypeUtils.getTypeClasses(Entity.class, typeNames); DocumentGraphOptions.Builder builder = DocumentGraphOptions.builder() .withContentHashAsId(contentHashAsId) .withContent(outputContent) .withMeta(outputMeta) .withReferenceTargets(outputReferents) .withRelations(outputRelations) .withRelationsAsLinks(outputRelationsAsLinks) .withEvents(outputEvents) .withDocument(outputDocument) .withStopFeatures(filterFeatures) .withValueCoercer(valueCoercer) .withTypeClasses(typeClasses); addOptions(builder); factory = new DocumentGraphFactory(getMonitor(), builder.build()); }
@Override public void doInitialize(UimaContext aContext) throws ResourceInitializationException { super.doInitialize(aContext); Set<Class<? extends Entity>> typeClasses = TypeUtils.getTypeClasses(Entity.class, typeNames); DocumentGraphOptions.Builder builder = DocumentGraphOptions.builder() .withContentHashAsId(contentHashAsId) .withContent(outputContent) .withMeta(outputMeta) .withReferenceTargets(outputReferents) .withRelations(outputRelations) .withRelationsAsLinks(outputRelationsAsLinks) .withEvents(outputEvents) .withDocument(outputDocument) .withStopFeatures(filterFeatures) .withValueCoercer(valueCoercer) .withTypeClasses(typeClasses); addOptions(builder); factory = new DocumentGraphFactory(getMonitor(), builder.build()); }