GraphORM

Trait GraphORM 

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

Source

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.

Source

fn serialize_stream( &self, subject: Arc<Term>, ) -> Result<impl Stream<Item = Arc<Triple>> + Unpin + Send, GraphORMError>

Serialise into a stream of triples.

Source

async fn deserialize( graph: impl GraphView, subject: &Term, ) -> Result<GraphORMMeta<Self>, GraphORMError>
where Self: Sized + Debug + PartialEq,

Deserialize from a Graph by providing a known subject.

Provided Methods§

Source

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.

Source

fn rdf_type() -> Arc<Term>

Generate the rdf:type of the target.

The default implementation uses rdfs:Resource.

Source

fn into_meta(self) -> GraphORMMeta<Self>
where Self: Sized + Unpin + Debug + PartialEq + Sync + Send,

Wrap into a [GraphOEMMeta] descriptor.

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.

Implementors§