Skip to main content

AsyncRDF

Trait AsyncRDF 

Source
pub trait AsyncRDF {
    type Subject: Display + Sync + Send;
    type IRI: Display + Hash + Eq + Sync + Send;
    type BNode: Display + Sync + Send;
    type Literal: Display + Sync + Send;
    type Term: Display + Sync + Send;
    type Err: Display + Sync + Send;

    // Required methods
    fn get_predicates_subject<'life0, 'life1, 'async_trait>(
        &'life0 self,
        subject: &'life1 Self::Subject,
    ) -> Pin<Box<dyn Future<Output = Result<HashSet<Self::IRI>, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_objects_for_subject_predicate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        subject: &'life1 Self::Subject,
        pred: &'life2 Self::IRI,
    ) -> Pin<Box<dyn Future<Output = Result<HashSet<Self::Term>, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_subjects_for_object_predicate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        object: &'life1 Self::Term,
        pred: &'life2 Self::IRI,
    ) -> Pin<Box<dyn Future<Output = Result<HashSet<Self::Subject>, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

An asynchronous trait for querying RDF graphs.

This trait provides a common interface for performing asynchronous queries on RDF graphs. It abstracts over the specific representation of RDF components, allowing implementations to use different backend storage systems or data structures.

§Associated Types

The trait defines several associated types that must be specified by implementors:

  • Subject: Represents an RDF subject (typically an IRI or blank node)
  • IRI: Represents an Internationalized Resource Identifier
  • BNode: Represents a blank node
  • Literal: Represents a literal value (string, number, etc.)
  • Term: Represents any RDF term (IRI, blank node, or literal)
  • Err: The error type returned by operations

§Thread Safety

All associated types must implement Sync + Send to enable safe concurrent access across thread boundaries, which is essential for asynchronous operations.

Required Associated Types§

Source

type Subject: Display + Sync + Send

The type representing an RDF subject.

Source

type IRI: Display + Hash + Eq + Sync + Send

The type representing an Internationalized Resource Identifier (IRI).

Source

type BNode: Display + Sync + Send

The type representing an RDF blank node.

Source

type Literal: Display + Sync + Send

The type representing an RDF literal value.

Source

type Term: Display + Sync + Send

The type representing any RDF term.

Source

type Err: Display + Sync + Send

The error type returned by trait operations.

Required Methods§

Source

fn get_predicates_subject<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 Self::Subject, ) -> Pin<Box<dyn Future<Output = Result<HashSet<Self::IRI>, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves all predicates associated with a given subject.

§Arguments
  • subject - A reference to the subject whose predicates should be retrieved
Source

fn get_objects_for_subject_predicate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, subject: &'life1 Self::Subject, pred: &'life2 Self::IRI, ) -> Pin<Box<dyn Future<Output = Result<HashSet<Self::Term>, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieves all objects for a given subject-predicate pair.

§Arguments
  • subject - A reference to the subject of the triples
  • pred - A reference to the predicate (property) of the triples
Source

fn get_subjects_for_object_predicate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, object: &'life1 Self::Term, pred: &'life2 Self::IRI, ) -> Pin<Box<dyn Future<Output = Result<HashSet<Self::Subject>, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieves all subjects that have a specific object-predicate pair.

§Arguments
  • object - A reference to the object (term) to search for
  • pred - A reference to the predicate (property) to match

Implementors§