Skip to main content

Subject

Trait Subject 

Source
pub trait Subject:
    Debug
    + Display
    + PartialEq
    + Clone
    + Eq
    + Hash {
    // Required method
    fn kind(&self) -> TermKind;

    // Provided methods
    fn is_iri(&self) -> bool { ... }
    fn is_blank_node(&self) -> bool { ... }
    fn is_triple(&self) -> bool { ... }
}
Expand description

Represents the subject position of an RDF triple.

In RDF, a subject can be an IRI, a blank node, or (in RDF-star) a triple. This trait defines the common behavior for all types that can appear as subjects in RDF statements.

Required Methods§

Source

fn kind(&self) -> TermKind

Returns the kind of RDF term this subject represents.

This method allows distinguishing between IRIs, blank nodes, and quoted triples at runtime.

Provided Methods§

Source

fn is_iri(&self) -> bool

Returns true if this subject is an IRI.

Source

fn is_blank_node(&self) -> bool

Returns true if this subject is a blank node.

Source

fn is_triple(&self) -> bool

Returns true if this subject is a quoted triple (RDF-star).

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.

Implementations on Foreign Types§

Source§

impl Subject for NamedOrBlankNode

Implements the Subject trait for OxSubject (owned version).

This allows owned NamedOrBlankNode instances from oxrdf to be used as RDF subjects in the core trait system.

Source§

fn kind(&self) -> TermKind

Returns the kind of term this subject represents.

§Returns
  • TermKind::Iri for named nodes (IRIs)
  • TermKind::BlankNode for blank nodes
Source§

impl Subject for NamedOrBlankNodeRef<'_>

Implements the Subject trait for OxSubjectRef (borrowed version).

This allows borrowed NamedOrBlankNodeRef instances from oxrdf to be used as RDF subjects without requiring ownership.

Source§

fn kind(&self) -> TermKind

Returns the kind of term this subject reference represents.

§Returns
  • TermKind::Iri for named nodes (IRIs)
  • TermKind::BlankNode for blank nodes

Implementors§