1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! This is a utility library providing common types
//! when dealing with RDF data:
//! blank node identifier, literal, subject, predicate, object,
//! graph label, gRDF term, triple and quad.
//!
//! The optional feature `meta` provides compatibility
//! with the `locspan` crate to locate every sub-component
//! of a term.
use iref::{Iri, IriBuf};

mod blankid;
mod display;
mod grdf;
mod literal;
mod quad;
mod schema;
mod term;
mod triple;

pub use blankid::*;
pub use display::*;
pub use grdf::*;
pub use literal::*;
pub use quad::*;
pub use schema::*;
pub use term::*;
pub use triple::*;

pub mod dataset;
pub mod generator;
pub mod interpretation;
pub mod pattern;
pub mod utils;
pub mod vocabulary;

pub use dataset::Dataset;
pub use generator::Generator;
pub use interpretation::{Interpretation, InterpretationMut};
pub use vocabulary::{Vocabulary, VocabularyMut};

pub const XSD_STRING: &Iri = static_iref::iri!("http://www.w3.org/2001/XMLSchema#string");

/// IRI type that may be <http://www.w3.org/2001/XMLSchema#string>.
///
/// This is used upon formatting RDF literals to omit the type when it is not
/// required (because it is implicitly `xsd:string`).
pub trait IsXsdStringIri {
	/// Checks if this IRI is <http://www.w3.org/2001/XMLSchema#string>.
	fn is_xsd_string_iri(&self) -> bool;
}

impl IsXsdStringIri for IriBuf {
	fn is_xsd_string_iri(&self) -> bool {
		self == XSD_STRING
	}
}

impl IsXsdStringIri for Iri {
	fn is_xsd_string_iri(&self) -> bool {
		self == XSD_STRING
	}
}