pub enum Term<TD> where
    TD: TermData
{ Iri(Iri<TD>), BNode(BlankNode<TD>), Literal(Literal<TD>), Variable(Variable<TD>), }
Expand description

Generic type for RDF terms.

See module documentation for more detail.

Variants

Iri(Iri<TD>)

An IRI referencing a resource.

BNode(BlankNode<TD>)

A blank node.

Also known as existentially quantified variable.

Literal(Literal<TD>)

An RDF literal.

Variable(Variable<TD>)

A universally quantified variable like in SPARQL or Notation3.

Implementations

Writes the term to the fmt::Write using the NTriples syntax.

This means the IRI is in angled brackets and no prefix is used.

Writes the term to the io::Write using the N3 syntax.

Return a new IRI term from the given text.

May fail if txt is not a valid IRI.

Return a new IRI term from the two given parts (prefix and suffix).

May fail if the concatenation of ns and suffix does not produce a valid IRI.

Return a new blank node term with the given bnode ID.

Currently, this may never fail; however it returns a result for homogeneity with other constructor methods, and because future versions may be more picky regarding bnode IDs.

Return a new literal term with the given value and language tag.

May fail if the language tag is not a valid BCP47 language tag.

Return a new literal term with the given value and datatype.

May fail if dt is not an IRI.

Return a new variable term with the given name.

May fail if name is not a valid variable name.

Borrow the inner contents of the term.

Borrow the inner contents of the term as &str.

Create a new term by applying f to the TermData of self.

Maps the term using the Into trait.

Clone self while transforming the inner TermData with the given factory.

This is done in one step in contrast to calling clone().map(factory).

Apply clone_map() using the Into trait.

Return a term equivalent to this one, with all IRIs (if any) internally represented with all its data in ns, and an empty suffix.

Performances

The returned term will borrow data from this one as much as possible, but strings may be allocated in case a concatenation is required.

Create a new IRI-term from a given IRI without checking its validity.

Pre-conditions

This function conducts no checks if the resulting IRI is valid. This is a contract that is generally assumed. Breaking it could result in unexpected behavior.

However, in debug builds assertions that perform checks are enabled.

Create a new IRI-term from a given namespace and suffix.

Pre-conditions

It is expected that

  • the resulting IRI is valid per RFC3987,
  • suffix is not the empty string (otherwise, new_iri_unchecked should be used instead).

This is a contract that is generally assumed. Breaking it could result in unexpected behavior. However in debug mode, assertions that perform checks are enabled.

Return a new blank node term.

Pre-condition

This function requires that id is a valid bnode ID.

Return a literal term.

Pre-condition

This function requires that lang is a valid language tag. In debug mode this constraint is asserted.

Return a typed literal term.

Panics

Panics if dt cannot be converted into an IRI.

Return a new variable term.

Pre-condition

This function requires that name is a valid variable name.

Trait Implementations

Immutably borrows from an owned value. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Copy term into an instance of this type.

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

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

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Resolve IRIs and the IRIs of typed literals.

Performance

May allocate an intermediate IRI if an IRI is suffixed.

Returns the kind of this term (IRI, literal, blank node, variable).

Return the “value” of this term, possibly split in two substrings. The second part might only be non-empty if this term is an IRI reference. Read more

Return the datatype IRI of this term if it is a literal. Read more

Return the language tag of this term if it is a language-tagged literal. Read more

This method ensures that all implementations of TTerm can be turned into a trait object. Read more

Return the “value” of this term, which depends on its kind: Read more

All terms are absolute, except for: Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Try to convert this term into a native type

Copy this IRI into another type.

Try to copy this IRI into another type.

Performs the conversion.

Performs the conversion.

Type of TTerm used internally by this matcher.

If this matcher matches only one term, return this term, else None.

Check whether this matcher matches t.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.