Skip to main content

Term

Trait Term 

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

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

Represents any RDF term that can appear in an RDF graph.

In RDF, terms are the fundamental building blocks of triples. A term can be an IRI (Internationalized Resource Identifier), a blank node, a literal value, or (in RDF-star) a quoted triple.

Required Methods§

Source

fn kind(&self) -> TermKind

Returns the kind of RDF term this represents.

This method allows distinguishing between different types of RDF terms at runtime.

Source

fn lexical_form(&self) -> String

Returns the lexical representation of this term as a string.

Provided Methods§

Source

fn is_iri(&self) -> bool

Returns true if this term is an IRI.

Source

fn is_blank_node(&self) -> bool

Returns true if this term is a blank node.

Source

fn is_literal(&self) -> bool

Returns true if this term is a literal.

Source

fn is_triple(&self) -> bool

Returns true if this term 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 Term for Term

Implements the Term trait for OxTerm.

This is the main implementation for RDF terms, supporting IRIs, blank nodes, literals, and RDF-star quoted triples.

Source§

fn kind(&self) -> TermKind

Returns the kind of RDF term.

§Returns
  • TermKind::Iri for named nodes
  • TermKind::BlankNode for blank nodes
  • TermKind::Literal for literal values
  • TermKind::Triple for RDF-star quoted triples
Source§

fn lexical_form(&self) -> String

§Returns
  • For IRIs: the full IRI string
  • For blank nodes: the blank node identifier (e.g., “_:b0”)
  • For literals: the literal value without datatype or language tag
  • For triples: the string representation of the entire triple

Implementors§