owl_structural_model/individual.rs
1//! Named and scoped anonymous individuals in assertions and restrictions.
2
3use crate::BlankNodeId;
4use iri_rfc3987::Iri;
5
6/// An OWL individual with a caller-selected anonymous identity representation.
7#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
8#[serde(deny_unknown_fields)]
9pub enum Individual<B = BlankNodeId> {
10 /// A named individual.
11 Named(Iri<String>),
12 /// An anonymous individual, scoped by the default RDF identity type.
13 Anonymous(B),
14}
15impl<B> Individual<B> {
16 /// Create a named individual.
17 #[must_use]
18 pub fn named(iri: Iri<String>) -> Self {
19 Self::Named(iri)
20 }
21 /// Create an anonymous individual using the caller's identity contract.
22 #[must_use]
23 pub fn anonymous(identity: B) -> Self {
24 Self::Anonymous(identity)
25 }
26}