in src/main/java/com/amazonaws/services/neptune/profiles/neptune_ml/v2/PropertyGraphTrainingDataConfigWriterV2.java [367:402]
private void writeFeatureOverride(LabelSchema labelSchema, FeatureOverrideConfigV2 featureOverride, ElementConfig elementConfig) throws IOException {
FeatureTypeV2 featureType = featureOverride.featureType();
Label label = labelSchema.label();
Collection<PropertySchema> propertySchemas = labelSchema.propertySchemas().stream()
.filter(p -> featureOverride.properties().contains(p.nameWithoutDataType()) &&
!elementConfig.hasClassificationSpecificationForProperty(label, p.nameWithoutDataType()))
.collect(Collectors.toList());
Collection<String> propertyNames = propertySchemas.stream()
.map(PropertySchema::nameWithoutDataType)
.collect(Collectors.toList());
Collection<String> missingProperties = featureOverride.properties().stream()
.filter(p -> !propertyNames.contains(p))
.collect(Collectors.toList());
for (String missingProperty : missingProperties) {
ParsingContext context = new ParsingContext(featureType.name() + " feature override").withLabel(label).withProperty(missingProperty);
warnings.add(String.format("Unable to add %s. Property is missing, or is being used to label the node.", context));
}
if (FeatureTypeV2.category == featureType) {
writeCategoricalFeature(propertySchemas, featureOverride);
} else if (FeatureTypeV2.numerical == featureType) {
writeNumericalFeature(propertySchemas, featureOverride);
} else if (FeatureTypeV2.auto == featureType) {
writeAutoFeature(propertySchemas, featureOverride);
} else if (FeatureTypeV2.none == featureType) {
// Do nothing
} else {
warnings.add(String.format("Unsupported feature type override for node: %s.", featureType.name()));
}
}