use of com.alibaba.maxgraph.compiler.api.exception.PropertyDefNotFoundException in project GraphScope by alibaba.
the class DataBuildMapper method buildPropertiesMap.
private Map<Integer, PropertyValue> buildPropertiesMap(GraphElement typeDef, String[] items, Map<Integer, Integer> columnMapping) {
Map<Integer, PropertyValue> operationProperties = new HashMap<>(columnMapping.size());
columnMapping.forEach((colIdx, propertyId) -> {
GraphProperty propertyDef = typeDef.getProperty(propertyId);
if (propertyDef == null) {
throw new PropertyDefNotFoundException("property [" + propertyId + "] not found in [" + typeDef.getLabel() + "]");
}
if (colIdx >= items.length) {
throw new IllegalArgumentException("label [" + typeDef.getLabel() + "], invalid mapping [" + colIdx + "] -> [" + propertyId + "], data [" + items + "]");
}
DataType dataType = propertyDef.getDataType();
String val = items[colIdx];
if (ldbcCustomize) {
String name = propertyDef.getName();
switch(name) {
case "creationDate":
case "joinDate":
val = converteDate(val);
break;
case "birthday":
val = val.replace("-", "");
break;
}
}
PropertyValue propertyValue = new PropertyValue(dataType, val);
operationProperties.put(propertyId, propertyValue);
});
return operationProperties;
}
use of com.alibaba.maxgraph.compiler.api.exception.PropertyDefNotFoundException in project GraphScope by alibaba.
the class GraphWriter method parseRawProperties.
public static Map<Integer, PropertyValue> parseRawProperties(GraphElement graphElement, Map<String, Object> properties) {
Map<Integer, PropertyValue> res = new HashMap<>();
if (properties != null) {
properties.forEach((propertyName, valString) -> {
GraphProperty propertyDef = graphElement.getProperty(propertyName);
if (propertyDef == null) {
throw new PropertyDefNotFoundException("property [" + propertyName + "] not found in [" + graphElement.getLabel() + "]");
}
int id = propertyDef.getId();
DataType dataType = propertyDef.getDataType();
PropertyValue propertyValue = new PropertyValue(dataType, valString);
res.put(id, propertyValue);
});
}
return res;
}
Aggregations