in src/main/java/com/amazonaws/services/neptune/propertygraph/io/JsonPropertyGraphPrinter.java [68:113]
public void printProperties(Map<?, ?> properties) throws IOException {
// print known properties
for (PropertySchema propertySchema : labelSchema.propertySchemas()) {
Object key = propertySchema.property();
Object value = properties.get(key);
if (properties.containsKey(key)) {
PropertySchema.PropertyValueMetadata propertyValueMetadata = propertySchema.accept(value, allowUpdateSchema);
labelSchema.recordObservation(propertySchema, value, propertyValueMetadata);
printProperty(value, propertySchema);
} else {
if (allowUpdateSchema) {
propertySchema.makeNullable();
}
}
}
// Print unknown properties
if (allowUpdateSchema) {
for (Map.Entry<?, ?> property : properties.entrySet()) {
Object key = property.getKey();
if (!labelSchema.containsProperty(key)) {
Object value = property.getValue();
PropertySchema propertySchema = new PropertySchema(key);
PropertySchema.PropertyValueMetadata propertyValueMetadata = propertySchema.accept(value, true);
if (isNullable) {
propertySchema.makeNullable();
}
labelSchema.put(key, propertySchema);
labelSchema.recordObservation(propertySchema, value, propertyValueMetadata);
printProperty(value, propertySchema);
}
}
}
isNullable = true;
}