Struct typedb_driver::concept::Relation
source · pub struct Relation {
pub iid: IID,
pub type_: RelationType,
pub is_inferred: bool,
}
Expand description
Relation is an instance of a relation type and can be uniquely addressed by a combination of its type, owned attributes and role players.
Fields§
§iid: IID
The unique id of this Relation
type_: RelationType
The type which this Relation belongs to
is_inferred: bool
If this Relation is inferred by a [Reasoning Rule] or not
Trait Implementations§
source§impl PartialEq for Relation
impl PartialEq for Relation
source§impl RelationAPI for Relation
impl RelationAPI for Relation
source§fn add_role_player<'tx>(
&self,
transaction: &'tx Transaction<'_>,
role_type: RoleType,
player: Thing
) -> BoxPromise<'tx, Result>
fn add_role_player<'tx>( &self, transaction: &'tx Transaction<'_>, role_type: RoleType, player: Thing ) -> BoxPromise<'tx, Result>
Adds a new role player to play the given role in this
Relation
. Read moresource§fn remove_role_player<'tx>(
&self,
transaction: &'tx Transaction<'_>,
role_type: RoleType,
player: Thing
) -> BoxPromise<'tx, Result>
fn remove_role_player<'tx>( &self, transaction: &'tx Transaction<'_>, role_type: RoleType, player: Thing ) -> BoxPromise<'tx, Result>
Removes the association of the given instance that plays the given role in this
Relation
. Read moresource§fn get_players_by_role_type<'tx>(
&self,
transaction: &'tx Transaction<'_>,
role_types: Vec<RoleType>
) -> Result<BoxStream<'tx, Result<Thing>>>
fn get_players_by_role_type<'tx>( &self, transaction: &'tx Transaction<'_>, role_types: Vec<RoleType> ) -> Result<BoxStream<'tx, Result<Thing>>>
Retrieves all role players of this
Relation
, optionally filtered by given role types. Read moresource§fn get_role_players<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> Result<BoxStream<'tx, Result<(RoleType, Thing)>>>
fn get_role_players<'tx>( &self, transaction: &'tx Transaction<'_> ) -> Result<BoxStream<'tx, Result<(RoleType, Thing)>>>
Retrieves a mapping of all instances involved in the
Relation
and the role each play. Read moresource§fn get_relating<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> Result<BoxStream<'tx, Result<RoleType>>>
fn get_relating<'tx>( &self, transaction: &'tx Transaction<'_> ) -> Result<BoxStream<'tx, Result<RoleType>>>
Retrieves all role types currently played in this
Relation
. Read moresource§impl ThingAPI for Relation
impl ThingAPI for Relation
source§fn is_inferred(&self) -> bool
fn is_inferred(&self) -> bool
Checks if this
Thing
is inferred by a [Reasoning Rule]. Read morefn to_thing_cloned(&self) -> Thing
source§fn is_deleted<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> BoxPromise<'tx, Result<bool>>
fn is_deleted<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result<bool>>
Checks if this
Thing
is deleted. Read moresource§fn delete<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> BoxPromise<'tx, Result>
fn delete<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result>
Deletes this
Thing
. Read moresource§fn get_has<'tx>(
&self,
transaction: &'tx Transaction<'_>,
attribute_types: Vec<AttributeType>,
annotations: Vec<Annotation>
) -> Result<BoxStream<'tx, Result<Attribute>>>
fn get_has<'tx>( &self, transaction: &'tx Transaction<'_>, attribute_types: Vec<AttributeType>, annotations: Vec<Annotation> ) -> Result<BoxStream<'tx, Result<Attribute>>>
Retrieves the
Attribute
s that this Thing
owns. Optionally, filtered by an AttributeType
or a list of AttributeType
s. Optionally, filtered by Annotation
s. Read moresource§fn set_has<'tx>(
&self,
transaction: &'tx Transaction<'_>,
attribute: Attribute
) -> BoxPromise<'tx, Result>
fn set_has<'tx>( &self, transaction: &'tx Transaction<'_>, attribute: Attribute ) -> BoxPromise<'tx, Result>
source§fn unset_has<'tx>(
&self,
transaction: &'tx Transaction<'_>,
attribute: Attribute
) -> BoxPromise<'tx, Result>
fn unset_has<'tx>( &self, transaction: &'tx Transaction<'_>, attribute: Attribute ) -> BoxPromise<'tx, Result>
source§fn get_relations<'tx>(
&self,
transaction: &'tx Transaction<'_>,
role_types: Vec<RoleType>
) -> Result<BoxStream<'tx, Result<Relation>>>
fn get_relations<'tx>( &self, transaction: &'tx Transaction<'_>, role_types: Vec<RoleType> ) -> Result<BoxStream<'tx, Result<Relation>>>
Retrieves all the
Relations
which this Thing
plays a role in, optionally filtered by one or more given roles. Read moresource§fn get_playing<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> Result<BoxStream<'tx, Result<RoleType>>>
fn get_playing<'tx>( &self, transaction: &'tx Transaction<'_> ) -> Result<BoxStream<'tx, Result<RoleType>>>
Retrieves the roles that this
Thing
is currently playing. Read moreimpl Eq for Relation
impl StructuralPartialEq for Relation
Auto Trait Implementations§
impl RefUnwindSafe for Relation
impl Send for Relation
impl Sync for Relation
impl Unpin for Relation
impl UnwindSafe for Relation
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request