Expand description
§owl-structural-model
Typed OWL 2 structural values for Rust.
owl-structural-model is a small, dependency-light model for representing
the structural values of OWL 2: entities, class expressions, literals,
annotations, axioms, ontology identity, and structural patches. It is intended
for parsers, editors, validators, serializers, and storage adapters that need
typed OWL values without taking a dependency on an RDF store or a reasoner.
The target standard is OWL 2, the current version of the W3C Web Ontology Language. This crate models a deliberately small, currently supported subset of the OWL 2 structural specification; it is not an OWL 2 parser, reasoner, or full conformance implementation, and it does not model the older OWL 1 API.
§W3C specifications
- OWL 2 Web Ontology Language Document Overview
- OWL 2 Structural Specification and Functional-Style Syntax
- OWL 2 Mapping to RDF Graphs
§What it provides
The crate keeps the structural layer explicit:
EntityandEntityKindrepresent OWL declarations.ClassExpressionandObjectPropertyExpressionrepresent nested OWL expressions.OwlLiteral,Annotation, andAxiomAnnotationspreserve typed values.Axiomrepresents the currently supported structural axiom forms.OntologyIdrepresents anonymous, named, and versioned ontology identity.OntologyPatchrepresents a non-empty set of changes to one ontology.
It does not parse files, perform I/O, access a graph store, run a reasoner, or choose an application-specific profile. A caller can stream a document as individual axioms and retain only the bounded structural values it needs.
§Example
use iri_rfc3987::Iri;
use owl_structural_model::{Axiom, ClassExpression, Entity};
fn iri(value: &str) -> Iri<String> {
Iri::parse(value).expect("example IRI is valid").into()
}
let customer = Entity::class(iri("https://example.org/Customer"));
let declaration = Axiom::declaration(customer);
let subclass = Axiom::sub_class_of(
ClassExpression::named(iri("https://example.org/Customer")),
ClassExpression::named(iri("https://example.org/Party")),
);
assert!(matches!(declaration, Axiom::Declaration { .. }));
assert!(matches!(subclass, Axiom::SubClassOf { .. }));§Validation
Constructors reject invalid structural shapes immediately. For example,
equivalent classes require at least two operands and language-tagged literals
require a non-empty language tag. Errors are returned as the typed
StructuralModelError enum.
§Scope and memory
The crate models individual structural values and explicit, caller-owned patches. It does not promise that an entire ontology fits in memory. A parser or application handling an unbounded source should stream axioms and apply its own explicit limits or persistence strategy.
§Related crates
iri-rfc3987— typed IRI parsing, validation, and resolution.iri-namespace— validated RDF namespaces, prefixes, and CURIEs.rdf-winnow— reusable RDF lexical parsers built onwinnow.shacl-structural-model— typed structural values for SHACL shapes.sparql-results— async streaming SPARQL Results XML and JSON serialization.
§License
Licensed under either of:
- Apache License, Version 2.0
- MIT License
at your option. Typed OWL 2 structural values without an RDF-store dependency.
Structs§
- Annotation
- An OWL annotation.
- Axiom
Annotations - Axiom annotations attached to one structural axiom.
- Entity
- An OWL entity declaration target.
- Ontology
Id - OWL ontology identity: optional ontology IRI plus optional version IRI.
- Ontology
Patch - A non-empty collection of structural changes for one ontology identity.
Enums§
- Annotation
Subject - Subject of an OWL annotation assertion.
- Annotation
Value - A value that can appear in an OWL annotation.
- Axiom
- An OWL structural axiom.
- Class
Expression - An OWL class expression.
- Entity
Kind - Kind of OWL entity.
- Object
Property Expression - An OWL object property expression.
- Ontology
Patch Operation - One structural ontology patch operation.
- OwlLiteral
- A literal value used in OWL structural annotations and axioms.
- Structural
Model Error - A structural value failed an invariant at construction time.
Type Aliases§
- Ontology
Identity - Alias emphasizing that this value is metadata rather than a document.