1use steeldb::SteelDb;
5
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let docs = [
8 "Morty Shade defeated Wallace Gale at Ecruteak City during the Indigo Invitational in 2025.",
9 "Bea Strike defeated Iris Draco at Ecruteak City during the Indigo Invitational in 2025.",
10 "Juan Tide defeated Cynthia Ward at Ecruteak City during the Indigo Invitational in 2026.",
11 "A habitat survey recorded Aggron near Sootopolis City at an elevation of 1082 m.",
12 "A habitat survey recorded Salamence near Sootopolis City at an elevation of 2369 m.",
13 "A habitat survey recorded Milotic near Sootopolis City at an elevation of 340 m.",
14 "Milotic is not permitted in Series 1 play for the 2025 season.",
15 "Metagross is permitted in Series 4 play for the 2026 season.",
16 ];
17
18 let db = SteelDb::ingest(docs)?;
19 println!("indexed {} situations", db.len());
20
21 println!("\nyou can ask about:");
22 for c in db.categories() {
23 println!(" {:<14} {}", c.wildcard(), c.words.iter().take(4).cloned().collect::<Vec<_>>().join(", "));
24 }
25
26 let q = "(and elevation/* (not state/negated))";
28 match db.query(q) {
29 Ok(a) => {
30 println!("\n{q} -> {} situations", a.len());
31 for (id, text) in db.resolve(&a).take(2) {
32 println!(" [{id}] {}", text.chars().take(56).collect::<String>());
34 }
35 }
36 Err(r) => println!("\n{r}"),
37 }
38
39 match db.query("survey/*") {
41 Ok(_) => println!("\nunexpected: survey is not a category here"),
42 Err(r) => println!("\n{r}"),
43 }
44
45 match db.query("gene/brca1") {
46 Ok(_) => println!("\nunexpected: that should not exist"),
47 Err(r) => println!("\n{r}"),
48 }
49
50 println!("\nbelief in a denied claim: {}", db.belief("state/negated"));
51 Ok(())
52}