Struct atomic_lib::resources::Resource[][src]

pub struct Resource { /* fields omitted */ }
Expand description

A Resource is a set of Atoms that shares a single Subject. A Resource only contains valid Values, but it might lack required properties. All changes to the Resource are applied after committing them (e.g. by using).

Implementations

Fetches all ‘required’ properties. Fails is any are missing in this Resource.

Removes / deletes the resource from the store by performing a Commit.

Get a value by property URL

Checks if the classes are there, if not, fetches them. Returns an empty vector if there are no classes found.

Returns the first item of the is_ array

Returns all PropVals. Useful if you want to iterate over all Atoms / Properties.

Gets a value by its property shortname or property URL.

Create a new, empty Resource.

Create a new instance of some Class. The subject is generated, but can be changed. Does not save the resource to the store.

Remove a propval from a resource by property URL.

Remove a propval from a resource by property URL or shortname. Returns error if propval does not exist in this resource or its class.

Tries to resolve the shortname of a Property to a Property. Currently only tries the shortnames for linked classes - not for other properties.

Saves the resource (with all the changes) to the store by creating a Commit. Uses default Agent to sign the Commit. Stores changes on the Subject’s Server by sending a Commit. Returns the generated Commit.

Saves the resource (with all the changes) to the store by creating a Commit. Uses default Agent to sign the Commit. Returns the generated Commit. Does not validate rights / hierarchy. Does not store these changes on the server of the Subject - the Commit will be lost, unless you handle it manually.

Insert a Property/Value combination. Overwrites existing Property/Value. Validates the datatype.

Inserts a Property/Value combination. Overwrites existing. Adds it to the commit builder.

Does not validate property / datatype combination. Inserts a Property/Value combination. Overwrites existing. Adds it to the CommitBuilder.

Sets a property / value combination. Property can be a shortname (e.g. ‘description’ instead of the full URL). Returns error if propval does not exist in this resource or its class.

Changes the subject of the Resource. Does not ‘move’ the Resource See https://github.com/joepio/atomic/issues/44

Converts Resource to JSON-AD string.

Converts Resource to plain JSON string.

Converts Resource to JSON-LD string, with @context object and RDF compatibility.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Performs the conversion.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.