@Test public void testValueCoerser() throws UIMAException { EntityGraphOptions options = EntityGraphOptions.builder().withValueCoercer((v) -> 1).build(); EntityGraphFactory factory = createfactory(options); JCas jCas = JCasFactory.createJCas(); JCasTestGraphUtil.populateJcas(jCas); Graph graph = factory.create(jCas); final GraphTraversalSource traversal = graph.traversal(); traversal .V() .forEachRemaining( v -> { Set<Object> values = ElementHelper.propertyValueMap(v).values().stream().collect(Collectors.toSet()); assertAllValuesCoerceTo1(v, values); }); traversal .E() .forEachRemaining( v -> { Set<Object> values = ElementHelper.propertyValueMap(v).values().stream().collect(Collectors.toSet()); assertTrue(values.contains(1) && values.size() == 1 || values.size() == 0); }); }
public Graph create(JCas jCas) throws AnalysisEngineProcessException { Graph graph = createTransformGraph(options.isMultiValueProperties()); load(jCas, graph, graph.features()); return graph; }
EntityGraphFactory { public Graph create(JCas jCas) throws AnalysisEngineProcessException { Graph graph = createTransformGraph(options.isMultiValueProperties()); load(jCas, graph, graph.features()); return graph; } }
EntityGraphFactory { public Graph create(JCas jCas) throws AnalysisEngineProcessException { Graph graph = createTransformGraph(options.isMultiValueProperties()); load(jCas, graph, graph.features()); return graph; } EntityGraphFactory(final UimaMonitor monitor, EntityGraphOptions options); }
EntityGraphFactory { public Graph create(JCas jCas) throws AnalysisEngineProcessException { Graph graph = createTransformGraph(options.isMultiValueProperties()); load(jCas, graph, graph.features()); return graph; } EntityGraphFactory(final UimaMonitor monitor, EntityGraphOptions options); Graph create(JCas jCas); Graph create(JCas jCas, Features features); void load(JCas jCas, Graph graph, Features features); }
EntityGraphFactory { public Graph create(JCas jCas) throws AnalysisEngineProcessException { Graph graph = createTransformGraph(options.isMultiValueProperties()); load(jCas, graph, graph.features()); return graph; } EntityGraphFactory(final UimaMonitor monitor, EntityGraphOptions options); Graph create(JCas jCas); Graph create(JCas jCas, Features features); void load(JCas jCas, Graph graph, Features features); static final String MENTIONS_PROPERTY; static final String MOST_COMMON_VALUE; static final String LONGEST_VALUE; }