GraphORMMeta

Struct GraphORMMeta 

Source
pub struct GraphORMMeta<T>
where T: Debug + PartialEq,
{ /* private fields */ }
Expand description

A descriptor to track meta information about the serialisation of some target on the graph.

This is necessary because simply keeping the target object would cause loss of information. For example, if a struct is deserialised from a graph (e.g. by calling GraphORM::deserialize), the original subject needs to be noted.

Implementations§

Source§

impl<T> GraphORMMeta<T>
where T: GraphORM + Unpin + Debug + PartialEq + Sync + Send,

Source

pub fn new(thing: T) -> Self

Wrap a target into the descriptor.

This function consumes the target and stores it.

Source

pub fn into_deref(self) -> T

Unwrap the target.

This operation consumes the meta descriptor, thus causing any meta-information to be lost. Serializing the target later will require to re-create a valid [GraphORMMeta] wrtapper.
Source

pub fn with_subject(self, subject: Arc<Term>) -> Self

Add a pre-defined subject to the descriptor.

Subsequent serialisations will use this subject.

Source

pub fn fixate_subject(&mut self) -> Result<(), GraphORMError>

Fixate the subject generated by the target.

This calls GraphORM::rdf_subject once and stores the generated subject for later re-use.

If the subject mode already is SubjectMode::Static, this function does not change the subject.

Source

pub fn subject(&self) -> Result<Arc<Term>, GraphORMError>

Source

pub fn serialize_stream( &self, ) -> Result<impl Stream<Item = Arc<Triple>> + Unpin + Send + use<'_, T>, GraphORMError>

Serialise the target into a stream of triples.

This is a proxy for GraphORM::serialize_stream of the target, injecting the desired subject.

Source

pub async fn serialize( &self, graph: &mut impl Graph, ) -> Result<(), GraphORMError>

Serialize the target into an existing Graph.

This method calls the Graph::merge_stream method, passing the stream of triples for the target to it.

Trait Implementations§

Source§

impl<T> Clone for GraphORMMeta<T>
where T: Debug + PartialEq + Clone,

Source§

fn clone(&self) -> GraphORMMeta<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for GraphORMMeta<T>
where T: Debug + PartialEq + Debug,

Source§

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

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

impl<T> Deref for GraphORMMeta<T>
where T: Debug + PartialEq,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> DerefMut for GraphORMMeta<T>
where T: Debug + PartialEq,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> Graph for GraphORMMeta<T>
where T: GraphORM + Unpin + Debug + PartialEq + Sync + Send,

Source§

type View<'g> = &'g GraphORMMeta<T> where Self: 'g

Source§

async fn view(&self) -> Self::View<'_>

Source§

fn add( &mut self, triple: Arc<Triple>, ) -> impl Future<Output = Result<(), GraphError>> + Send

Source§

fn remove( &mut self, triple: TripleRef<'_>, ) -> impl Future<Output = Result<(), GraphError>> + Send

Source§

fn clear(&mut self) -> impl Future<Output = Result<(), GraphError>> + Send

Source§

fn merge<G>( &mut self, source_graph: G, ) -> impl Future<Output = Result<(), GraphError>> + Send
where G: GraphView,

Source§

fn merge_stream<S, E>( &mut self, stream: S, ) -> impl Future<Output = Result<(), GraphError>> + Send
where S: Stream<Item = Result<Arc<Triple>, E>> + Unpin + Send, GraphError: From<E>, E: Send,

Source§

impl<'a, T> GraphView for &'a GraphORMMeta<T>
where T: GraphORM + Unpin + Debug + PartialEq + Sync + Send + 'a,

Source§

type Stream = Pin<Box<dyn Stream<Item = Result<Arc<Triple>, GraphError>> + Send + Unpin + 'a>>

Source§

type Filter<FilterType> = DefaultFilter<&'a GraphORMMeta<T>, FilterType> where FilterType: TripleFilter + Send + Sync + Unpin + Clone

Source§

type Matches<MatchesType> = DefaultMatches<MatchesType, &'a GraphORMMeta<T>> where MatchesType: Matches + Unpin

Source§

type SubjectStream<'stream> = Map<<<&'a GraphORMMeta<T> as GraphView>::Matches<(Option<&'stream Term>, Option<&'stream Term>, Option<&'stream Term>)> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type PredicateStream<'stream> = Map<<<&'a GraphORMMeta<T> as GraphView>::Matches<(Option<&'stream Term>, Option<&'stream Term>, Option<&'stream Term>)> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type ObjectStream<'stream> = Map<<<&'a GraphORMMeta<T> as GraphView>::Matches<(Option<&'stream Term>, Option<&'stream Term>, Option<&'stream Term>)> as GraphView>::Stream, fn(Result<Arc<Triple>, GraphError>) -> Result<Arc<Term>, GraphError>>

Source§

type SubjectStreamDedup<'stream> = DedupStream<<&'a GraphORMMeta<T> as GraphView>::SubjectStream<'stream>, Arc<Term>>

Source§

type ObjectStreamDedup<'stream> = DedupStream<<&'a GraphORMMeta<T> as GraphView>::ObjectStream<'stream>, Arc<Term>>

Source§

type PredicateStreamDedup<'stream> = DedupStream<<&'a GraphORMMeta<T> as GraphView>::PredicateStream<'stream>, Arc<Term>>

Source§

type CBD<TermType> = CBD<&'a GraphORMMeta<T>, TermType> where TermType: AsRef<Term> + Clone + Send

Source§

async fn stream(self) -> Result<Self::Stream, GraphError>

Source§

async fn filter<FilterType>( self, filter: FilterType, ) -> Result<Self::Filter<FilterType>, GraphError>
where FilterType: TripleFilter + Send + Sync + Unpin + Clone,

Source§

async fn matches<MatchesType>( self, matches: MatchesType, limit: Option<usize>, ) -> Result<Self::Matches<MatchesType>, GraphError>
where MatchesType: Matches + Unpin,

Source§

async fn subjects<'stream>( self, arg1: Option<&'stream Term>, arg2: Option<&'stream Term>, limit: Option<usize>, ) -> Result<Self::SubjectStream<'stream>, GraphError>

Source§

async fn predicates<'stream>( self, arg1: Option<&'stream Term>, arg2: Option<&'stream Term>, limit: Option<usize>, ) -> Result<Self::PredicateStream<'stream>, GraphError>

Source§

async fn objects<'stream>( self, arg1: Option<&'stream Term>, arg2: Option<&'stream Term>, limit: Option<usize>, ) -> Result<Self::ObjectStream<'stream>, GraphError>

Source§

async fn subjects_dedup<'stream>( self, arg1: Option<&'stream Term>, arg2: Option<&'stream Term>, limit: Option<usize>, ) -> Result<Self::SubjectStreamDedup<'stream>, GraphError>

Source§

async fn objects_dedup<'stream>( self, arg1: Option<&'stream Term>, arg2: Option<&'stream Term>, limit: Option<usize>, ) -> Result<Self::ObjectStreamDedup<'stream>, GraphError>

Source§

async fn predicates_dedup<'stream>( self, arg1: Option<&'stream Term>, arg2: Option<&'stream Term>, limit: Option<usize>, ) -> Result<Self::PredicateStreamDedup<'stream>, GraphError>

Source§

fn cbd<TermType>( self, subject: TermType, ) -> impl Future<Output = Result<Self::CBD<TermType>, GraphError>>
where TermType: AsRef<Term> + Clone + Send,

Example Read more
Source§

fn describe( self, subject: &Term, limit: Option<usize>, ) -> impl Future<Output = Result<Self::Matches<SubjectMatch<'_>>, GraphError>> + Send

Source§

fn subject( self, predicate: Option<&Term>, object: Option<&Term>, ) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send

Source§

fn predicate( self, subject: Option<&Term>, object: Option<&Term>, ) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send

Source§

fn object( self, subject: Option<&Term>, predicate: Option<&Term>, ) -> impl Future<Output = Result<Option<Arc<Term>>, GraphError>> + Send

Source§

fn contains( self, triple: TripleRef<'_>, ) -> impl Future<Output = Result<bool, GraphError>> + Send

Source§

fn isomorphic<G2>( self, other: G2, ) -> impl Future<Output = Result<bool, GraphError>> + Send
where G2: GraphView,

Source§

fn ground(self) -> impl Future<Output = Result<bool, GraphError>> + Send

Checks whether graph is ground as defined by RDF Concepts and Abstract Syntax Read more
Source§

fn default_triple_size_hint() -> usize

Source§

fn default_buf_size_hint() -> usize

Source§

fn triple_size_hint(&self) -> usize

Source§

fn buf_size_hint(&self) -> usize

Source§

impl<T> PartialEq for GraphORMMeta<T>
where T: Debug + PartialEq + PartialEq,

Source§

fn eq(&self, other: &GraphORMMeta<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> StructuralPartialEq for GraphORMMeta<T>
where T: Debug + PartialEq,

Auto Trait Implementations§

§

impl<T> Freeze for GraphORMMeta<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for GraphORMMeta<T>
where T: RefUnwindSafe,

§

impl<T> Send for GraphORMMeta<T>
where T: Send,

§

impl<T> Sync for GraphORMMeta<T>
where T: Sync,

§

impl<T> Unpin for GraphORMMeta<T>
where T: Unpin,

§

impl<T> UnwindSafe for GraphORMMeta<T>
where T: UnwindSafe,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more