2021-07-26 21:00:05 +02:00
use crate ::addressing ::Address ;
2023-06-25 15:29:52 +02:00
use crate ::entry ::InvariantEntry ;
2023-06-29 15:10:31 +02:00
use crate ::hash ::{ LargeMultihash , UpMultihash } ;
2021-07-26 21:00:05 +02:00
2023-06-22 22:34:58 +02:00
/// Attribute denoting (hierarchical) relation, in the "upwards" direction. For example, a file `IN` a group, an image `IN` photos, etc.
pub const ATTR_IN : & str = " IN " ;
2023-06-18 17:23:48 +02:00
/// Attribute denoting that an entry belongs to the set relating to a given (hierarchical) relation.
/// For example, a data blob may have a label entry, and to qualify that label within the context of belonging to a given hierarchical group, that label entry and the hierarchical entry will be linked with `BY`.
2023-06-22 22:34:58 +02:00
pub const ATTR_BY : & str = " BY " ;
/// Attribute denoting that an attribute belongs to a given "tagging" entity. If an entity belongs to (`IN`) a "tagging" entity, it is expected to have attributes that are `OF` that entity.
pub const ATTR_OF : & str = " OF " ;
2023-06-18 17:23:48 +02:00
/// Attribute denoting a human readable label.
2023-06-24 16:13:29 +02:00
pub const ATTR_LABEL : & str = " LBL " ;
2023-06-18 17:23:48 +02:00
/// Attribute denoting the date & time an entity was noted in the database.
/// (TODO: This info can be trivially derived from existing entry timestamps, while at the same time the "Introduction problem" is still open.)
2023-06-24 16:13:29 +02:00
pub const ATTR_ADDED : & str = " ADDED " ;
2023-06-18 17:23:48 +02:00
/// Attribute for cross-vault unambiguous referencing of non-hashable (e.g. UUID) entities.
2023-06-24 16:13:29 +02:00
pub const ATTR_KEY : & str = " KEY " ;
2023-06-18 17:23:48 +02:00
2021-07-26 21:00:05 +02:00
lazy_static! {
2023-06-09 13:33:36 +02:00
pub static ref HIER_ROOT_INVARIANT : InvariantEntry = InvariantEntry {
2023-06-24 16:13:29 +02:00
attribute : String ::from ( ATTR_KEY ) ,
2023-06-09 13:33:36 +02:00
value : " HIER_ROOT " . into ( ) ,
2021-08-18 11:06:36 +02:00
} ;
2023-06-09 13:33:36 +02:00
pub static ref HIER_ROOT_ADDR : Address = HIER_ROOT_INVARIANT . entity ( ) . unwrap ( ) ;
2023-06-29 14:29:38 +02:00
pub static ref TYPE_HASH_ADDRESS : Address =
2023-06-29 15:10:31 +02:00
Address ::Hash ( UpMultihash ::from ( LargeMultihash ::default ( ) ) ) ;
2023-06-18 19:49:26 +02:00
pub static ref TYPE_UUID_ADDRESS : Address = Address ::Uuid ( uuid ::Uuid ::nil ( ) ) ;
pub static ref TYPE_ATTRIBUTE_ADDRESS : Address = Address ::Attribute ( " " . to_string ( ) ) ;
pub static ref TYPE_URL_ADDRESS : Address = Address ::Url ( url ::Url ::parse ( " up: " ) . unwrap ( ) ) ;
2021-07-26 21:00:05 +02:00
}