@Override public void reduce(final LongWritable key, final Iterable<FaunusVertex> value, final Reducer<LongWritable, FaunusVertex, NullWritable, FaunusVertex>.Context context) throws IOException, InterruptedException { if (key.get() == funnyLong) { final DefaultTypeMaker typeMaker = BlueprintsDefaultTypeMaker.INSTANCE; for (final FaunusVertex vertex : value) { for (final String property : vertex.getPropertyKeys()) { final String property2 = property.substring(1); if (property.startsWith("t")) { if (null == graph.getType(property2)) { // TODO: Automated type inference // typeMaker.makeKey(property2, graph.makeType().dataType(Class.forName(vertex.getProperty(property).toString()))); typeMaker.makeKey(graph.makeKey(property2)); context.getCounter(Counters.PROPERTY_KEYS_CREATED).increment(1l); } } else { if (null == graph.getType(property2)) { //typeMaker.makeLabel(property2, graph.makeType()); typeMaker.makeLabel(graph.makeLabel(property2)); context.getCounter(Counters.EDGE_LABELS_CREATED).increment(1l); } } } } } else { for (final FaunusVertex vertex : value) { context.write(NullWritable.get(), vertex); } } }
@Override public void testGraphQueryForEdges() { TitanGraph g = (TitanGraph) graphTest.generateGraph(); if (g.getType("weight") == null) { TitanKey weight = g.makeKey("weight").dataType(Double.class).single().make(); } g.shutdown(); super.testGraphQueryForEdges(); } }
@Override public void testGraphQueryForVertices() { TitanGraph g = (TitanGraph) graphTest.generateGraph(); if (g.getType("age") == null) { TitanKey age = g.makeKey("age").dataType(Integer.class).single().make(); } g.shutdown(); super.testGraphQueryForVertices(); }