[][src]Crate sophia_term

This crate is part of Sophia, an RDF and Linked Data toolkit in Rust.

Terms are the building blocks of an RDF graph. There are four types of terms: IRIs, blank nodes (BNode for short), literals and variables.

NB: variable only exist in generalized RDF.

This module defines a generic type Term which can be derived differently depending on your needs.

  • RefTerm<'a> (alias of Term<&'a str>) should be used for very short-lived terms, i.e. terms that live less than 'a, which is the lifetime of their underlying text.

  • BoxTerm (alias of Term<Box<str>>) should be used when the term may outlive the text used to create it.

  • RcTerm (alias of Term<Rc<str>>) should also be used for long-lived terms, especially if they need to be cloned multiple times. The use of Rc prevents the duplication of the underlying text, while ensuring that it is cleaned when appropriate.

  • ArcTerm (alias of Term<Arc<str>>) should be used when, additionally, terms need to be sent to other threads.

  • StaticTerm (alias of Term<&'static str>) is a special case of RefTerm` where the underlying text is a static string. Those terms can live as long as the program runs, and be cloned and sent without any restriction.

  • MownTerm (alias of `Term<MownStr<'a>>) should be used in situations where some terms can borrow their data, while others need to own it.

Modules

blank_node

Blank node like specified in RDF.

factory

A TermFactory can be used to create terms while preventing the proliferation of duplicate string.

index_map

A trait for bidirectional mappings between terms and indexes of a smaller type.

iri

IRIs for identifying resources like specified in RDF.

literal

RDF literals like specified in RDF.

matcher

This crate defines generic traits and default implementations for matchers, objects that can be used to match zero, one or several terms.

mown_str

MownStr is either a borrowed reference to a str or an own Box<str>.

ns

Standard and custom namespaces.

variable

Variables like used in SPARQL or universally quantified variables in Notation3.

Macros

namespace

Helper for creating a "namespace module" defining a set of terms within a given IRI space.

ns_iri

Helper for creating a term in a "namespace module". In general, you should use the namespace! macro instead.

ns_term

Helper for creating a term in a "namespace module". In general, you should use the namespace! macro instead.

Enums

Term

Generic type for RDF terms.

TermError

This error is raised when the creation of a term fails.

Traits

TermData

Trait alias for types holding the textual data of terms.

Functions

same_graph_name

Check the equality of two graph names (Option<&Term>) using possibly different TermData.

Type Definitions

ArcTerm

Convenient alias for a specialization of Term<T>.

BoxTerm

Convenient alias for a specialization of Term<T>.

MownTerm

Convenient alias for a specialization of Term<T>.

RcTerm

Convenient alias for a specialization of Term<T>.

RefTerm

Convenient alias for a specialization of Term<T>.

Result

Type alias for Result with default error TermError.

StaticTerm

Convenient alias for a specialization of Term<T>.