pub trait GraphORM {
// Required methods
async fn serialize_schema(
graph: &mut impl Graph,
) -> Result<(), GraphORMError>;
fn serialize_stream(
&self,
subject: Arc<Term>,
) -> Result<impl Stream<Item = Arc<Triple>> + Unpin + Send, GraphORMError>;
async fn deserialize(
graph: impl GraphView,
subject: &Term,
) -> Result<GraphORMMeta<Self>, GraphORMError>
where Self: Sized + Debug + PartialEq;
// Provided methods
fn rdf_subject(&self) -> Result<Arc<Term>, GraphORMError> { ... }
fn rdf_type() -> Arc<Term> { ... }
fn into_meta(self) -> GraphORMMeta<Self>
where Self: Sized + Unpin + Debug + PartialEq + Sync + Send { ... }
}Required Methods§
Sourceasync fn serialize_schema(graph: &mut impl Graph) -> Result<(), GraphORMError>
async fn serialize_schema(graph: &mut impl Graph) -> Result<(), GraphORMError>
Generate the schema for the target.
This method should generate triples representing an RDF schema for the target. The serialisation from Self::serialize_stream should be valid under this schema.
There is no presumption about hte used entailment regime.
Sourcefn serialize_stream(
&self,
subject: Arc<Term>,
) -> Result<impl Stream<Item = Arc<Triple>> + Unpin + Send, GraphORMError>
fn serialize_stream( &self, subject: Arc<Term>, ) -> Result<impl Stream<Item = Arc<Triple>> + Unpin + Send, GraphORMError>
Serialise into a stream of triples.
Sourceasync fn deserialize(
graph: impl GraphView,
subject: &Term,
) -> Result<GraphORMMeta<Self>, GraphORMError>
async fn deserialize( graph: impl GraphView, subject: &Term, ) -> Result<GraphORMMeta<Self>, GraphORMError>
Deserialize from a Graph by providing a known subject.
Provided Methods§
Sourcefn rdf_subject(&self) -> Result<Arc<Term>, GraphORMError>
fn rdf_subject(&self) -> Result<Arc<Term>, GraphORMError>
Generate a subject.
This method generates a subject term.
It is called by GraphORMMeta::serialize_stream when using the SubjectMode::Generated strategy.
The default implementation generates a new blank node.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.