Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

test(induce): cover the unoccupied row identifier field

Rudy Celeklieb01f802c3a5
diff --git a/src/induce.rs b/src/induce.rs
index 779e5608..b4e7824a 100644
--- a/src/induce.rs
+++ b/src/induce.rs
@@ -356,7 +356,7 @@ pub fn induce(rows: &[HashMap<String, String>], headers: &[String], stem: &str,
field.push('_');
}
(field, true)
- },
+ }
},
};
let id_values: BTreeSet<String> = if id_synthesised {
diff --git a/tests/induce_synthetic_identifier_test.rs b/tests/induce_synthetic_identifier_test.rs
index 9e1f8319..5c757ad8 100644
--- a/tests/induce_synthetic_identifier_test.rs
+++ b/tests/induce_synthetic_identifier_test.rs
@@ -173,6 +173,13 @@ fn synthetic_field_skips_all_existing_names_and_explicit_identifiers_stay_unchan
let export = induced.instance_ntriples(&rows);
assert!(export.contains("<https://example.org/orders/ont#__row> \"import-A\""));
assert!(export.contains("<https://example.org/orders/ont#__row_> \"import-B\""));
+ let plain = DataIngester::parse_csv("kind,quantity\nretail,3\nretail,5\n").unwrap();
+ let synthesized = induce(&plain, &["kind".into(), "quantity".into()], "Orders", BASE);
+ assert_eq!(synthesized.id_column, "__row");
+ let export = synthesized.instance_ntriples(&plain);
+ assert!(export.contains("<https://example.org/orders/1>"));
+ assert!(export.contains("<https://example.org/orders/2>"));
+ assert!(!export.contains("_auto_"));
let rows =
DataIngester::parse_csv("id,kind,quantity\norder-1,retail,3\norder-2,retail,5\n").unwrap();
let induced = induce(