import org.janusgraph.core.JanusGraphVertex; //导入依赖的package包/类
private void acceptRecord(Map record) throws Exception {
String vertexLabel = defaultVertexLabel;
if (vertexLabelFieldName != null) {
vertexLabel = record.get(vertexLabelFieldName);
}
JanusGraphVertex v = graphTransaction.addVertex(vertexLabel);
// set the properties of the vertex
for (String column : record.keySet()) {
String value = record.get(column);
// If value="" or it is a vertex label then skip it
if (value == null || value.length() == 0 || column.equals(vertexLabelFieldName))
continue;
String propName = (String) getPropertiesMap().get(column);
if (propName == null) {
// log.info("Thread " + myID + ".Cannot find property name for
// column " + column
// + " in the properties map. Using the column name as
// default.");
continue;
// propName = column;
}
// Update property only if it does not exist already
if (!v.properties(propName).hasNext()) {
// TODO Convert properties between data types. e.g. Date
Object convertedValue = BatchHelper.convertPropertyValue(value,
graphTransaction.getPropertyKey(propName).dataType());
v.property(propName, convertedValue);
}
}
if (currentRecord % COMMIT_COUNT == 0) {
graphTransaction.commit();
graphTransaction.close();
graphTransaction = getGraph().newTransaction();
}
currentRecord++;
}