Skip to main content

rdf_syntax/
lib.rs

1//! The [Resource Description Framework (RDF)][rdf] is a very simple graph data
2//! model defined by the [World Wide Web Consortium (W3C)][w3c] to represent
3//! arbitrary pieces of information, primarily intended for the web. Nodes of
4//! the graph are called *resources*, and resources are connected together using
5//! *relations*, which are resources themselves.
6//!
7//! This crate is built on top of [`rdf-types`](https://crates.io/crates/rdf-types)
8//! to provide the lexical (syntactic) representation of resources (IRIs,
9//! blank node identifiers and literals) as defined by the
10//! [RDF 1.1 Concepts and Abstract Syntax][rdf-concepts] recommendation,
11//! along with the term definitions from [RDF Schema (RDFS)][rdfs]:
12//! - [`Id`] and [`BlankId`] represent, respectively, a resource identifier
13//!   (an IRI or a blank node identifier) and a blank node identifier alone;
14//! - [`Literal`] and [`LiteralType`] represent RDF literals and their
15//!   datatype (either an arbitrary IRI or the `rdf:langString` type paired
16//!   with a [`LangTag`]);
17//! - [`Term`] and [`GroundTerm`] represent, respectively, a lexical RDF term
18//!   (an [`Id`] or a [`Literal`]) and a *ground* term, which excludes blank
19//!   node identifiers (an IRI or a [`Literal`]);
20//! - [`RdfTriple`] and [`RdfQuad`] are triples/quads built from those lexical
21//!   terms, with `Grdf`-prefixed variants ([`GrdfTriple`], [`GrdfQuad`])
22//!   allowing a blank node identifier anywhere in the triple/quad, for
23//!   generalized RDF;
24//! - the [`Interpretation`] trait family maps lexical terms to the semantic
25//!   resources of an [`rdf_types::Domain`], turning lexical RDF data into the
26//!   purely semantic representation manipulated by the `rdf-types` crate.
27//!
28//! Every lexical type above comes in three flavors: an owned version (e.g.
29//! [`Term`]), a borrowed version (e.g. [`TermRef`]), and a copy-on-write
30//! version (e.g. [`CowTerm`]).
31//!
32//! [rdf]: <https://w3c.github.io/rdf-primer/spec/>
33//! [w3c]: <https://www.w3.org/>
34//! [rdf-concepts]: <https://www.w3.org/TR/rdf11-concepts/>
35//! [rdfs]: <https://www.w3.org/TR/rdf-schema/>
36
37/// IRI types re-export.
38pub use iref;
39pub use iref::{InvalidIri, Iri, IriBuf, IriError, IriRef, IriRefBuf, iri, iri_ref};
40
41/// RDF types re-export.
42pub use rdf_types;
43pub use rdf_types::*;
44
45/// Language tag types re-export.
46pub use langtag;
47pub use langtag::{LangTag, LangTagBuf};
48
49mod blankid;
50mod display;
51mod id;
52mod interpretation;
53mod literal;
54mod macros;
55mod quad;
56mod schema;
57mod term;
58mod triple;
59
60pub use blankid::*;
61pub use display::*;
62pub use id::*;
63pub use interpretation::*;
64pub use literal::*;
65pub use quad::*;
66pub use schema::*;
67pub use term::*;
68pub use triple::*;