Skip to main content

Graph

Struct Graph 

Source
pub struct Graph { /* private fields */ }

Implementations§

Source§

impl Graph

Source

pub fn to_ast(&self) -> Ast

Source§

impl Graph

Source

pub fn new() -> Self

Source

pub fn is_empty(&self) -> bool

Source

pub fn add_declared_dimension(&mut self, name: String, namespace: String)

Source

pub fn add_declared_unit( &mut self, name: String, namespace: String, dimension: String, base_factor: String, base_unit: String, )

Source

pub fn all_declared_dimensions(&self) -> Vec<&DeclaredDimension>

Source

pub fn all_declared_units(&self) -> Vec<&DeclaredUnit>

Source

pub fn set_evaluation_mode(&mut self, use_three_valued_logic: bool)

Set the evaluation mode for policy evaluation. When use_three_valued_logic is true, policies will use three-valued logic (True, False, NULL). When false, policies will use strict boolean logic (True, False).

Source

pub fn use_three_valued_logic(&self) -> bool

Get the current evaluation mode.

Source

pub fn config(&self) -> &GraphConfig

Source

pub fn version(&self) -> Option<&str>

The model’s declared @version, if the source header declares one.

Source

pub fn config_mut(&mut self) -> &mut GraphConfig

Source

pub fn entity_count(&self) -> usize

Source

pub fn is_operation_bound_policy(&self, id: &ConceptId) -> bool

Whether id is bound to an operation’s access policy_governed by clause (and so is skipped by validate()).

Source

pub fn add_entity(&mut self, entity: Entity) -> Result<(), String>

Source

pub fn has_entity(&self, id: &ConceptId) -> bool

Source

pub fn get_entity(&self, id: &ConceptId) -> Option<&Entity>

Source

pub fn get_entity_mut(&mut self, id: &ConceptId) -> Option<&mut Entity>

Returns a mutable reference to an Entity identified by id. This method is necessary for operations that need to update attributes on existing entities (such as association relationships).

Source

pub fn remove_entity(&mut self, id: &ConceptId) -> Result<Entity, String>

Source

pub fn role_count(&self) -> usize

Source

pub fn add_role(&mut self, role: Role) -> Result<(), String>

Source

pub fn get_role(&self, id: &ConceptId) -> Option<&Role>

Source

pub fn has_role(&self, id: &ConceptId) -> bool

Source

pub fn assign_role_to_entity( &mut self, entity_id: ConceptId, role_id: ConceptId, ) -> Result<(), String>

Source

pub fn roles_for_entity(&self, entity_id: &ConceptId) -> Option<&Vec<ConceptId>>

Source

pub fn role_names_for_entity(&self, entity_id: &ConceptId) -> Vec<String>

Source

pub fn resource_count(&self) -> usize

Source

pub fn add_resource(&mut self, resource: Resource) -> Result<(), String>

Source

pub fn has_resource(&self, id: &ConceptId) -> bool

Source

pub fn get_resource(&self, id: &ConceptId) -> Option<&Resource>

Source

pub fn remove_resource(&mut self, id: &ConceptId) -> Result<Resource, String>

Source

pub fn flow_count(&self) -> usize

Source

pub fn pattern_count(&self) -> usize

Source

pub fn relation_count(&self) -> usize

Source

pub fn add_relation_type( &mut self, relation: RelationType, ) -> Result<(), String>

Source

pub fn all_relations(&self) -> Vec<&RelationType>

Source

pub fn add_flow(&mut self, flow: Flow) -> Result<(), String>

Source

pub fn add_pattern(&mut self, pattern: Pattern) -> Result<(), String>

Source

pub fn add_concept_change( &mut self, change: ConceptChange, ) -> Result<(), String>

Source

pub fn get_concept_change(&self, id: &ConceptId) -> Option<&ConceptChange>

Source

pub fn all_concept_changes(&self) -> Vec<&ConceptChange>

Source

pub fn has_flow(&self, id: &ConceptId) -> bool

Source

pub fn get_flow(&self, id: &ConceptId) -> Option<&Flow>

Source

pub fn remove_flow(&mut self, id: &ConceptId) -> Result<Flow, String>

Source

pub fn instance_count(&self) -> usize

Source

pub fn add_instance(&mut self, instance: ResourceInstance) -> Result<(), String>

Source

pub fn add_association( &mut self, owner: &ConceptId, owned: &ConceptId, rel_type: &str, ) -> Result<(), String>

Adds an association relationship from owner -> owned using a named rel_type. Associations are represented as a JSON attribute associations on the source entity to maintain a simple, serializable representation without introducing a new primitive.

Source

pub fn has_instance(&self, id: &ConceptId) -> bool

Source

pub fn get_instance(&self, id: &ConceptId) -> Option<&ResourceInstance>

Source

pub fn remove_instance( &mut self, id: &ConceptId, ) -> Result<ResourceInstance, String>

Source

pub fn entity_instance_count(&self) -> usize

Source

pub fn add_entity_instance(&mut self, instance: Instance) -> Result<(), String>

Source

pub fn add_entity_instances( &mut self, instances: Vec<Instance>, ) -> Result<(), String>

Insert several entity instances and validate the graph once, after all of them are present, so references between the new instances do not depend on their order. If any insert or the final validation fails, every instance inserted by this call is removed and the graph is unchanged. Duplicate ids and names are rejected as in Graph::add_entity_instance, including duplicates inside the batch.

Source

pub fn entity_contract(&self, entity_id: &ConceptId) -> Option<&EntityContract>

Source

pub fn validate_entity_instances(&self) -> Result<(), Vec<String>>

Source

pub fn get_entity_instance(&self, name: &str) -> Option<&Instance>

Source

pub fn get_entity_instance_mut(&mut self, name: &str) -> Option<&mut Instance>

Source

pub fn all_entity_instances(&self) -> Vec<&Instance>

Source

pub fn remove_entity_instance(&mut self, name: &str) -> Result<Instance, String>

Source

pub fn has_entity_instance_by_id(&self, id: &ConceptId) -> bool

Source

pub fn get_entity_instance_by_id(&self, id: &ConceptId) -> Option<&Instance>

Source

pub fn remove_entity_instance_by_id( &mut self, id: &ConceptId, ) -> Result<Instance, String>

Source

pub fn flows_from(&self, entity_id: &ConceptId) -> Vec<&Flow>

Source

pub fn flows_to(&self, entity_id: &ConceptId) -> Vec<&Flow>

Source

pub fn upstream_entities(&self, entity_id: &ConceptId) -> Vec<&Entity>

Source

pub fn downstream_entities(&self, entity_id: &ConceptId) -> Vec<&Entity>

Source

pub fn find_entity_by_name_and_namespace( &self, name: &str, namespace: &str, ) -> Option<ConceptId>

Source

pub fn find_entity_by_name(&self, name: &str) -> Option<ConceptId>

Source

pub fn find_resource_by_name(&self, name: &str) -> Option<ConceptId>

Source

pub fn find_role_by_name(&self, name: &str) -> Option<ConceptId>

Source

pub fn find_entity_instance_by_name(&self, name: &str) -> Option<ConceptId>

Source

pub fn find_entity_instance_by_name_and_namespace( &self, name: &str, namespace: &str, ) -> Option<ConceptId>

Source

pub fn find_pattern( &self, name: &str, namespace: Option<&str>, ) -> Option<&Pattern>

Source

pub fn all_entities(&self) -> Vec<&Entity>

Source

pub fn all_roles(&self) -> Vec<&Role>

Source

pub fn all_resources(&self) -> Vec<&Resource>

Source

pub fn all_flows(&self) -> Vec<&Flow>

Source

pub fn all_instances(&self) -> Vec<&ResourceInstance>

Source

pub fn all_patterns(&self) -> Vec<&Pattern>

Source

pub fn policy_count(&self) -> usize

Source

pub fn add_policy(&mut self, policy: Policy) -> Result<(), String>

Source

pub fn has_policy(&self, id: &ConceptId) -> bool

Source

pub fn get_policy(&self, id: &ConceptId) -> Option<&Policy>

Source

pub fn remove_policy(&mut self, id: &ConceptId) -> Result<Policy, String>

Source

pub fn all_policies(&self) -> Vec<&Policy>

Source

pub fn metric_count(&self) -> usize

Source

pub fn add_metric(&mut self, metric: Metric) -> Result<(), String>

Source

pub fn has_metric(&self, id: &ConceptId) -> bool

Source

pub fn get_metric(&self, id: &ConceptId) -> Option<&Metric>

Source

pub fn all_metrics(&self) -> Vec<&Metric>

Source

pub fn mapping_count(&self) -> usize

Source

pub fn add_mapping(&mut self, mapping: MappingContract) -> Result<(), String>

Source

pub fn has_mapping(&self, id: &ConceptId) -> bool

Source

pub fn get_mapping(&self, id: &ConceptId) -> Option<&MappingContract>

Source

pub fn all_mappings(&self) -> Vec<&MappingContract>

Source

pub fn projection_count(&self) -> usize

Source

pub fn add_projection( &mut self, projection: ProjectionContract, ) -> Result<(), String>

Source

pub fn has_projection(&self, id: &ConceptId) -> bool

Source

pub fn get_projection(&self, id: &ConceptId) -> Option<&ProjectionContract>

Source

pub fn all_projections(&self) -> Vec<&ProjectionContract>

Source

pub fn extend(&mut self, other: Graph) -> Result<(), String>

Extend this graph with all nodes and policies from another graph. The operation is atomic: the existing graph is only modified if the entire merge succeeds, which prevents partial state when errors occur.

Source

pub fn validate(&self) -> ValidationResult

Validate the graph by evaluating all policies against it and collecting any violations produced. Returns a ValidationResult.

Source§

impl Graph

Source

pub fn export_rdf(&self, format: &str) -> Result<String, KgError>

Source§

impl Graph

Trait Implementations§

Source§

impl Clone for Graph

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Graph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Graph

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Graph

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Graph

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Forget for Graph

§

impl Freeze for Graph

§

impl Move for Graph

§

impl RefUnwindSafe for Graph

§

impl Send for Graph

§

impl Sync for Graph

§

impl Unpin for Graph

§

impl UnsafeUnpin for Graph

§

impl UnwindSafe for Graph

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.