use hawdb::{Database, Value};
use std::collections::BTreeMap;
fn main() -> hawdb::Result<()> {
let mut db = Database::open("./knowledge")?;
let mut note = BTreeMap::new();
note.insert("title".into(), Value::String("Graph foundations".into()));
let mut tx = db.begin_transaction()?;
tx.query_with_params(
"CREATE (:Note {title: $title})-[:MENTIONS]->(:Entity {name: 'context layer'})",
¬e,
)?;
tx.commit()?;
let found = db.query(
"MATCH (note:Note)-[:MENTIONS]->(entity:Entity)
RETURN note.title AS title, entity.name AS name
ORDER BY title",
)?;
println!("{:?}", found.rows.get(0, "title"));
Ok(())
}