Usage with the SDK
Correct SDK Option<String> query arguments and local graph behavior.
Open a named graph with open_gnosis(name).await. The SDK delegates gnosis_add, gnosis_query and gnosis_neighbors to the same core Gnosis model; it does not rebuild historical indexes or supply schema/identity validation.
gnosis_query takes owned Option<String> arguments, unlike the borrowed string arguments accepted by gnosis_add and gnosis_neighbors.
use weave_sdk::WeaveNode;
async fn add_and_query(node: &WeaveNode) -> weave_sdk::error::Result<()> {
node.open_gnosis("kb").await?;
node.gnosis_add("kb", "alice", "trusts", "bob").await?;
let facts = node.gnosis_query(
"kb", Some("alice".to_string()), Some("trusts".to_string()), None,
).await?;
for fact in facts {
println!("{} {} {}", fact.subject, fact.predicate, fact.object);
}
Ok(())
}This source-checked function works against writes made through the current instance. After a new open, an all-wildcard gnosis_query(name, None, None, None) scans persisted triples; indexed queries require the absent replay integration. A stored has_role or trusts string is application data, not verified authority to grant access.