Skip to main content

Term

Enum Term 

Source
pub enum Term {
    BlankId(BlankIdBuf),
    Ground(GroundTerm),
}
Expand description

Term.

Lexical representation of an RDF resource.

Variants§

§

BlankId(BlankIdBuf)

Blank identifier.

§

Ground(GroundTerm)

Ground term.

Implementations§

Source§

impl Term

Source

pub fn iri(iri: IriBuf) -> Self

Creates an IRI term.

Source

pub fn literal(literal: Literal) -> Self

Creates a literal term.

Source

pub fn id(id: Id) -> Self

Creates a term from an identifier (IRI or blank node identifier).

Source

pub fn is_id(&self) -> bool

Checks if this term is an identifier, i.e. a blank node identifier or an IRI (as opposed to a literal).

Source

pub fn as_id(&self) -> Option<IdRef<'_>>

Returns this term as an identifier, unless it is a literal.

Source

pub fn is_blank_id(&self) -> bool

Checks if this is a blank node identifier.

Source

pub fn is_ground(&self) -> bool

Checks if this is a ground term (an IRI or a literal, but not a blank node identifier).

Source

pub fn as_blank_id(&self) -> Option<&BlankId>

Returns this term as a blank node identifier, if it is one.

Source

pub fn as_ground(&self) -> Option<&GroundTerm>

Returns this term as a ground term, if it is one.

Source

pub fn into_ground(self) -> Result<GroundTerm, BlankIdBuf>

Turns this term into a ground term, or returns the blank node identifier if it isn’t one.

Source

pub fn is_iri(&self) -> bool

Checks if this is an IRI.

Source

pub fn as_iri(&self) -> Option<&Iri>

Returns this term as an IRI, if it is one.

Source

pub fn into_iri(self) -> Result<IriBuf, Self>

Turns this term into an IRI, or returns it unchanged if it isn’t one.

Source

pub fn is_literal(&self) -> bool

Checks if this is a literal.

Source

pub fn as_literal(&self) -> Option<LiteralRef<'_>>

Returns this term as a literal, if it is one.

Source

pub fn as_ref(&self) -> TermRef<'_>

Returns a reference to this term.

Source

pub fn as_cow(&self) -> CowTerm<'_>

Returns a copy-on-write reference to this term.

Source

pub fn into_cow(self) -> CowTerm<'static>

Turns this term into a copy-on-write term.

Source

pub fn into_id(self) -> Result<Id, Literal>

Turns this term into an identifier, or returns the literal value if it isn’t one.

Trait Implementations§

Source§

impl AsPattern for Term

Blank node identifiers act as the variable side of the Pattern ground/variable abstraction, and ground terms act as the ground side.

This lets lexical RDF data be used directly with rdf-types’ pattern matching and isomorphism-checking facilities (e.g. are_isomorphic and find_bijection), since blank node identifiers, like pattern variables, are existentially quantified and can be renamed without changing the meaning of the data.

Source§

type Ground = GroundTerm

Ground value type.
Source§

type Var = BlankId

Variable type.
Source§

fn as_pattern(&self) -> Pattern<&GroundTerm, &BlankId>

Borrows this value as a Pattern.
Source§

fn is_ground(&self) -> bool

Checks if this value is a ground value (as opposed to a variable).
Source§

fn is_var(&self) -> bool

Checks if this value is a variable (as opposed to a ground value).
Source§

fn is_ground_and(&self, f: impl FnOnce(&Self::Ground) -> bool) -> bool

Returns true if this value is a ground value satisfying the given predicate, and false if it is a variable.
Source§

fn is_var_and(&self, f: impl FnOnce(&Self::Var) -> bool) -> bool

Returns true if this value is a variable satisfying the given predicate, and false if it is a ground value.
Source§

fn is_ground_or(&self, f: impl FnOnce(&Self::Var) -> bool) -> bool

Returns true if this value is a ground value, or if it is a variable satisfying the given predicate.
Source§

fn is_var_or(&self, f: impl FnOnce(&Self::Ground) -> bool) -> bool

Returns true if this value is a variable, or if it is a ground value satisfying the given predicate.
Source§

impl Clone for Term

Source§

fn clone(&self) -> Term

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Comparable<Term> for CowTerm<'_>

Source§

fn compare(&self, key: &Term) -> Ordering

Compare self to key and return their ordering.
Source§

impl Comparable<Term> for TermRef<'_>

Source§

fn compare(&self, key: &Term) -> Ordering

Compare self to key and return their ordering.
Source§

impl Debug for Term

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Term

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Term

Source§

impl Equivalent<Term> for CowTerm<'_>

Source§

fn equivalent(&self, key: &Term) -> bool

Compare self to key and return true if they are equal.
Source§

impl Equivalent<Term> for TermRef<'_>

Source§

fn equivalent(&self, key: &Term) -> bool

Compare self to key and return true if they are equal.
Source§

impl<'a> From<&'a Term> for CowTerm<'a>

Source§

fn from(value: &'a Term) -> Self

Converts to this type from the input type.
Source§

impl From<BlankIdBuf> for Term

Source§

fn from(value: BlankIdBuf) -> Self

Converts to this type from the input type.
Source§

impl From<CowTerm<'_>> for Term

Source§

fn from(value: CowTerm<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<GroundTerm> for Term

Source§

fn from(value: GroundTerm) -> Self

Converts to this type from the input type.
Source§

impl From<Id> for Term

Source§

fn from(value: Id) -> Self

Converts to this type from the input type.
Source§

impl From<IriBuf> for Term

Source§

fn from(value: IriBuf) -> Self

Converts to this type from the input type.
Source§

impl From<Literal> for Term

Source§

fn from(value: Literal) -> Self

Converts to this type from the input type.
Source§

impl From<Term> for CowTerm<'_>

Source§

fn from(value: Term) -> Self

Converts to this type from the input type.
Source§

impl From<TermRef<'_>> for Term

Source§

fn from(value: TermRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl Hash for Term

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Term

Source§

fn cmp(&self, other: &Term) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Term

Source§

fn eq(&self, other: &Term) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<CowTerm<'_>> for Term

Source§

fn eq(&self, other: &CowTerm<'_>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Term> for CowTerm<'_>

Source§

fn eq(&self, other: &Term) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Term> for TermRef<'_>

Source§

fn eq(&self, other: &Term) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<TermRef<'a>> for Term

Source§

fn eq(&self, other: &TermRef<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Term

Source§

fn partial_cmp(&self, other: &Term) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<CowTerm<'_>> for Term

Source§

fn partial_cmp(&self, other: &CowTerm<'_>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Term> for CowTerm<'_>

Source§

fn partial_cmp(&self, other: &Term) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Term> for TermRef<'_>

Source§

fn partial_cmp(&self, other: &Term) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a> PartialOrd<TermRef<'a>> for Term

Source§

fn partial_cmp(&self, other: &TermRef<'a>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl RdfDisplay for Term

Source§

fn rdf_fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
Source§

fn rdf_display(&self) -> RdfDisplayed<&Self>

Prepare the value to be formatted as an RDF syntax element.
Source§

impl StructuralPartialEq for Term

Auto Trait Implementations§

§

impl Freeze for Term

§

impl RefUnwindSafe for Term

§

impl Send for Term

§

impl Sync for Term

§

impl Unpin for Term

§

impl UnsafeUnpin for Term

§

impl UnwindSafe for Term

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.