use of com.baidu.hugegraph.computer.core.graph.value.Value in project hugegraph-computer by hugegraph.
the class CsvStructGraphOutputTest method testWriteReadVertexOnlyIdAndValue.
@Test
public void testWriteReadVertexOnlyIdAndValue() throws IOException {
UnitTestBase.updateOptions(ComputerOptions.OUTPUT_WITH_ADJACENT_EDGES, "false", ComputerOptions.OUTPUT_WITH_VERTEX_PROPERTIES, "false", ComputerOptions.OUTPUT_WITH_EDGE_PROPERTIES, "false");
ComputerContext context = context();
GraphFactory factory = context.graphFactory();
Id longId = BytesId.of(100L);
Value value = BytesId.of(999L);
Vertex vertex = factory.createVertex(longId, value);
String fileName = "output.csv";
File file = new File(fileName);
try {
BufferedFileOutput dos = new BufferedFileOutput(file);
StructGraphOutput output = (StructGraphOutput) IOFactory.createGraphOutput(context, OutputFormat.CSV, dos);
output.writeVertex(vertex);
dos.close();
@SuppressWarnings("deprecation") String text = FileUtils.readFileToString(file);
Assert.assertEquals("100,999" + System.lineSeparator(), text);
} finally {
FileUtils.deleteQuietly(file);
}
}
use of com.baidu.hugegraph.computer.core.graph.value.Value in project hugegraph-computer by hugegraph.
the class StreamGraphInput method readProperties.
private Properties readProperties(RandomAccessInput in) throws IOException {
Properties properties = this.graphFactory.createProperties();
int size = in.readInt();
for (int i = 0; i < size; i++) {
String key = in.readUTF();
Value value = this.readValue(in);
properties.put(key, value);
}
return properties;
}
use of com.baidu.hugegraph.computer.core.graph.value.Value in project hugegraph-computer by hugegraph.
the class HugeConverter method convertProperties.
public static Properties convertProperties(Map<String, Object> rawProperties) {
Properties properties = GRAPH_FACTORY.createProperties();
for (Map.Entry<String, Object> entry : rawProperties.entrySet()) {
String key = entry.getKey();
Value value = convertValue(entry.getValue());
properties.put(key, value);
}
return properties;
}
use of com.baidu.hugegraph.computer.core.graph.value.Value in project hugegraph-computer by hugegraph.
the class SortManager method createMessageCombiner.
private PointerCombiner createMessageCombiner() {
Config config = this.context.config();
Combiner<Value> valueCombiner = config.createObject(ComputerOptions.WORKER_COMBINER_CLASS, false);
if (valueCombiner == null) {
return null;
}
return new MessageValueCombiner(this.context);
}
Aggregations