use atomic_lib::errors::AtomicResult;
fn main() -> AtomicResult<()> {
use atomic_lib::Storelike;
let store = atomic_lib::Store::init()?;
store.populate()?;
let mut new_property =
atomic_lib::Resource::new_instance("https://atomicdata.dev/classes/Property", &store)?;
new_property.set_shortname("description", "the age of a person", &store)?;
let subject = new_property.get_subject().clone();
let agent = store.create_agent(Some("my_agent"))?;
store.set_default_agent(agent);
let _fails = new_property.save_locally(&store);
new_property
.set_shortname("shortname", "age", &store)?
.set_shortname("datatype", atomic_lib::urls::INTEGER, &store)?
.save_locally(&store)?;
let fetched_new_resource = store.get_resource(&subject)?;
assert!(
fetched_new_resource
.get_shortname("description", &store)?
.to_string()
== "the age of a person"
);
Ok(())
}