wip: of
is in
, of
denotes type attributes
This commit is contained in:
parent
0f2294b67c
commit
e72f6b5243
3 changed files with 15 additions and 13 deletions
|
@ -1,11 +1,13 @@
|
||||||
use crate::addressing::Address;
|
use crate::addressing::Address;
|
||||||
use crate::database::entry::InvariantEntry;
|
use crate::database::entry::InvariantEntry;
|
||||||
|
|
||||||
/// Attribute denoting (hierarchical) relation, in the upwards direction. For example, a file `OF` a group, an image `OF` photos, etc.
|
/// Attribute denoting (hierarchical) relation, in the "upwards" direction. For example, a file `IN` a group, an image `IN` photos, etc.
|
||||||
pub const IS_OF_ATTR: &str = "OF";
|
pub const ATTR_IN: &str = "IN";
|
||||||
/// Attribute denoting that an entry belongs to the set relating to a given (hierarchical) relation.
|
/// 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`.
|
/// 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`.
|
||||||
pub const ATTR_BY_ATTR: &str = "BY";
|
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";
|
||||||
|
|
||||||
/// Attribute denoting a human readable label.
|
/// Attribute denoting a human readable label.
|
||||||
pub const LABEL_ATTR: &str = "LBL";
|
pub const LABEL_ATTR: &str = "LBL";
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::database::constants::LABEL_ATTR;
|
||||||
use crate::database::entry::Entry;
|
use crate::database::entry::Entry;
|
||||||
use crate::database::lang::{PatternQuery, Query, QueryComponent, QueryPart};
|
use crate::database::lang::{PatternQuery, Query, QueryComponent, QueryPart};
|
||||||
|
|
||||||
use super::constants::{HIER_ROOT_ADDR, HIER_ROOT_INVARIANT, IS_OF_ATTR};
|
use super::constants::{ATTR_IN, HIER_ROOT_ADDR, HIER_ROOT_INVARIANT};
|
||||||
use super::UpEndConnection;
|
use super::UpEndConnection;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||||
|
@ -80,7 +80,7 @@ pub fn list_roots(connection: &UpEndConnection) -> Result<Vec<Address>> {
|
||||||
Ok(connection
|
Ok(connection
|
||||||
.query(Query::SingleQuery(QueryPart::Matches(PatternQuery {
|
.query(Query::SingleQuery(QueryPart::Matches(PatternQuery {
|
||||||
entity: QueryComponent::Variable(None),
|
entity: QueryComponent::Variable(None),
|
||||||
attribute: QueryComponent::Exact(IS_OF_ATTR.into()),
|
attribute: QueryComponent::Exact(ATTR_IN.into()),
|
||||||
value: QueryComponent::Exact((*HIER_ROOT_ADDR).clone().into()),
|
value: QueryComponent::Exact((*HIER_ROOT_ADDR).clone().into()),
|
||||||
})))?
|
})))?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -121,7 +121,7 @@ pub fn fetch_or_create_dir(
|
||||||
Some(parent) => connection
|
Some(parent) => connection
|
||||||
.query(Query::SingleQuery(QueryPart::Matches(PatternQuery {
|
.query(Query::SingleQuery(QueryPart::Matches(PatternQuery {
|
||||||
entity: QueryComponent::Variable(None),
|
entity: QueryComponent::Variable(None),
|
||||||
attribute: QueryComponent::Exact(IS_OF_ATTR.into()),
|
attribute: QueryComponent::Exact(ATTR_IN.into()),
|
||||||
value: QueryComponent::Exact(parent.into()),
|
value: QueryComponent::Exact(parent.into()),
|
||||||
})))?
|
})))?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -151,7 +151,7 @@ pub fn fetch_or_create_dir(
|
||||||
connection.insert_entry(if let Some(parent) = parent {
|
connection.insert_entry(if let Some(parent) = parent {
|
||||||
Entry {
|
Entry {
|
||||||
entity: new_directory_address.clone(),
|
entity: new_directory_address.clone(),
|
||||||
attribute: String::from(IS_OF_ATTR),
|
attribute: String::from(ATTR_IN),
|
||||||
value: parent.into(),
|
value: parent.into(),
|
||||||
provenance: "SYSTEM FS".to_string(),
|
provenance: "SYSTEM FS".to_string(),
|
||||||
timestamp: chrono::Utc::now().naive_utc(),
|
timestamp: chrono::Utc::now().naive_utc(),
|
||||||
|
@ -159,7 +159,7 @@ pub fn fetch_or_create_dir(
|
||||||
} else {
|
} else {
|
||||||
Entry {
|
Entry {
|
||||||
entity: new_directory_address.clone(),
|
entity: new_directory_address.clone(),
|
||||||
attribute: String::from(IS_OF_ATTR),
|
attribute: String::from(ATTR_IN),
|
||||||
value: HIER_ROOT_ADDR.clone().into(),
|
value: HIER_ROOT_ADDR.clone().into(),
|
||||||
provenance: "SYSTEM FS".to_string(),
|
provenance: "SYSTEM FS".to_string(),
|
||||||
timestamp: chrono::Utc::now().naive_utc(),
|
timestamp: chrono::Utc::now().naive_utc(),
|
||||||
|
|
|
@ -3,7 +3,7 @@ use self::db::files;
|
||||||
use super::{Blob, StoreError, UpStore, UpdatePathOutcome};
|
use super::{Blob, StoreError, UpStore, UpdatePathOutcome};
|
||||||
use crate::addressing::Address;
|
use crate::addressing::Address;
|
||||||
use crate::database::constants::{
|
use crate::database::constants::{
|
||||||
ADDED_ATTR, ATTR_BY_ATTR, IS_OF_ATTR, LABEL_ATTR, TYPE_HASH_ADDRESS,
|
ADDED_ATTR, ATTR_BY, ATTR_IN, ATTR_OF, LABEL_ATTR, TYPE_HASH_ADDRESS,
|
||||||
};
|
};
|
||||||
use crate::database::entry::Entry;
|
use crate::database::entry::Entry;
|
||||||
use crate::database::hierarchies::{
|
use crate::database::hierarchies::{
|
||||||
|
@ -110,13 +110,13 @@ impl FsStore {
|
||||||
upend_insert_addr!(
|
upend_insert_addr!(
|
||||||
upconnection,
|
upconnection,
|
||||||
Address::Attribute(FILE_SIZE_KEY.to_string()),
|
Address::Attribute(FILE_SIZE_KEY.to_string()),
|
||||||
IS_OF_ATTR,
|
ATTR_OF,
|
||||||
TYPE_HASH_ADDRESS
|
TYPE_HASH_ADDRESS
|
||||||
)?;
|
)?;
|
||||||
upend_insert_addr!(
|
upend_insert_addr!(
|
||||||
upconnection,
|
upconnection,
|
||||||
Address::Attribute(FILE_MIME_KEY.to_string()),
|
Address::Attribute(FILE_MIME_KEY.to_string()),
|
||||||
IS_OF_ATTR,
|
ATTR_OF,
|
||||||
TYPE_HASH_ADDRESS
|
TYPE_HASH_ADDRESS
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ impl FsStore {
|
||||||
|
|
||||||
let dir_has_entry = Entry {
|
let dir_has_entry = Entry {
|
||||||
entity: blob_address.clone(),
|
entity: blob_address.clone(),
|
||||||
attribute: IS_OF_ATTR.to_string(),
|
attribute: ATTR_IN.to_string(),
|
||||||
value: parent_dir.clone().into(),
|
value: parent_dir.clone().into(),
|
||||||
provenance: "SYSTEM INIT".to_string(),
|
provenance: "SYSTEM INIT".to_string(),
|
||||||
timestamp: chrono::Utc::now().naive_utc(),
|
timestamp: chrono::Utc::now().naive_utc(),
|
||||||
|
@ -485,7 +485,7 @@ impl FsStore {
|
||||||
|
|
||||||
let alias_entry = Entry {
|
let alias_entry = Entry {
|
||||||
entity: dir_has_entry_addr,
|
entity: dir_has_entry_addr,
|
||||||
attribute: ATTR_BY_ATTR.to_string(),
|
attribute: ATTR_BY.to_string(),
|
||||||
value: label_entry_addr.into(),
|
value: label_entry_addr.into(),
|
||||||
provenance: "SYSTEM INIT".to_string(),
|
provenance: "SYSTEM INIT".to_string(),
|
||||||
timestamp: chrono::Utc::now().naive_utc(),
|
timestamp: chrono::Utc::now().naive_utc(),
|
||||||
|
|
Loading…
Reference in a new issue